kopia lustrzana https://github.com/jgromes/RadioLib
[nRF24] Fixed order of ISR functions in examples
rodzic
2dd69398e3
commit
f95de45be7
|
@ -34,6 +34,21 @@ nRF24 radio = new Module(10, 2, 3);
|
||||||
Radio radio = new RadioModule();
|
Radio radio = new RadioModule();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
@ -88,21 +103,6 @@ void setup() {
|
||||||
// radio.readData();
|
// radio.readData();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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) {
|
||||||
|
|
|
@ -36,6 +36,21 @@ Radio radio = new RadioModule();
|
||||||
// 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);
|
||||||
|
|
||||||
|
@ -84,21 +99,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;
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue