@@ -402,13 +402,13 @@ class RF24
402
402
* that received the next available payload. According to the datasheet,
403
403
* the data about the pipe number that received the next available payload
404
404
* is "unreliable" during a FALLING transition on the IRQ pin. This means
405
- * you should call whatHappened () before calling this function
405
+ * you should call clearStatusFlags () before calling this function
406
406
* during an ISR (Interrupt Service Routine). For example:
407
407
* @code
408
408
* void isrCallbackFunction() {
409
409
* bool tx_ds, tx_df, rx_dr;
410
- * radio.whatHappened(tx_ds, tx_df, rx_dr ); // resets the IRQ pin to HIGH
411
- * radio.available(); // returned data should now be reliable
410
+ * uint8_t flags = radio.clearStatusFlags( ); // resets the IRQ pin to HIGH
411
+ * radio.available(); // returned data should now be reliable
412
412
* }
413
413
*
414
414
* void setup() {
@@ -823,14 +823,13 @@ class RF24
823
823
*
824
824
* @warning According to the datasheet, the data saved to `pipe_num` is
825
825
* "unreliable" during a FALLING transition on the IRQ pin. This means you
826
- * should call whatHappened () before calling this function during
826
+ * should call clearStatusFlags () before calling this function during
827
827
* an ISR (Interrupt Service Routine). For example:
828
828
* @code
829
829
* void isrCallbackFunction() {
830
- * bool tx_ds, tx_df, rx_dr;
831
- * radio.whatHappened(tx_ds, tx_df, rx_dr); // resets the IRQ pin to HIGH
832
- * uint8_t pipe; // initialize pipe data
833
- * radio.available(&pipe); // pipe data should now be reliable
830
+ * radio.clearStatusFlags(); // resets the IRQ pin to inactive HIGH
831
+ * uint8_t pipe = 7; // initialize pipe data
832
+ * radio.available(&pipe); // pipe data should now be reliable
834
833
* }
835
834
*
836
835
* void setup() {
@@ -1181,51 +1180,22 @@ class RF24
1181
1180
bool writeAckPayload (uint8_t pipe, const void * buf, uint8_t len);
1182
1181
1183
1182
/* *
1184
- * Call this when you get an Interrupt Request (IRQ) to find out why
1185
- *
1186
- * This function describes what event triggered the IRQ pin to go active
1187
- * LOW and clears the status of all events.
1188
- *
1189
- * @see maskIRQ()
1190
- *
1191
- * @param[out] tx_ok The transmission attempt completed (TX_DS). This does
1192
- * not imply that the transmitted data was received by another radio, rather
1193
- * this only reports if the attempt to send was completed. This will
1194
- * always be `true` when the auto-ack feature is disabled.
1195
- * @param[out] tx_fail The transmission failed to be acknowledged, meaning
1196
- * too many retries (MAX_RT) were made while expecting an ACK packet. This
1197
- * event is only triggered when auto-ack feature is enabled.
1198
- * @param[out] rx_ready There is a newly received payload (RX_DR) saved to
1199
- * RX FIFO buffers. Remember that the RX FIFO can only hold up to 3
1200
- * payloads. Once the RX FIFO is full, all further received transmissions
1201
- * are rejected until there is space to save new data in the RX FIFO
1202
- * buffers.
1203
- *
1204
- * @note This function expects no parameters in the python wrapper.
1205
- * Instead, this function returns a 3 item tuple describing the IRQ
1206
- * events' status. To use this function in the python wrapper:
1207
- * @code{.py}
1208
- * # let`radio` be the instantiated RF24 object
1209
- * tx_ds, tx_df, rx_dr = radio.whatHappened() # get IRQ status flags
1210
- * print("tx_ds: {}, tx_df: {}, rx_dr: {}".format(tx_ds, tx_df, rx_dr))
1211
- * @endcode
1212
- */
1213
- void whatHappened (bool & tx_ok, bool & tx_fail, bool & rx_ready);
1214
-
1215
- /* *
1216
- * Clear the StatusFlags that caused an interrupt event.
1183
+ * Clear the Status flags that caused an interrupt event.
1217
1184
*
1218
1185
* @remark This function is similar to `whatHappened()` because it also returns the
1219
- * StatusFlags that caused the interrupt event. However, this function returns
1220
- * a 1- byte struct (@ref StatusFlags) instead of bit-banging 3 1-byte booleans
1186
+ * Status flags that caused the interrupt event. However, this function returns
1187
+ * a STATUS byte instead of bit-banging into 3 1-byte booleans
1221
1188
* passed by reference.
1222
1189
*
1223
1190
* @note When used in an ISR (Interrupt Service routine), there is a chance that the
1224
1191
* returned bits 0b1110 (rx_pipe number) is inaccurate. See available(uint8_t*) (or the
1225
1192
* datasheet) for more detail.
1226
1193
*
1227
- * @param flags The IRQ flags to clear. Default value is all of them (@ref RF24_IRQ_ALL).
1228
- * Multiple flags can be cleared by OR-ing @ref rf24_irq_flags_e values together.
1194
+ * @param flags The IRQ flags to clear. Default value is all of them (`RF24_IRQ_ALL`).
1195
+ * Multiple flags can be cleared by OR-ing rf24_irq_flags_e values together.
1196
+ *
1197
+ * @returns The STATUS byte from the radio's register before it was modified. Use
1198
+ * enumerations of rf24_irq_flags_e as masks to interpret the STATUS byte's meaning(s).
1229
1199
*
1230
1200
* @ingroup StatusFlags
1231
1201
*/
@@ -1234,11 +1204,16 @@ class RF24
1234
1204
/* *
1235
1205
* Set which flags shall be reflected on the radio's IRQ pin.
1236
1206
*
1237
- * This is similar to maskIRQ(), but with less confusing parameters.
1207
+ * @remarks This function is similar to maskIRQ() but with less confusing parameters.
1238
1208
*
1239
- * @param flags The value of @ref rf24_irq_flags_e to influence the radio's IRQ pin.
1240
- * The default value (@ref RF24_IRQ_NONE) will disable the radio's IRQ pin.
1241
- * Multiple events can be enabled by OR-ing @ref rf24_irq_flags_e values together.
1209
+ * @param flags A value of rf24_irq_flags_e to influence the radio's IRQ pin.
1210
+ * The default value (`RF24_IRQ_NONE`) will disable the radio's IRQ pin.
1211
+ * Multiple events can be enabled by OR-ing rf24_irq_flags_e values together.
1212
+ * ```cpp
1213
+ * radio.setStatusFlags(RF24_IRQ_ALL);
1214
+ * // is equivalent to
1215
+ * radio.setStatusFlags(RF24_RX_DR | RF24_TX_DS | RF24_TX_DF);
1216
+ * ```
1242
1217
*
1243
1218
* @ingroup StatusFlags
1244
1219
*/
@@ -1251,14 +1226,18 @@ class RF24
1251
1226
* Use `RF24::update()` instead to get a fresh copy of the Status flags at
1252
1227
* the slight cost of performance.
1253
1228
*
1229
+ * @returns The STATUS byte from the radio's register as the latest SPI transaction. Use
1230
+ * enumerations of rf24_irq_flags_e as masks to interpret the STATUS byte's meaning(s).
1231
+ *
1254
1232
* @ingroup StatusFlags
1255
1233
*/
1256
1234
uint8_t getStatusFlags ();
1257
1235
1258
1236
/* *
1259
1237
* Get an updated STATUS byte from the radio.
1260
1238
*
1261
- * @returns The StatusFlags fetched directly from the radio.
1239
+ * @returns The STATUS byte fetched from the radio's register. Use enumerations of
1240
+ * rf24_irq_flags_e as masks to interpret the STATUS byte's meaning(s).
1262
1241
*
1263
1242
* @ingroup StatusFlags
1264
1243
*/
@@ -1308,13 +1287,13 @@ class RF24
1308
1287
* Non-blocking write to the open writing pipe
1309
1288
*
1310
1289
* Just like write(), but it returns immediately. To find out what happened
1311
- * to the send, catch the IRQ and then call whatHappened ().
1290
+ * to the send, catch the IRQ and then call clearStatusFlags() or getStatusFlags ().
1312
1291
*
1313
1292
* @see
1314
1293
* - write()
1315
1294
* - writeFast()
1316
1295
* - startFastWrite()
1317
- * - whatHappened ()
1296
+ * - clearStatusFlags ()
1318
1297
* - setAutoAck() (for single noAck writes)
1319
1298
*
1320
1299
* @param buf Pointer to the data to be sent
@@ -1831,38 +1810,6 @@ class RF24
1831
1810
*/
1832
1811
void disableCRC (void );
1833
1812
1834
- /* *
1835
- * This function is used to configure what events will trigger the Interrupt
1836
- * Request (IRQ) pin active LOW.
1837
- * The following events can be configured:
1838
- * 1. "data sent": This does not mean that the data transmitted was
1839
- * received, only that the attempt to send it was complete.
1840
- * 2. "data failed": This means the data being sent was not received. This
1841
- * event is only triggered when the auto-ack feature is enabled.
1842
- * 3. "data received": This means that data from a receiving payload has
1843
- * been loaded into the RX FIFO buffers. Remember that there are only 3
1844
- * levels available in the RX FIFO buffers.
1845
- *
1846
- * By default, all events are configured to trigger the IRQ pin active LOW.
1847
- * When the IRQ pin is active, use whatHappened() to determine what events
1848
- * triggered it. Remember that calling whatHappened() also clears these
1849
- * events' status, and the IRQ pin will then be reset to inactive HIGH.
1850
- *
1851
- * The following code configures the IRQ pin to only reflect the "data received"
1852
- * event:
1853
- * @code
1854
- * radio.maskIRQ(1, 1, 0);
1855
- * @endcode
1856
- *
1857
- * @param tx_ok `true` ignores the "data sent" event, `false` reflects the
1858
- * "data sent" event on the IRQ pin.
1859
- * @param tx_fail `true` ignores the "data failed" event, `false` reflects the
1860
- * "data failed" event on the IRQ pin.
1861
- * @param rx_ready `true` ignores the "data received" event, `false` reflects the
1862
- * "data received" event on the IRQ pin.
1863
- */
1864
- void maskIRQ (bool tx_ok, bool tx_fail, bool rx_ready);
1865
-
1866
1813
/* *
1867
1814
*
1868
1815
* The driver will delay for this duration when stopListening() is called
@@ -1998,6 +1945,76 @@ class RF24
1998
1945
*/
1999
1946
bool isAckPayloadAvailable (void );
2000
1947
1948
+ /* *
1949
+ * This function is used to configure what events will trigger the Interrupt
1950
+ * Request (IRQ) pin active LOW.
1951
+ *
1952
+ * @deprecated Use setStatusFlags() instead.
1953
+ *
1954
+ * The following events can be configured:
1955
+ * 1. "data sent": This does not mean that the data transmitted was
1956
+ * received, only that the attempt to send it was complete.
1957
+ * 2. "data failed": This means the data being sent was not received. This
1958
+ * event is only triggered when the auto-ack feature is enabled.
1959
+ * 3. "data received": This means that data from a receiving payload has
1960
+ * been loaded into the RX FIFO buffers. Remember that there are only 3
1961
+ * levels available in the RX FIFO buffers.
1962
+ *
1963
+ * By default, all events are configured to trigger the IRQ pin active LOW.
1964
+ * When the IRQ pin is active, use clearStatusFlags() or getStatusFlags() to
1965
+ * determine what events triggered it.
1966
+ * Remember that calling clearStatusFlags() also clears these
1967
+ * events' status, and the IRQ pin will then be reset to inactive HIGH.
1968
+ *
1969
+ * The following code configures the IRQ pin to only reflect the "data received"
1970
+ * event:
1971
+ * @code
1972
+ * radio.maskIRQ(1, 1, 0);
1973
+ * @endcode
1974
+ *
1975
+ * @param tx_ok `true` ignores the "data sent" event, `false` reflects the
1976
+ * "data sent" event on the IRQ pin.
1977
+ * @param tx_fail `true` ignores the "data failed" event, `false` reflects the
1978
+ * "data failed" event on the IRQ pin.
1979
+ * @param rx_ready `true` ignores the "data received" event, `false` reflects the
1980
+ * "data received" event on the IRQ pin.
1981
+ */
1982
+ void maskIRQ (bool tx_ok, bool tx_fail, bool rx_ready);
1983
+
1984
+ /* *
1985
+ * Call this when you get an Interrupt Request (IRQ) to find out why
1986
+ *
1987
+ * This function describes what event triggered the IRQ pin to go active
1988
+ * LOW and clears the status of all events.
1989
+ *
1990
+ * @deprecated Use clearStatusFlags() instead.
1991
+ *
1992
+ * @see setStatusFlags()
1993
+ *
1994
+ * @param[out] tx_ok The transmission attempt completed (TX_DS). This does
1995
+ * not imply that the transmitted data was received by another radio, rather
1996
+ * this only reports if the attempt to send was completed. This will
1997
+ * always be `true` when the auto-ack feature is disabled.
1998
+ * @param[out] tx_fail The transmission failed to be acknowledged, meaning
1999
+ * too many retries (MAX_RT) were made while expecting an ACK packet. This
2000
+ * event is only triggered when auto-ack feature is enabled.
2001
+ * @param[out] rx_ready There is a newly received payload (RX_DR) saved to
2002
+ * RX FIFO buffers. Remember that the RX FIFO can only hold up to 3
2003
+ * payloads. Once the RX FIFO is full, all further received transmissions
2004
+ * are rejected until there is space to save new data in the RX FIFO
2005
+ * buffers.
2006
+ *
2007
+ * @note This function expects no parameters in the python wrapper.
2008
+ * Instead, this function returns a 3 item tuple describing the IRQ
2009
+ * events' status. To use this function in the python wrapper:
2010
+ * @code{.py}
2011
+ * # let`radio` be the instantiated RF24 object
2012
+ * tx_ds, tx_df, rx_dr = radio.whatHappened() # get IRQ status flags
2013
+ * print("tx_ds: {}, tx_df: {}, rx_dr: {}".format(tx_ds, tx_df, rx_dr))
2014
+ * @endcode
2015
+ */
2016
+ void whatHappened (bool & tx_ok, bool & tx_fail, bool & rx_ready);
2017
+
2001
2018
private:
2002
2019
/* *@}*/
2003
2020
/* *
0 commit comments