[LR11x0] Fixed order of ISR functions in examples
This commit is contained in:
parent
b33647adc3
commit
2dd69398e3
4 changed files with 59 additions and 59 deletions
|
@ -57,6 +57,21 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
END_OF_MODE_TABLE,
|
END_OF_MODE_TABLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// flag to indicate that a packet was detected or CAD timed out
|
||||||
|
volatile bool scanFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a complete packet
|
||||||
|
// is received by the module
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlag(void) {
|
||||||
|
// something happened, set the flag
|
||||||
|
scanFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
@ -89,21 +104,6 @@ void setup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a packet was detected or CAD timed out
|
|
||||||
volatile bool scanFlag = false;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
|
||||||
// is received by the module
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlag(void) {
|
|
||||||
// something happened, set the flag
|
|
||||||
scanFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(scanFlag) {
|
if(scanFlag) {
|
||||||
|
|
|
@ -63,6 +63,21 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
END_OF_MODE_TABLE,
|
END_OF_MODE_TABLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// flag to indicate that a packet was received
|
||||||
|
volatile bool receivedFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a complete packet
|
||||||
|
// is received by the module
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlag(void) {
|
||||||
|
// we got a packet, set the flag
|
||||||
|
receivedFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
@ -105,21 +120,6 @@ void setup() {
|
||||||
// radio.scanChannel();
|
// radio.scanChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a packet was received
|
|
||||||
volatile bool receivedFlag = false;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
|
||||||
// is received by the module
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlag(void) {
|
|
||||||
// we got a packet, set the flag
|
|
||||||
receivedFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(receivedFlag) {
|
if(receivedFlag) {
|
||||||
|
|
|
@ -62,6 +62,21 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
// save transmission state between loops
|
// save transmission state between loops
|
||||||
int transmissionState = RADIOLIB_ERR_NONE;
|
int transmissionState = RADIOLIB_ERR_NONE;
|
||||||
|
|
||||||
|
// flag to indicate that a packet was sent
|
||||||
|
volatile bool transmittedFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a complete packet
|
||||||
|
// is transmitted by the module
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlag(void) {
|
||||||
|
// we sent a packet, set the flag
|
||||||
|
transmittedFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
@ -98,21 +113,6 @@ void setup() {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a packet was sent
|
|
||||||
volatile bool transmittedFlag = false;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
|
||||||
// is transmitted by the module
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlag(void) {
|
|
||||||
// we sent a packet, set the flag
|
|
||||||
transmittedFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// counter to keep track of transmitted packets
|
// counter to keep track of transmitted packets
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,20 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
END_OF_MODE_TABLE,
|
END_OF_MODE_TABLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// flag to indicate that a scan was completed
|
||||||
|
volatile bool scanFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a scan is completed
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlag(void) {
|
||||||
|
// scan is complete, set the flag
|
||||||
|
scanFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
@ -92,20 +106,6 @@ void setup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a scan was completed
|
|
||||||
volatile bool scanFlag = false;
|
|
||||||
|
|
||||||
// this function is called when a scan is completed
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlag(void) {
|
|
||||||
// scan is complete, set the flag
|
|
||||||
scanFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(scanFlag) {
|
if(scanFlag) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue