@@ -49,9 +49,6 @@ uint8_t pl_iterator = 0;
49
49
char tx_payloads[][tx_pl_size + 1 ] = { " Ping " , " Pong " , " Radio" , " 1FAIL" };
50
50
char ack_payloads[][ack_pl_size + 1 ] = { " Yak " , " Back" , " ACK" };
51
51
52
- // A variable to interpret and manipulate the radio's IRQ pin.
53
- StatusFlags flags;
54
-
55
52
void interruptHandler (); // prototype to handle IRQ events
56
53
void printRxFifo (); // prototype to print RX FIFO with 1 buffer
57
54
@@ -122,8 +119,7 @@ void setup() {
122
119
// setup for RX mode
123
120
124
121
// let IRQ pin only trigger on "data_ready" event in RX mode
125
- flags = StatusFlags (RF24_RX_DR);
126
- radio.setStatusFlags (flags);
122
+ radio.setStatusFlags (RF24_RX_DR);
127
123
128
124
// Fill the TX FIFO with 3 ACK payloads for the first 3 received
129
125
// transmissions on pipe 1
@@ -154,25 +150,22 @@ void loop() {
154
150
// Test the "data ready" event with the IRQ pin
155
151
156
152
Serial.println (F (" \n Configuring IRQ pin to ignore the 'data sent' event" ));
157
- flags = StatusFlags (RF24_RX_DR | RF24_TX_DF);
158
- radio.setStatusFlags (flags);
153
+ radio.setStatusFlags (RF24_RX_DR | RF24_TX_DF);
159
154
Serial.println (F (" Pinging RX node for 'data ready' event..." ));
160
155
161
156
} else if (pl_iterator == 1 ) {
162
157
// Test the "data sent" event with the IRQ pin
163
158
164
159
Serial.println (F (" \n Configuring IRQ pin to ignore the 'data ready' event" ));
165
- flags = StatusFlags (RF24_TX_DS | RF24_TX_DF);
166
- radio.setStatusFlags (flags);
160
+ radio.setStatusFlags (RF24_TX_DS | RF24_TX_DF);
167
161
Serial.println (F (" Pinging RX node for 'data sent' event..." ));
168
162
169
163
} else if (pl_iterator == 2 ) {
170
164
// Use this iteration to fill the RX node's FIFO which sets us up for the next test.
171
165
172
166
// write() uses virtual interrupt flags that work despite the masking of the IRQ pin
173
167
// disable IRQ pin for this step
174
- flags = StatusFlags ();
175
- radio.setStatusFlags (flags);
168
+ radio.setStatusFlags ();
176
169
177
170
Serial.println (F (" \n Sending 1 payload to fill RX node's FIFO. IRQ pin is neglected." ));
178
171
// write() will call flush_tx() on 'data fail' events
@@ -191,8 +184,7 @@ void loop() {
191
184
// test the "data fail" event with the IRQ pin
192
185
193
186
Serial.println (F (" \n Configuring IRQ pin to reflect all events" ));
194
- flags = StatusFlags (RF24_IRQ_ALL);
195
- radio.setStatusFlags (flags);
187
+ radio.setStatusFlags (RF24_IRQ_ALL);
196
188
Serial.println (F (" Pinging inactive RX node for 'data fail' event..." ));
197
189
}
198
190
@@ -276,8 +268,7 @@ void loop() {
276
268
role = false ;
277
269
278
270
// let IRQ pin only trigger on "data_ready" event in RX mode
279
- flags = StatusFlags (RF24_RX_DR);
280
- radio.setStatusFlags (flags);
271
+ radio.setStatusFlags (RF24_RX_DR);
281
272
282
273
// Fill the TX FIFO with 3 ACK payloads for the first 3 received
283
274
// transmissions on pipe 1
@@ -309,7 +300,7 @@ void assessInterruptEvent() {
309
300
310
301
Serial.println (F (" \t IRQ pin is actively LOW" )); // show that this function was called
311
302
delayMicroseconds (250 );
312
- flags = radio.clearStatusFlags ();
303
+ StatusFlags flags ( radio.clearStatusFlags () );
313
304
// Resetting the tx_df flag is required for
314
305
// continued TX operations when a transmission fails.
315
306
// clearing the status flags resets the IRQ pin to its inactive state (HIGH)
0 commit comments