Skip to content

Commit 00123c1

Browse files
committed
deprecate maskIRQ() and whatHappened()
1 parent d7dc1a6 commit 00123c1

File tree

1 file changed

+76
-70
lines changed

1 file changed

+76
-70
lines changed

RF24.h

+76-70
Original file line numberDiff line numberDiff line change
@@ -463,13 +463,13 @@ class RF24
463463
* that received the next available payload. According to the datasheet,
464464
* the data about the pipe number that received the next available payload
465465
* is "unreliable" during a FALLING transition on the IRQ pin. This means
466-
* you should call whatHappened() before calling this function
466+
* you should call clearStatusFlags() before calling this function
467467
* during an ISR (Interrupt Service Routine). For example:
468468
* @code
469469
* void isrCallbackFunction() {
470470
* bool tx_ds, tx_df, rx_dr;
471-
* radio.whatHappened(tx_ds, tx_df, rx_dr); // resets the IRQ pin to HIGH
472-
* radio.available(); // returned data should now be reliable
471+
* uint8_t flags = radio.clearStatusFlags(); // resets the IRQ pin to HIGH
472+
* radio.available(); // returned data should now be reliable
473473
* }
474474
*
475475
* void setup() {
@@ -884,7 +884,7 @@ class RF24
884884
*
885885
* @warning According to the datasheet, the data saved to `pipe_num` is
886886
* "unreliable" during a FALLING transition on the IRQ pin. This means you
887-
* should call whatHappened() before calling this function during
887+
* should call clearStatusFlags() before calling this function during
888888
* an ISR (Interrupt Service Routine). For example:
889889
* @code
890890
* void isrCallbackFunction() {
@@ -1241,38 +1241,6 @@ class RF24
12411241
*/
12421242
bool writeAckPayload(uint8_t pipe, const void* buf, uint8_t len);
12431243

1244-
/**
1245-
* Call this when you get an Interrupt Request (IRQ) to find out why
1246-
*
1247-
* This function describes what event triggered the IRQ pin to go active
1248-
* LOW and clears the status of all events.
1249-
*
1250-
* @see maskIRQ()
1251-
*
1252-
* @param[out] tx_ok The transmission attempt completed (TX_DS). This does
1253-
* not imply that the transmitted data was received by another radio, rather
1254-
* this only reports if the attempt to send was completed. This will
1255-
* always be `true` when the auto-ack feature is disabled.
1256-
* @param[out] tx_fail The transmission failed to be acknowledged, meaning
1257-
* too many retries (MAX_RT) were made while expecting an ACK packet. This
1258-
* event is only triggered when auto-ack feature is enabled.
1259-
* @param[out] rx_ready There is a newly received payload (RX_DR) saved to
1260-
* RX FIFO buffers. Remember that the RX FIFO can only hold up to 3
1261-
* payloads. Once the RX FIFO is full, all further received transmissions
1262-
* are rejected until there is space to save new data in the RX FIFO
1263-
* buffers.
1264-
*
1265-
* @note This function expects no parameters in the python wrapper.
1266-
* Instead, this function returns a 3 item tuple describing the IRQ
1267-
* events' status. To use this function in the python wrapper:
1268-
* @code{.py}
1269-
* # let`radio` be the instantiated RF24 object
1270-
* tx_ds, tx_df, rx_dr = radio.whatHappened() # get IRQ status flags
1271-
* print("tx_ds: {}, tx_df: {}, rx_dr: {}".format(tx_ds, tx_df, rx_dr))
1272-
* @endcode
1273-
*/
1274-
void whatHappened(bool& tx_ok, bool& tx_fail, bool& rx_ready);
1275-
12761244
/**
12771245
* Clear the StatusFlags that caused an interrupt event.
12781246
*
@@ -1369,13 +1337,13 @@ class RF24
13691337
* Non-blocking write to the open writing pipe
13701338
*
13711339
* Just like write(), but it returns immediately. To find out what happened
1372-
* to the send, catch the IRQ and then call whatHappened().
1340+
* to the send, catch the IRQ and then call clearStatusFlags() or getStatusFlags().
13731341
*
13741342
* @see
13751343
* - write()
13761344
* - writeFast()
13771345
* - startFastWrite()
1378-
* - whatHappened()
1346+
* - clearStatusFlags()
13791347
* - setAutoAck() (for single noAck writes)
13801348
*
13811349
* @param buf Pointer to the data to be sent
@@ -1892,38 +1860,6 @@ class RF24
18921860
*/
18931861
void disableCRC(void);
18941862

1895-
/**
1896-
* This function is used to configure what events will trigger the Interrupt
1897-
* Request (IRQ) pin active LOW.
1898-
* The following events can be configured:
1899-
* 1. "data sent": This does not mean that the data transmitted was
1900-
* received, only that the attempt to send it was complete.
1901-
* 2. "data failed": This means the data being sent was not received. This
1902-
* event is only triggered when the auto-ack feature is enabled.
1903-
* 3. "data received": This means that data from a receiving payload has
1904-
* been loaded into the RX FIFO buffers. Remember that there are only 3
1905-
* levels available in the RX FIFO buffers.
1906-
*
1907-
* By default, all events are configured to trigger the IRQ pin active LOW.
1908-
* When the IRQ pin is active, use whatHappened() to determine what events
1909-
* triggered it. Remember that calling whatHappened() also clears these
1910-
* events' status, and the IRQ pin will then be reset to inactive HIGH.
1911-
*
1912-
* The following code configures the IRQ pin to only reflect the "data received"
1913-
* event:
1914-
* @code
1915-
* radio.maskIRQ(1, 1, 0);
1916-
* @endcode
1917-
*
1918-
* @param tx_ok `true` ignores the "data sent" event, `false` reflects the
1919-
* "data sent" event on the IRQ pin.
1920-
* @param tx_fail `true` ignores the "data failed" event, `false` reflects the
1921-
* "data failed" event on the IRQ pin.
1922-
* @param rx_ready `true` ignores the "data received" event, `false` reflects the
1923-
* "data received" event on the IRQ pin.
1924-
*/
1925-
void maskIRQ(bool tx_ok, bool tx_fail, bool rx_ready);
1926-
19271863
/**
19281864
*
19291865
* The driver will delay for this duration when stopListening() is called
@@ -2059,6 +1995,76 @@ class RF24
20591995
*/
20601996
bool isAckPayloadAvailable(void);
20611997

1998+
/**
1999+
* This function is used to configure what events will trigger the Interrupt
2000+
* Request (IRQ) pin active LOW.
2001+
*
2002+
* @deprecated Use setStatusFlags() instead.
2003+
*
2004+
* The following events can be configured:
2005+
* 1. "data sent": This does not mean that the data transmitted was
2006+
* received, only that the attempt to send it was complete.
2007+
* 2. "data failed": This means the data being sent was not received. This
2008+
* event is only triggered when the auto-ack feature is enabled.
2009+
* 3. "data received": This means that data from a receiving payload has
2010+
* been loaded into the RX FIFO buffers. Remember that there are only 3
2011+
* levels available in the RX FIFO buffers.
2012+
*
2013+
* By default, all events are configured to trigger the IRQ pin active LOW.
2014+
* When the IRQ pin is active, use clearStatusFlags() or getStatusFlags() to
2015+
* determine what events triggered it.
2016+
* Remember that calling clearStatusFlags() also clears these
2017+
* events' status, and the IRQ pin will then be reset to inactive HIGH.
2018+
*
2019+
* The following code configures the IRQ pin to only reflect the "data received"
2020+
* event:
2021+
* @code
2022+
* radio.maskIRQ(1, 1, 0);
2023+
* @endcode
2024+
*
2025+
* @param tx_ok `true` ignores the "data sent" event, `false` reflects the
2026+
* "data sent" event on the IRQ pin.
2027+
* @param tx_fail `true` ignores the "data failed" event, `false` reflects the
2028+
* "data failed" event on the IRQ pin.
2029+
* @param rx_ready `true` ignores the "data received" event, `false` reflects the
2030+
* "data received" event on the IRQ pin.
2031+
*/
2032+
void maskIRQ(bool tx_ok, bool tx_fail, bool rx_ready);
2033+
2034+
/**
2035+
* Call this when you get an Interrupt Request (IRQ) to find out why
2036+
*
2037+
* This function describes what event triggered the IRQ pin to go active
2038+
* LOW and clears the status of all events.
2039+
*
2040+
* @deprecated Use clearStatusFlags() instead.
2041+
*
2042+
* @see setStatusFlags()
2043+
*
2044+
* @param[out] tx_ok The transmission attempt completed (TX_DS). This does
2045+
* not imply that the transmitted data was received by another radio, rather
2046+
* this only reports if the attempt to send was completed. This will
2047+
* always be `true` when the auto-ack feature is disabled.
2048+
* @param[out] tx_fail The transmission failed to be acknowledged, meaning
2049+
* too many retries (MAX_RT) were made while expecting an ACK packet. This
2050+
* event is only triggered when auto-ack feature is enabled.
2051+
* @param[out] rx_ready There is a newly received payload (RX_DR) saved to
2052+
* RX FIFO buffers. Remember that the RX FIFO can only hold up to 3
2053+
* payloads. Once the RX FIFO is full, all further received transmissions
2054+
* are rejected until there is space to save new data in the RX FIFO
2055+
* buffers.
2056+
*
2057+
* @note This function expects no parameters in the python wrapper.
2058+
* Instead, this function returns a 3 item tuple describing the IRQ
2059+
* events' status. To use this function in the python wrapper:
2060+
* @code{.py}
2061+
* # let`radio` be the instantiated RF24 object
2062+
* tx_ds, tx_df, rx_dr = radio.whatHappened() # get IRQ status flags
2063+
* print("tx_ds: {}, tx_df: {}, rx_dr: {}".format(tx_ds, tx_df, rx_dr))
2064+
* @endcode
2065+
*/
2066+
void whatHappened(bool& tx_ok, bool& tx_fail, bool& rx_ready);
2067+
20622068
private:
20632069
/**@}*/
20642070
/**

0 commit comments

Comments
 (0)