Merge pull request #203 from gpancot/master

Thank you @gpancot 
try to avoid spourious interrupt
This commit is contained in:
Miki Balboa
2016-04-15 13:52:36 -07:00

View File

@@ -72,12 +72,12 @@ void setup() {
/*Activate the interrupt*/
attachInterrupt(digitalPinToInterrupt(IRQ_PIN), readCard, FALLING);
Serial.println("End setup");
do{ //clear a spourious interrupt at start
;
}while(!bNewInt);
bNewInt = false;
Serial.println("End setup");
}
/**
@@ -86,7 +86,6 @@ void setup() {
void loop() {
if(bNewInt){ //new read interrupt
bNewInt = false;
Serial.print("Interrupt. ");
mfrc522.PICC_ReadCardSerial(); //read the tag data
// Show some details of the PICC (that is: the tag/card)
@@ -95,6 +94,8 @@ void loop() {
Serial.println();
clearInt(mfrc522);
mfrc522.PICC_HaltA();
bNewInt = false;
}
// 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);
}