Merge pull request #203 from gpancot/master
Thank you @gpancot try to avoid spourious interrupt
This commit is contained in:
@@ -71,13 +71,13 @@ void setup() {
|
|||||||
|
|
||||||
/*Activate the interrupt*/
|
/*Activate the interrupt*/
|
||||||
attachInterrupt(digitalPinToInterrupt(IRQ_PIN), readCard, FALLING);
|
attachInterrupt(digitalPinToInterrupt(IRQ_PIN), readCard, FALLING);
|
||||||
|
|
||||||
Serial.println("End setup");
|
|
||||||
|
|
||||||
do{ //clear a spourious interrupt at start
|
do{ //clear a spourious interrupt at start
|
||||||
;
|
;
|
||||||
}while(!bNewInt);
|
}while(!bNewInt);
|
||||||
bNewInt = false;
|
bNewInt = false;
|
||||||
|
|
||||||
|
Serial.println("End setup");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -86,7 +86,6 @@ void setup() {
|
|||||||
void loop() {
|
void loop() {
|
||||||
|
|
||||||
if(bNewInt){ //new read interrupt
|
if(bNewInt){ //new read interrupt
|
||||||
bNewInt = false;
|
|
||||||
Serial.print("Interrupt. ");
|
Serial.print("Interrupt. ");
|
||||||
mfrc522.PICC_ReadCardSerial(); //read the tag data
|
mfrc522.PICC_ReadCardSerial(); //read the tag data
|
||||||
// Show some details of the PICC (that is: the tag/card)
|
// Show some details of the PICC (that is: the tag/card)
|
||||||
@@ -95,6 +94,8 @@ void loop() {
|
|||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
clearInt(mfrc522);
|
clearInt(mfrc522);
|
||||||
|
mfrc522.PICC_HaltA();
|
||||||
|
bNewInt = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The receiving block needs regular retriggering (tell the tag it should transmit??)
|
// The receiving block needs regular retriggering (tell the tag it should transmit??)
|
||||||
@@ -135,3 +136,4 @@ void clearInt(MFRC522 mfrc522){
|
|||||||
mfrc522.PCD_WriteRegister(mfrc522.ComIrqReg,0x7F);
|
mfrc522.PCD_WriteRegister(mfrc522.ComIrqReg,0x7F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user