Removed unnecessary interrupt enable (#657)
This commit is contained in:
parent
0cd9dd2983
commit
6666060d52
18 changed files with 1 additions and 307 deletions
|
@ -75,9 +75,6 @@ void setup() {
|
||||||
// flag to indicate that a packet was received
|
// flag to indicate that a packet was received
|
||||||
volatile bool receivedFlag = false;
|
volatile bool receivedFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
// this function is called when a complete packet
|
||||||
// is received by the module
|
// is received by the module
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
@ -86,11 +83,6 @@ volatile bool enableInterrupt = true;
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlag(void) {
|
void setFlag(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we got a packet, set the flag
|
// we got a packet, set the flag
|
||||||
receivedFlag = true;
|
receivedFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -98,10 +90,6 @@ void setFlag(void) {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(receivedFlag) {
|
if(receivedFlag) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// reset flag
|
// reset flag
|
||||||
receivedFlag = false;
|
receivedFlag = false;
|
||||||
|
|
||||||
|
@ -147,10 +135,6 @@ void loop() {
|
||||||
|
|
||||||
// put module back to listen mode
|
// put module back to listen mode
|
||||||
radio.startReceive();
|
radio.startReceive();
|
||||||
|
|
||||||
// we're ready to receive more packets,
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,9 +71,6 @@ void setup() {
|
||||||
// flag to indicate that a packet was sent
|
// flag to indicate that a packet was sent
|
||||||
volatile bool transmittedFlag = false;
|
volatile bool transmittedFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
// this function is called when a complete packet
|
||||||
// is transmitted by the module
|
// is transmitted by the module
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
@ -82,11 +79,6 @@ volatile bool enableInterrupt = true;
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlag(void) {
|
void setFlag(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we sent a packet, set the flag
|
// we sent a packet, set the flag
|
||||||
transmittedFlag = true;
|
transmittedFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -94,10 +86,6 @@ void setFlag(void) {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the previous transmission finished
|
// check if the previous transmission finished
|
||||||
if(transmittedFlag) {
|
if(transmittedFlag) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// reset flag
|
// reset flag
|
||||||
transmittedFlag = false;
|
transmittedFlag = false;
|
||||||
|
|
||||||
|
@ -136,9 +124,5 @@ void loop() {
|
||||||
0x89, 0xAB, 0xCD, 0xEF};
|
0x89, 0xAB, 0xCD, 0xEF};
|
||||||
int state = radio.startTransmit(byteArr, 8);
|
int state = radio.startTransmit(byteArr, 8);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// we're ready to send more packets,
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,9 +67,6 @@ void setup() {
|
||||||
// flag to indicate that a packet was received
|
// flag to indicate that a packet was received
|
||||||
volatile bool receivedFlag = false;
|
volatile bool receivedFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
// this function is called when a complete packet
|
||||||
// is received by the module
|
// is received by the module
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
@ -78,11 +75,6 @@ volatile bool enableInterrupt = true;
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlag(void) {
|
void setFlag(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we got a packet, set the flag
|
// we got a packet, set the flag
|
||||||
receivedFlag = true;
|
receivedFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -90,10 +82,6 @@ void setFlag(void) {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(receivedFlag) {
|
if(receivedFlag) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// reset flag
|
// reset flag
|
||||||
receivedFlag = false;
|
receivedFlag = false;
|
||||||
|
|
||||||
|
@ -134,10 +122,5 @@ void loop() {
|
||||||
|
|
||||||
// put module back to listen mode
|
// put module back to listen mode
|
||||||
radio.startReceive();
|
radio.startReceive();
|
||||||
|
|
||||||
// we're ready to receive more packets,
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,9 +84,6 @@ void setup() {
|
||||||
// flag to indicate that a packet was sent
|
// flag to indicate that a packet was sent
|
||||||
volatile bool transmittedFlag = false;
|
volatile bool transmittedFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
// this function is called when a complete packet
|
||||||
// is transmitted by the module
|
// is transmitted by the module
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
@ -95,11 +92,6 @@ volatile bool enableInterrupt = true;
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlag(void) {
|
void setFlag(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we sent a packet, set the flag
|
// we sent a packet, set the flag
|
||||||
transmittedFlag = true;
|
transmittedFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -107,10 +99,6 @@ void setFlag(void) {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the previous transmission finished
|
// check if the previous transmission finished
|
||||||
if(transmittedFlag) {
|
if(transmittedFlag) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// reset flag
|
// reset flag
|
||||||
transmittedFlag = false;
|
transmittedFlag = false;
|
||||||
|
|
||||||
|
@ -149,9 +137,5 @@ void loop() {
|
||||||
0x89, 0xAB, 0xCD, 0xEF};
|
0x89, 0xAB, 0xCD, 0xEF};
|
||||||
int state = radio.startTransmit(byteArr, 8);
|
int state = radio.startTransmit(byteArr, 8);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// we're ready to send more packets,
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,9 +64,6 @@ void setup() {
|
||||||
// flag to indicate that a packet was detected or CAD timed out
|
// flag to indicate that a packet was detected or CAD timed out
|
||||||
volatile bool scanFlag = false;
|
volatile bool scanFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
// this function is called when a complete packet
|
||||||
// is received by the module
|
// is received by the module
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
@ -75,11 +72,6 @@ volatile bool enableInterrupt = true;
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlag(void) {
|
void setFlag(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// something happened, set the flag
|
// something happened, set the flag
|
||||||
scanFlag = true;
|
scanFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -87,10 +79,6 @@ void setFlag(void) {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(scanFlag) {
|
if(scanFlag) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// reset flag
|
// reset flag
|
||||||
scanFlag = false;
|
scanFlag = false;
|
||||||
|
|
||||||
|
@ -121,9 +109,5 @@ void loop() {
|
||||||
Serial.print(F("failed, code "));
|
Serial.print(F("failed, code "));
|
||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,6 @@ int transmissionState = RADIOLIB_ERR_NONE;
|
||||||
// flag to indicate transmission or reception state
|
// flag to indicate transmission or reception state
|
||||||
bool transmitFlag = false;
|
bool transmitFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// flag to indicate that a packet was sent or received
|
// flag to indicate that a packet was sent or received
|
||||||
volatile bool operationDone = false;
|
volatile bool operationDone = false;
|
||||||
|
|
||||||
|
@ -46,11 +43,6 @@ volatile bool operationDone = false;
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
// and MUST NOT have any arguments!
|
// and MUST NOT have any arguments!
|
||||||
void setFlag(void) {
|
void setFlag(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we sent or received a packet, set the flag
|
// we sent or received a packet, set the flag
|
||||||
operationDone = true;
|
operationDone = true;
|
||||||
}
|
}
|
||||||
|
@ -95,10 +87,6 @@ void setup() {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the previous operation finished
|
// check if the previous operation finished
|
||||||
if(operationDone) {
|
if(operationDone) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// reset flag
|
// reset flag
|
||||||
operationDone = false;
|
operationDone = false;
|
||||||
|
|
||||||
|
@ -154,9 +142,5 @@ void loop() {
|
||||||
transmitFlag = true;
|
transmitFlag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we're ready to process more packets,
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,9 +81,6 @@ void setup() {
|
||||||
// flag to indicate that a packet was received
|
// flag to indicate that a packet was received
|
||||||
volatile bool receivedFlag = false;
|
volatile bool receivedFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
// this function is called when a complete packet
|
||||||
// is received by the module
|
// is received by the module
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
@ -92,11 +89,6 @@ volatile bool enableInterrupt = true;
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlag(void) {
|
void setFlag(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we got a packet, set the flag
|
// we got a packet, set the flag
|
||||||
receivedFlag = true;
|
receivedFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -104,10 +96,6 @@ void setFlag(void) {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(receivedFlag) {
|
if(receivedFlag) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// reset flag
|
// reset flag
|
||||||
receivedFlag = false;
|
receivedFlag = false;
|
||||||
|
|
||||||
|
@ -152,10 +140,5 @@ void loop() {
|
||||||
|
|
||||||
// put module back to listen mode
|
// put module back to listen mode
|
||||||
radio.startReceive();
|
radio.startReceive();
|
||||||
|
|
||||||
// we're ready to receive more packets,
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,9 +73,6 @@ void setup() {
|
||||||
// flag to indicate that a packet was sent
|
// flag to indicate that a packet was sent
|
||||||
volatile bool transmittedFlag = false;
|
volatile bool transmittedFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
// this function is called when a complete packet
|
||||||
// is transmitted by the module
|
// is transmitted by the module
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
@ -84,11 +81,6 @@ volatile bool enableInterrupt = true;
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlag(void) {
|
void setFlag(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we sent a packet, set the flag
|
// we sent a packet, set the flag
|
||||||
transmittedFlag = true;
|
transmittedFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -96,10 +88,6 @@ void setFlag(void) {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the previous transmission finished
|
// check if the previous transmission finished
|
||||||
if(transmittedFlag) {
|
if(transmittedFlag) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// reset flag
|
// reset flag
|
||||||
transmittedFlag = false;
|
transmittedFlag = false;
|
||||||
|
|
||||||
|
@ -138,9 +126,5 @@ void loop() {
|
||||||
0x89, 0xAB, 0xCD, 0xEF};
|
0x89, 0xAB, 0xCD, 0xEF};
|
||||||
int state = radio.startTransmit(byteArr, 8);
|
int state = radio.startTransmit(byteArr, 8);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// we're ready to send more packets,
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,9 +70,6 @@ volatile bool timeoutFlag = false;
|
||||||
// flag to indicate that a preamble was detected
|
// flag to indicate that a preamble was detected
|
||||||
volatile bool detectedFlag = false;
|
volatile bool detectedFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// this function is called when no preamble
|
// this function is called when no preamble
|
||||||
// is detected within timeout period
|
// is detected within timeout period
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
@ -81,11 +78,6 @@ volatile bool enableInterrupt = true;
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlagTimeout(void) {
|
void setFlagTimeout(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we timed out, set the flag
|
// we timed out, set the flag
|
||||||
timeoutFlag = true;
|
timeoutFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -98,11 +90,6 @@ void setFlagTimeout(void) {
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlagDetected(void) {
|
void setFlagDetected(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we got a preamble, set the flag
|
// we got a preamble, set the flag
|
||||||
detectedFlag = true;
|
detectedFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -110,10 +97,6 @@ void setFlagDetected(void) {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if we need to restart channel activity detection
|
// check if we need to restart channel activity detection
|
||||||
if(detectedFlag || timeoutFlag) {
|
if(detectedFlag || timeoutFlag) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// check if we got a preamble
|
// check if we got a preamble
|
||||||
if(detectedFlag) {
|
if(detectedFlag) {
|
||||||
// LoRa preamble was detected
|
// LoRa preamble was detected
|
||||||
|
@ -138,10 +121,5 @@ void loop() {
|
||||||
// reset flags
|
// reset flags
|
||||||
timeoutFlag = false;
|
timeoutFlag = false;
|
||||||
detectedFlag = false;
|
detectedFlag = false;
|
||||||
|
|
||||||
// enable interrupts again
|
|
||||||
enableInterrupt = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,9 +76,6 @@ volatile bool timeoutFlag = false;
|
||||||
// flag to indicate that a preamble was detected
|
// flag to indicate that a preamble was detected
|
||||||
volatile bool detectedFlag = false;
|
volatile bool detectedFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// flag to indicate if we are currently receiving
|
// flag to indicate if we are currently receiving
|
||||||
bool receiving = false;
|
bool receiving = false;
|
||||||
|
|
||||||
|
@ -90,11 +87,6 @@ bool receiving = false;
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlagTimeout(void) {
|
void setFlagTimeout(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we timed out, set the flag
|
// we timed out, set the flag
|
||||||
timeoutFlag = true;
|
timeoutFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -107,11 +99,6 @@ void setFlagTimeout(void) {
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlagDetected(void) {
|
void setFlagDetected(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we got a preamble, set the flag
|
// we got a preamble, set the flag
|
||||||
detectedFlag = true;
|
detectedFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -121,10 +108,6 @@ void loop() {
|
||||||
if(detectedFlag || timeoutFlag) {
|
if(detectedFlag || timeoutFlag) {
|
||||||
int state = RADIOLIB_ERR_NONE;
|
int state = RADIOLIB_ERR_NONE;
|
||||||
|
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// check ongoing reception
|
// check ongoing reception
|
||||||
if(receiving) {
|
if(receiving) {
|
||||||
// DIO triggered while reception is ongoing
|
// DIO triggered while reception is ongoing
|
||||||
|
@ -217,10 +200,5 @@ void loop() {
|
||||||
// reset flags
|
// reset flags
|
||||||
timeoutFlag = false;
|
timeoutFlag = false;
|
||||||
detectedFlag = false;
|
detectedFlag = false;
|
||||||
|
|
||||||
// enable interrupts again
|
|
||||||
enableInterrupt = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,9 +78,6 @@ void setup() {
|
||||||
// flag to indicate that a packet was received
|
// flag to indicate that a packet was received
|
||||||
volatile bool receivedFlag = false;
|
volatile bool receivedFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
// this function is called when a complete packet
|
||||||
// is received by the module
|
// is received by the module
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
@ -89,11 +86,6 @@ volatile bool enableInterrupt = true;
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlag(void) {
|
void setFlag(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we got a packet, set the flag
|
// we got a packet, set the flag
|
||||||
receivedFlag = true;
|
receivedFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -101,10 +93,6 @@ void setFlag(void) {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(receivedFlag) {
|
if(receivedFlag) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// reset flag
|
// reset flag
|
||||||
receivedFlag = false;
|
receivedFlag = false;
|
||||||
|
|
||||||
|
@ -154,10 +142,5 @@ void loop() {
|
||||||
|
|
||||||
// put module back to listen mode
|
// put module back to listen mode
|
||||||
radio.startReceive();
|
radio.startReceive();
|
||||||
|
|
||||||
// we're ready to receive more packets,
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,9 +70,6 @@ void setup() {
|
||||||
// flag to indicate that a packet was sent
|
// flag to indicate that a packet was sent
|
||||||
volatile bool transmittedFlag = false;
|
volatile bool transmittedFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
// this function is called when a complete packet
|
||||||
// is transmitted by the module
|
// is transmitted by the module
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
@ -81,11 +78,6 @@ volatile bool enableInterrupt = true;
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlag(void) {
|
void setFlag(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we sent a packet, set the flag
|
// we sent a packet, set the flag
|
||||||
transmittedFlag = true;
|
transmittedFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -93,10 +85,6 @@ void setFlag(void) {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the previous transmission finished
|
// check if the previous transmission finished
|
||||||
if(transmittedFlag) {
|
if(transmittedFlag) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// reset flag
|
// reset flag
|
||||||
transmittedFlag = false;
|
transmittedFlag = false;
|
||||||
|
|
||||||
|
@ -135,9 +123,5 @@ void loop() {
|
||||||
0x89, 0xAB, 0xCD, 0xEF};
|
0x89, 0xAB, 0xCD, 0xEF};
|
||||||
int state = radio.startTransmit(byteArr, 8);
|
int state = radio.startTransmit(byteArr, 8);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// we're ready to send more packets,
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,9 +78,6 @@ void setup() {
|
||||||
// flag to indicate that a packet was received
|
// flag to indicate that a packet was received
|
||||||
volatile bool receivedFlag = false;
|
volatile bool receivedFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
// this function is called when a complete packet
|
||||||
// is received by the module
|
// is received by the module
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
@ -89,11 +86,6 @@ volatile bool enableInterrupt = true;
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlag(void) {
|
void setFlag(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we got a packet, set the flag
|
// we got a packet, set the flag
|
||||||
receivedFlag = true;
|
receivedFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -101,10 +93,6 @@ void setFlag(void) {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(receivedFlag) {
|
if(receivedFlag) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// reset flag
|
// reset flag
|
||||||
receivedFlag = false;
|
receivedFlag = false;
|
||||||
|
|
||||||
|
@ -155,10 +143,5 @@ void loop() {
|
||||||
|
|
||||||
// put module back to listen mode
|
// put module back to listen mode
|
||||||
radio.startReceive();
|
radio.startReceive();
|
||||||
|
|
||||||
// we're ready to receive more packets,
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,9 +70,6 @@ void setup() {
|
||||||
// flag to indicate that a packet was sent
|
// flag to indicate that a packet was sent
|
||||||
volatile bool transmittedFlag = false;
|
volatile bool transmittedFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
// this function is called when a complete packet
|
||||||
// is transmitted by the module
|
// is transmitted by the module
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
@ -81,11 +78,6 @@ volatile bool enableInterrupt = true;
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlag(void) {
|
void setFlag(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we sent a packet, set the flag
|
// we sent a packet, set the flag
|
||||||
transmittedFlag = true;
|
transmittedFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -93,10 +85,6 @@ void setFlag(void) {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the previous transmission finished
|
// check if the previous transmission finished
|
||||||
if(transmittedFlag) {
|
if(transmittedFlag) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// reset flag
|
// reset flag
|
||||||
transmittedFlag = false;
|
transmittedFlag = false;
|
||||||
|
|
||||||
|
@ -131,9 +119,5 @@ void loop() {
|
||||||
0x89, 0xAB, 0xCD, 0xEF};
|
0x89, 0xAB, 0xCD, 0xEF};
|
||||||
int state = radio.startTransmit(byteArr, 8);
|
int state = radio.startTransmit(byteArr, 8);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// we're ready to send more packets,
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,9 +69,6 @@ void setup() {
|
||||||
// flag to indicate that a packet was received
|
// flag to indicate that a packet was received
|
||||||
volatile bool receivedFlag = false;
|
volatile bool receivedFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
// this function is called when a complete packet
|
||||||
// is received by the module
|
// is received by the module
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
@ -80,11 +77,6 @@ volatile bool enableInterrupt = true;
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlag(void) {
|
void setFlag(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we got a packet, set the flag
|
// we got a packet, set the flag
|
||||||
receivedFlag = true;
|
receivedFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -92,10 +84,6 @@ void setFlag(void) {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(receivedFlag) {
|
if(receivedFlag) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// reset flag
|
// reset flag
|
||||||
receivedFlag = false;
|
receivedFlag = false;
|
||||||
|
|
||||||
|
@ -130,10 +118,5 @@ void loop() {
|
||||||
|
|
||||||
// put module back to listen mode
|
// put module back to listen mode
|
||||||
radio.startReceive();
|
radio.startReceive();
|
||||||
|
|
||||||
// we're ready to receive more packets,
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,9 +68,6 @@ void setup() {
|
||||||
// flag to indicate that a packet was sent
|
// flag to indicate that a packet was sent
|
||||||
volatile bool transmittedFlag = false;
|
volatile bool transmittedFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
// this function is called when a complete packet
|
||||||
// is transmitted by the module
|
// is transmitted by the module
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
@ -79,11 +76,6 @@ volatile bool enableInterrupt = true;
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlag(void) {
|
void setFlag(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we sent a packet, set the flag
|
// we sent a packet, set the flag
|
||||||
transmittedFlag = true;
|
transmittedFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -91,10 +83,6 @@ void setFlag(void) {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the previous transmission finished
|
// check if the previous transmission finished
|
||||||
if(transmittedFlag) {
|
if(transmittedFlag) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// reset flag
|
// reset flag
|
||||||
transmittedFlag = false;
|
transmittedFlag = false;
|
||||||
|
|
||||||
|
@ -129,9 +117,5 @@ void loop() {
|
||||||
0x89, 0xAB, 0xCD, 0xEF};
|
0x89, 0xAB, 0xCD, 0xEF};
|
||||||
int state = radio.startTransmit(byteArr, 8);
|
int state = radio.startTransmit(byteArr, 8);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// we're ready to send more packets,
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,9 +87,6 @@ void setup() {
|
||||||
// flag to indicate that a packet was received
|
// flag to indicate that a packet was received
|
||||||
volatile bool receivedFlag = false;
|
volatile bool receivedFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
// this function is called when a complete packet
|
||||||
// is received by the module
|
// is received by the module
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
@ -98,11 +95,6 @@ volatile bool enableInterrupt = true;
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlag(void) {
|
void setFlag(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we got a packet, set the flag
|
// we got a packet, set the flag
|
||||||
receivedFlag = true;
|
receivedFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -110,10 +102,6 @@ void setFlag(void) {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(receivedFlag) {
|
if(receivedFlag) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// reset flag
|
// reset flag
|
||||||
receivedFlag = false;
|
receivedFlag = false;
|
||||||
|
|
||||||
|
@ -144,10 +132,5 @@ void loop() {
|
||||||
|
|
||||||
// put module back to listen mode
|
// put module back to listen mode
|
||||||
radio.startReceive();
|
radio.startReceive();
|
||||||
|
|
||||||
// we're ready to receive more packets,
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,9 +83,6 @@ void setup() {
|
||||||
// flag to indicate that a packet was sent
|
// flag to indicate that a packet was sent
|
||||||
volatile bool transmittedFlag = false;
|
volatile bool transmittedFlag = false;
|
||||||
|
|
||||||
// disable interrupt when it's not needed
|
|
||||||
volatile bool enableInterrupt = true;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
// this function is called when a complete packet
|
||||||
// is transmitted by the module
|
// is transmitted by the module
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
@ -94,11 +91,6 @@ volatile bool enableInterrupt = true;
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
void setFlag(void) {
|
void setFlag(void) {
|
||||||
// check if the interrupt is enabled
|
|
||||||
if(!enableInterrupt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we sent a packet, set the flag
|
// we sent a packet, set the flag
|
||||||
transmittedFlag = true;
|
transmittedFlag = true;
|
||||||
}
|
}
|
||||||
|
@ -106,10 +98,6 @@ void setFlag(void) {
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the previous transmission finished
|
// check if the previous transmission finished
|
||||||
if(transmittedFlag) {
|
if(transmittedFlag) {
|
||||||
// disable the interrupt service routine while
|
|
||||||
// processing the data
|
|
||||||
enableInterrupt = false;
|
|
||||||
|
|
||||||
// reset flag
|
// reset flag
|
||||||
transmittedFlag = false;
|
transmittedFlag = false;
|
||||||
|
|
||||||
|
@ -148,9 +136,5 @@ void loop() {
|
||||||
0x89, 0xAB, 0xCD, 0xEF};
|
0x89, 0xAB, 0xCD, 0xEF};
|
||||||
int state = radio.startTransmit(byteArr, 8);
|
int state = radio.startTransmit(byteArr, 8);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// we're ready to send more packets,
|
|
||||||
// enable interrupt service routine
|
|
||||||
enableInterrupt = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue