diff --git a/WiegandNG.cpp b/WiegandNG.cpp index 8a6692c..b14ab4a 100644 --- a/WiegandNG.cpp +++ b/WiegandNG.cpp @@ -1,4 +1,9 @@ #include +#if defined(ESP8266) + #define INTERRUPT_ATTR ICACHE_RAM_ATTR +#else + #define INTERRUPT_ATTR +#endif // pcintbranch @@ -86,13 +91,13 @@ bool WiegandNG::available() { return ret; } -void WiegandNG::ReadD0 () { +INTERRUPT_ATTR void WiegandNG::ReadD0 () { _bitCounted++; // increment bit count for Interrupt connected to D0 shift_left(_buffer,_bufferSize,1); // shift 0 into buffer _lastPulseTime = millis(); // keep track of time last wiegand bit received } -void WiegandNG::ReadD1() { +INTERRUPT_ATTR void WiegandNG::ReadD1() { _bitCounted++; // increment bit count for Interrupt connected to D1 if (_bitCounted > (_bufferSize * 8)) { _bitCounted=0; // overflowed,