diff --git a/examples/CC1101/CC1101_Receive_Interrupt/CC1101_Receive_Interrupt.ino b/examples/CC1101/CC1101_Receive_Interrupt/CC1101_Receive_Interrupt.ino index 65ae79a2..43250bae 100644 --- a/examples/CC1101/CC1101_Receive_Interrupt/CC1101_Receive_Interrupt.ino +++ b/examples/CC1101/CC1101_Receive_Interrupt/CC1101_Receive_Interrupt.ino @@ -75,9 +75,6 @@ void setup() { // flag to indicate that a packet was received volatile bool receivedFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // this function is called when a complete packet // is received by the module // IMPORTANT: this function MUST be 'void' type @@ -86,11 +83,6 @@ volatile bool enableInterrupt = true; ICACHE_RAM_ATTR #endif void setFlag(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we got a packet, set the flag receivedFlag = true; } @@ -98,10 +90,6 @@ void setFlag(void) { void loop() { // check if the flag is set if(receivedFlag) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // reset flag receivedFlag = false; @@ -147,10 +135,6 @@ void loop() { // put module back to listen mode radio.startReceive(); - - // we're ready to receive more packets, - // enable interrupt service routine - enableInterrupt = true; } } diff --git a/examples/CC1101/CC1101_Transmit_Interrupt/CC1101_Transmit_Interrupt.ino b/examples/CC1101/CC1101_Transmit_Interrupt/CC1101_Transmit_Interrupt.ino index 5f9437da..6afb1bd3 100644 --- a/examples/CC1101/CC1101_Transmit_Interrupt/CC1101_Transmit_Interrupt.ino +++ b/examples/CC1101/CC1101_Transmit_Interrupt/CC1101_Transmit_Interrupt.ino @@ -71,9 +71,6 @@ void setup() { // flag to indicate that a packet was sent volatile bool transmittedFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // this function is called when a complete packet // is transmitted by the module // IMPORTANT: this function MUST be 'void' type @@ -82,11 +79,6 @@ volatile bool enableInterrupt = true; ICACHE_RAM_ATTR #endif void setFlag(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we sent a packet, set the flag transmittedFlag = true; } @@ -94,10 +86,6 @@ void setFlag(void) { void loop() { // check if the previous transmission finished if(transmittedFlag) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // reset flag transmittedFlag = false; @@ -136,9 +124,5 @@ void loop() { 0x89, 0xAB, 0xCD, 0xEF}; int state = radio.startTransmit(byteArr, 8); */ - - // we're ready to send more packets, - // enable interrupt service routine - enableInterrupt = true; } } diff --git a/examples/RF69/RF69_Receive_Interrupt/RF69_Receive_Interrupt.ino b/examples/RF69/RF69_Receive_Interrupt/RF69_Receive_Interrupt.ino index da520351..fc2c5804 100644 --- a/examples/RF69/RF69_Receive_Interrupt/RF69_Receive_Interrupt.ino +++ b/examples/RF69/RF69_Receive_Interrupt/RF69_Receive_Interrupt.ino @@ -67,9 +67,6 @@ void setup() { // flag to indicate that a packet was received volatile bool receivedFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // this function is called when a complete packet // is received by the module // IMPORTANT: this function MUST be 'void' type @@ -78,11 +75,6 @@ volatile bool enableInterrupt = true; ICACHE_RAM_ATTR #endif void setFlag(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we got a packet, set the flag receivedFlag = true; } @@ -90,10 +82,6 @@ void setFlag(void) { void loop() { // check if the flag is set if(receivedFlag) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // reset flag receivedFlag = false; @@ -134,10 +122,5 @@ void loop() { // put module back to listen mode radio.startReceive(); - - // we're ready to receive more packets, - // enable interrupt service routine - enableInterrupt = true; } - } diff --git a/examples/RF69/RF69_Transmit_Interrupt/RF69_Transmit_Interrupt.ino b/examples/RF69/RF69_Transmit_Interrupt/RF69_Transmit_Interrupt.ino index 214474f9..de73535d 100644 --- a/examples/RF69/RF69_Transmit_Interrupt/RF69_Transmit_Interrupt.ino +++ b/examples/RF69/RF69_Transmit_Interrupt/RF69_Transmit_Interrupt.ino @@ -84,9 +84,6 @@ void setup() { // flag to indicate that a packet was sent volatile bool transmittedFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // this function is called when a complete packet // is transmitted by the module // IMPORTANT: this function MUST be 'void' type @@ -95,11 +92,6 @@ volatile bool enableInterrupt = true; ICACHE_RAM_ATTR #endif void setFlag(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we sent a packet, set the flag transmittedFlag = true; } @@ -107,10 +99,6 @@ void setFlag(void) { void loop() { // check if the previous transmission finished if(transmittedFlag) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // reset flag transmittedFlag = false; @@ -149,9 +137,5 @@ void loop() { 0x89, 0xAB, 0xCD, 0xEF}; int state = radio.startTransmit(byteArr, 8); */ - - // we're ready to send more packets, - // enable interrupt service routine - enableInterrupt = true; } } diff --git a/examples/SX126x/SX126x_Channel_Activity_Detection_Interrupt/SX126x_Channel_Activity_Detection_Interrupt.ino b/examples/SX126x/SX126x_Channel_Activity_Detection_Interrupt/SX126x_Channel_Activity_Detection_Interrupt.ino index 91580d0e..651da66b 100644 --- a/examples/SX126x/SX126x_Channel_Activity_Detection_Interrupt/SX126x_Channel_Activity_Detection_Interrupt.ino +++ b/examples/SX126x/SX126x_Channel_Activity_Detection_Interrupt/SX126x_Channel_Activity_Detection_Interrupt.ino @@ -64,9 +64,6 @@ void setup() { // flag to indicate that a packet was detected or CAD timed out volatile bool scanFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // this function is called when a complete packet // is received by the module // IMPORTANT: this function MUST be 'void' type @@ -75,11 +72,6 @@ volatile bool enableInterrupt = true; ICACHE_RAM_ATTR #endif void setFlag(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // something happened, set the flag scanFlag = true; } @@ -87,10 +79,6 @@ void setFlag(void) { void loop() { // check if the flag is set if(scanFlag) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // reset flag scanFlag = false; @@ -121,9 +109,5 @@ void loop() { Serial.print(F("failed, code ")); Serial.println(state); } - - // enable interrupt service routine - enableInterrupt = true; } - } diff --git a/examples/SX126x/SX126x_PingPong/SX126x_PingPong.ino b/examples/SX126x/SX126x_PingPong/SX126x_PingPong.ino index e3ed4e96..fcdff8a2 100644 --- a/examples/SX126x/SX126x_PingPong/SX126x_PingPong.ino +++ b/examples/SX126x/SX126x_PingPong/SX126x_PingPong.ino @@ -35,9 +35,6 @@ int transmissionState = RADIOLIB_ERR_NONE; // flag to indicate transmission or reception state bool transmitFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // flag to indicate that a packet was sent or received volatile bool operationDone = false; @@ -46,11 +43,6 @@ volatile bool operationDone = false; // IMPORTANT: this function MUST be 'void' type // and MUST NOT have any arguments! void setFlag(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we sent or received a packet, set the flag operationDone = true; } @@ -95,10 +87,6 @@ void setup() { void loop() { // check if the previous operation finished if(operationDone) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // reset flag operationDone = false; @@ -153,10 +141,6 @@ void loop() { transmissionState = radio.startTransmit("Hello World!"); transmitFlag = true; } - - // we're ready to process more packets, - // enable interrupt service routine - enableInterrupt = true; - + } } diff --git a/examples/SX126x/SX126x_Receive_Interrupt/SX126x_Receive_Interrupt.ino b/examples/SX126x/SX126x_Receive_Interrupt/SX126x_Receive_Interrupt.ino index 1b3daefd..2e2c2faa 100644 --- a/examples/SX126x/SX126x_Receive_Interrupt/SX126x_Receive_Interrupt.ino +++ b/examples/SX126x/SX126x_Receive_Interrupt/SX126x_Receive_Interrupt.ino @@ -81,9 +81,6 @@ void setup() { // flag to indicate that a packet was received volatile bool receivedFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // this function is called when a complete packet // is received by the module // IMPORTANT: this function MUST be 'void' type @@ -92,11 +89,6 @@ volatile bool enableInterrupt = true; ICACHE_RAM_ATTR #endif void setFlag(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we got a packet, set the flag receivedFlag = true; } @@ -104,10 +96,6 @@ void setFlag(void) { void loop() { // check if the flag is set if(receivedFlag) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // reset flag receivedFlag = false; @@ -152,10 +140,5 @@ void loop() { // put module back to listen mode radio.startReceive(); - - // we're ready to receive more packets, - // enable interrupt service routine - enableInterrupt = true; } - } diff --git a/examples/SX126x/SX126x_Transmit_Interrupt/SX126x_Transmit_Interrupt.ino b/examples/SX126x/SX126x_Transmit_Interrupt/SX126x_Transmit_Interrupt.ino index 0bd011c7..850ddbb8 100644 --- a/examples/SX126x/SX126x_Transmit_Interrupt/SX126x_Transmit_Interrupt.ino +++ b/examples/SX126x/SX126x_Transmit_Interrupt/SX126x_Transmit_Interrupt.ino @@ -73,9 +73,6 @@ void setup() { // flag to indicate that a packet was sent volatile bool transmittedFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // this function is called when a complete packet // is transmitted by the module // IMPORTANT: this function MUST be 'void' type @@ -84,11 +81,6 @@ volatile bool enableInterrupt = true; ICACHE_RAM_ATTR #endif void setFlag(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we sent a packet, set the flag transmittedFlag = true; } @@ -96,10 +88,6 @@ void setFlag(void) { void loop() { // check if the previous transmission finished if(transmittedFlag) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // reset flag transmittedFlag = false; @@ -138,9 +126,5 @@ void loop() { 0x89, 0xAB, 0xCD, 0xEF}; int state = radio.startTransmit(byteArr, 8); */ - - // we're ready to send more packets, - // enable interrupt service routine - enableInterrupt = true; } } diff --git a/examples/SX127x/SX127x_Channel_Activity_Detection_Interrupt/SX127x_Channel_Activity_Detection_Interrupt.ino b/examples/SX127x/SX127x_Channel_Activity_Detection_Interrupt/SX127x_Channel_Activity_Detection_Interrupt.ino index 1c41ed37..21ab7de5 100644 --- a/examples/SX127x/SX127x_Channel_Activity_Detection_Interrupt/SX127x_Channel_Activity_Detection_Interrupt.ino +++ b/examples/SX127x/SX127x_Channel_Activity_Detection_Interrupt/SX127x_Channel_Activity_Detection_Interrupt.ino @@ -70,9 +70,6 @@ volatile bool timeoutFlag = false; // flag to indicate that a preamble was detected volatile bool detectedFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // this function is called when no preamble // is detected within timeout period // IMPORTANT: this function MUST be 'void' type @@ -81,11 +78,6 @@ volatile bool enableInterrupt = true; ICACHE_RAM_ATTR #endif void setFlagTimeout(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we timed out, set the flag timeoutFlag = true; } @@ -98,11 +90,6 @@ void setFlagTimeout(void) { ICACHE_RAM_ATTR #endif void setFlagDetected(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we got a preamble, set the flag detectedFlag = true; } @@ -110,10 +97,6 @@ void setFlagDetected(void) { void loop() { // check if we need to restart channel activity detection if(detectedFlag || timeoutFlag) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // check if we got a preamble if(detectedFlag) { // LoRa preamble was detected @@ -138,10 +121,5 @@ void loop() { // reset flags timeoutFlag = false; detectedFlag = false; - - // enable interrupts again - enableInterrupt = true; - } - } diff --git a/examples/SX127x/SX127x_Channel_Activity_Detection_Receive/SX127x_Channel_Activity_Detection_Receive.ino b/examples/SX127x/SX127x_Channel_Activity_Detection_Receive/SX127x_Channel_Activity_Detection_Receive.ino index 4914aba4..6186227a 100644 --- a/examples/SX127x/SX127x_Channel_Activity_Detection_Receive/SX127x_Channel_Activity_Detection_Receive.ino +++ b/examples/SX127x/SX127x_Channel_Activity_Detection_Receive/SX127x_Channel_Activity_Detection_Receive.ino @@ -76,9 +76,6 @@ volatile bool timeoutFlag = false; // flag to indicate that a preamble was detected volatile bool detectedFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // flag to indicate if we are currently receiving bool receiving = false; @@ -90,11 +87,6 @@ bool receiving = false; ICACHE_RAM_ATTR #endif void setFlagTimeout(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we timed out, set the flag timeoutFlag = true; } @@ -107,11 +99,6 @@ void setFlagTimeout(void) { ICACHE_RAM_ATTR #endif void setFlagDetected(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we got a preamble, set the flag detectedFlag = true; } @@ -120,10 +107,6 @@ void loop() { // check if we need to restart channel activity detection if(detectedFlag || timeoutFlag) { int state = RADIOLIB_ERR_NONE; - - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; // check ongoing reception if(receiving) { @@ -217,10 +200,5 @@ void loop() { // reset flags timeoutFlag = false; detectedFlag = false; - - // enable interrupts again - enableInterrupt = true; - } - } diff --git a/examples/SX127x/SX127x_Receive_Interrupt/SX127x_Receive_Interrupt.ino b/examples/SX127x/SX127x_Receive_Interrupt/SX127x_Receive_Interrupt.ino index e3228970..6c0997bc 100644 --- a/examples/SX127x/SX127x_Receive_Interrupt/SX127x_Receive_Interrupt.ino +++ b/examples/SX127x/SX127x_Receive_Interrupt/SX127x_Receive_Interrupt.ino @@ -78,9 +78,6 @@ void setup() { // flag to indicate that a packet was received volatile bool receivedFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // this function is called when a complete packet // is received by the module // IMPORTANT: this function MUST be 'void' type @@ -89,11 +86,6 @@ volatile bool enableInterrupt = true; ICACHE_RAM_ATTR #endif void setFlag(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we got a packet, set the flag receivedFlag = true; } @@ -101,10 +93,6 @@ void setFlag(void) { void loop() { // check if the flag is set if(receivedFlag) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // reset flag receivedFlag = false; @@ -154,10 +142,5 @@ void loop() { // put module back to listen mode radio.startReceive(); - - // we're ready to receive more packets, - // enable interrupt service routine - enableInterrupt = true; } - } diff --git a/examples/SX127x/SX127x_Transmit_Interrupt/SX127x_Transmit_Interrupt.ino b/examples/SX127x/SX127x_Transmit_Interrupt/SX127x_Transmit_Interrupt.ino index ec3f03a3..97b6e319 100644 --- a/examples/SX127x/SX127x_Transmit_Interrupt/SX127x_Transmit_Interrupt.ino +++ b/examples/SX127x/SX127x_Transmit_Interrupt/SX127x_Transmit_Interrupt.ino @@ -70,9 +70,6 @@ void setup() { // flag to indicate that a packet was sent volatile bool transmittedFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // this function is called when a complete packet // is transmitted by the module // IMPORTANT: this function MUST be 'void' type @@ -81,11 +78,6 @@ volatile bool enableInterrupt = true; ICACHE_RAM_ATTR #endif void setFlag(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we sent a packet, set the flag transmittedFlag = true; } @@ -93,10 +85,6 @@ void setFlag(void) { void loop() { // check if the previous transmission finished if(transmittedFlag) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // reset flag transmittedFlag = false; @@ -135,9 +123,5 @@ void loop() { 0x89, 0xAB, 0xCD, 0xEF}; int state = radio.startTransmit(byteArr, 8); */ - - // we're ready to send more packets, - // enable interrupt service routine - enableInterrupt = true; } } diff --git a/examples/SX128x/SX128x_Receive_Interrupt/SX128x_Receive_Interrupt.ino b/examples/SX128x/SX128x_Receive_Interrupt/SX128x_Receive_Interrupt.ino index 77d452c6..211a9069 100644 --- a/examples/SX128x/SX128x_Receive_Interrupt/SX128x_Receive_Interrupt.ino +++ b/examples/SX128x/SX128x_Receive_Interrupt/SX128x_Receive_Interrupt.ino @@ -78,9 +78,6 @@ void setup() { // flag to indicate that a packet was received volatile bool receivedFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // this function is called when a complete packet // is received by the module // IMPORTANT: this function MUST be 'void' type @@ -89,11 +86,6 @@ volatile bool enableInterrupt = true; ICACHE_RAM_ATTR #endif void setFlag(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we got a packet, set the flag receivedFlag = true; } @@ -101,10 +93,6 @@ void setFlag(void) { void loop() { // check if the flag is set if(receivedFlag) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // reset flag receivedFlag = false; @@ -155,10 +143,5 @@ void loop() { // put module back to listen mode radio.startReceive(); - - // we're ready to receive more packets, - // enable interrupt service routine - enableInterrupt = true; } - } diff --git a/examples/SX128x/SX128x_Transmit_Interrupt/SX128x_Transmit_Interrupt.ino b/examples/SX128x/SX128x_Transmit_Interrupt/SX128x_Transmit_Interrupt.ino index e8d78941..17843970 100644 --- a/examples/SX128x/SX128x_Transmit_Interrupt/SX128x_Transmit_Interrupt.ino +++ b/examples/SX128x/SX128x_Transmit_Interrupt/SX128x_Transmit_Interrupt.ino @@ -70,9 +70,6 @@ void setup() { // flag to indicate that a packet was sent volatile bool transmittedFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // this function is called when a complete packet // is transmitted by the module // IMPORTANT: this function MUST be 'void' type @@ -81,11 +78,6 @@ volatile bool enableInterrupt = true; ICACHE_RAM_ATTR #endif void setFlag(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we sent a packet, set the flag transmittedFlag = true; } @@ -93,10 +85,6 @@ void setFlag(void) { void loop() { // check if the previous transmission finished if(transmittedFlag) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // reset flag transmittedFlag = false; @@ -131,9 +119,5 @@ void loop() { 0x89, 0xAB, 0xCD, 0xEF}; int state = radio.startTransmit(byteArr, 8); */ - - // we're ready to send more packets, - // enable interrupt service routine - enableInterrupt = true; } } diff --git a/examples/Si443x/Si443x_Receive_Interrupt/Si443x_Receive_Interrupt.ino b/examples/Si443x/Si443x_Receive_Interrupt/Si443x_Receive_Interrupt.ino index 061ee094..cb9c2d69 100644 --- a/examples/Si443x/Si443x_Receive_Interrupt/Si443x_Receive_Interrupt.ino +++ b/examples/Si443x/Si443x_Receive_Interrupt/Si443x_Receive_Interrupt.ino @@ -69,9 +69,6 @@ void setup() { // flag to indicate that a packet was received volatile bool receivedFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // this function is called when a complete packet // is received by the module // IMPORTANT: this function MUST be 'void' type @@ -80,11 +77,6 @@ volatile bool enableInterrupt = true; ICACHE_RAM_ATTR #endif void setFlag(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we got a packet, set the flag receivedFlag = true; } @@ -92,10 +84,6 @@ void setFlag(void) { void loop() { // check if the flag is set if(receivedFlag) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // reset flag receivedFlag = false; @@ -130,10 +118,5 @@ void loop() { // put module back to listen mode radio.startReceive(); - - // we're ready to receive more packets, - // enable interrupt service routine - enableInterrupt = true; } - } diff --git a/examples/Si443x/Si443x_Transmit_Interrupt/Si443x_Transmit_Interrupt.ino b/examples/Si443x/Si443x_Transmit_Interrupt/Si443x_Transmit_Interrupt.ino index 317932fc..d2edc6c8 100644 --- a/examples/Si443x/Si443x_Transmit_Interrupt/Si443x_Transmit_Interrupt.ino +++ b/examples/Si443x/Si443x_Transmit_Interrupt/Si443x_Transmit_Interrupt.ino @@ -68,9 +68,6 @@ void setup() { // flag to indicate that a packet was sent volatile bool transmittedFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // this function is called when a complete packet // is transmitted by the module // IMPORTANT: this function MUST be 'void' type @@ -79,11 +76,6 @@ volatile bool enableInterrupt = true; ICACHE_RAM_ATTR #endif void setFlag(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we sent a packet, set the flag transmittedFlag = true; } @@ -91,10 +83,6 @@ void setFlag(void) { void loop() { // check if the previous transmission finished if(transmittedFlag) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // reset flag transmittedFlag = false; @@ -129,9 +117,5 @@ void loop() { 0x89, 0xAB, 0xCD, 0xEF}; int state = radio.startTransmit(byteArr, 8); */ - - // we're ready to send more packets, - // enable interrupt service routine - enableInterrupt = true; } } diff --git a/examples/nRF24/nRF24_Receive_Interrupt/nRF24_Receive_Interrupt.ino b/examples/nRF24/nRF24_Receive_Interrupt/nRF24_Receive_Interrupt.ino index 9e73394a..ccca2798 100644 --- a/examples/nRF24/nRF24_Receive_Interrupt/nRF24_Receive_Interrupt.ino +++ b/examples/nRF24/nRF24_Receive_Interrupt/nRF24_Receive_Interrupt.ino @@ -87,9 +87,6 @@ void setup() { // flag to indicate that a packet was received volatile bool receivedFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // this function is called when a complete packet // is received by the module // IMPORTANT: this function MUST be 'void' type @@ -98,11 +95,6 @@ volatile bool enableInterrupt = true; ICACHE_RAM_ATTR #endif void setFlag(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we got a packet, set the flag receivedFlag = true; } @@ -110,10 +102,6 @@ void setFlag(void) { void loop() { // check if the flag is set if(receivedFlag) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // reset flag receivedFlag = false; @@ -144,10 +132,5 @@ void loop() { // put module back to listen mode radio.startReceive(); - - // we're ready to receive more packets, - // enable interrupt service routine - enableInterrupt = true; } - } diff --git a/examples/nRF24/nRF24_Transmit_Interrupt/nRF24_Transmit_Interrupt.ino b/examples/nRF24/nRF24_Transmit_Interrupt/nRF24_Transmit_Interrupt.ino index 95cba472..cdcbf997 100644 --- a/examples/nRF24/nRF24_Transmit_Interrupt/nRF24_Transmit_Interrupt.ino +++ b/examples/nRF24/nRF24_Transmit_Interrupt/nRF24_Transmit_Interrupt.ino @@ -83,9 +83,6 @@ void setup() { // flag to indicate that a packet was sent volatile bool transmittedFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // this function is called when a complete packet // is transmitted by the module // IMPORTANT: this function MUST be 'void' type @@ -94,11 +91,6 @@ volatile bool enableInterrupt = true; ICACHE_RAM_ATTR #endif void setFlag(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we sent a packet, set the flag transmittedFlag = true; } @@ -106,10 +98,6 @@ void setFlag(void) { void loop() { // check if the previous transmission finished if(transmittedFlag) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // reset flag transmittedFlag = false; @@ -148,9 +136,5 @@ void loop() { 0x89, 0xAB, 0xCD, 0xEF}; int state = radio.startTransmit(byteArr, 8); */ - - // we're ready to send more packets, - // enable interrupt service routine - enableInterrupt = true; } }