@@ -30,22 +30,34 @@ if radio.available() { /* .. */ }
3030
3131</td ></tr ></table >
3232
33- ## openReadingPipe(uint8_t, uint64_t) and openWritingPipe(uint64_t)
33+ ## 64-bit integer addresses
3434
35- > ** Deprecated since v1.3.11 **
35+ Any function that accept an address in the form of ` uint64_t ` is discouraged. This includes
3636
37- These functions' address parameter used a 64-bit unsigned integer (` uint64_t ` ).
37+ - ` RF24::openReadingPipe(uint8_t, uint64_t) `
38+ > ** Deprecated since v1.3.11**
39+ - ` RF24::openWritingPipe(uint64_t) `
40+ > ** Deprecated since v1.3.11**
41+ - ` RF24::stopListening(const uint64_t) `
42+ > ** Deprecated since v1.5**
43+
44+ These functions' address parameter use a 64-bit unsigned integer (` uint64_t ` ).
3845The nRF24L01 can only use up to 40 bit addresses.
39- Thus, there was an unused 24 bits being allocated for addresses using this function .
46+ Thus, there is an unused 24 bits being allocated for addresses using these functions .
4047
4148There are overloaded functions that use a buffer instead:
4249
4350- ` RF24::openReadingPipe(uint8_t, const uint8_t*) `
4451- ` RF24::openWritingPipe(const uint8_t*) `
52+ - ` RF24::stopListening(const uint8_t*) `
4553
4654These eliminate the unnecessary 24 bits by only using the length of the buffer (` uint8_t* ` )
4755specified by ` RF24::setAddressWidth() ` .
4856
57+ @see The ` RF24::openWritingPipe(const uint8_t*) ` is now deprecated in favor of the
58+ overloaded ` RF24::stopListening(const uint8_t*) ` function.
59+ See the section below for more detail.
60+
4961> [ !CAUTION]
5062> The endianness (byte order) of a buffer is reversed compared to a 64-bit integer.
5163> ``` c
@@ -177,6 +189,7 @@ The aptly named `RF24::clearStatusFlags()` is designed to be a replacement for `
177189Like ` RF24::clearStatusFlags() ` , ` RF24::setStatusFlags() ` takes 1 parameter whose value is defined by
178190the ` rf24_irq_flags_e ` enumerated constants. These constant values specify individual flags;
179191they can also be OR'd together to specify multiple flags.
192+
180193Additionally, ` RF24::clearStatusFlags() ` returns the STATUS byte containing the flags that
181194caused the IRQ pin to go active LOW.
182195This allows the user code to allocate less memory when diagnosing the IRQ pin's meaning.
@@ -211,3 +224,64 @@ radio.clearStatusFlags(RF24_RX_DR);
211224```
212225
213226</td></tr></table>
227+
228+ ## openWritingPipe(const uint8_t*)
229+
230+ > Deprecated since v1.5
231+
232+ Originally, `RF24::openWritingPipe(const uint8_t*)` was just a compliment to
233+ `RF24::openReadingPipe()`.
234+ It changes the address on pipe 0 because that is the only pipe that can be
235+ used for transmitting.
236+
237+ Unfortunately, there was a bug that prevented the given TX address from being
238+ persistent on pipe 0 if the user code also set an RX address to pipe 0.
239+ This bug would surface when switching between RX mode and TX mode (via
240+ `RF24::startListening()` and `RF24::stopListening()` respectively) or after
241+ `RF24::stopConstCarrier()` (if `RF24::isPVariant()` returns `true`).
242+
243+ The solution is to cache the TX address on the `RF24` instance.
244+ Consequently, this solution did not fit well with the traditional order of
245+ functions used to set up the radio's TX or RX mode.
246+
247+ By overloading `RF24::stopListening(const uint8_t*)`, we are able to ensure proper radio
248+ setup without requiring certain functions are called in a certain order.
249+
250+ - Use `RF24::stopListening(const uint8_t*)` to set the TX address and enter inactive TX mode.
251+ `RF24::openReadingPipe()` can now (as of v1.5) be used in TX mode without consequence.
252+ - Use `RF24::stopListening()` to enter inactive TX mode without changing the TX address.
253+
254+ > [!warning]
255+ > Avoid using pipe 0 for RX operations to improve performance and reliability.
256+ >
257+ > For implementation detail, see the source for `RF24::openReadingPipe()` and
258+ > `RF24::stopListening()`. Ultimately, the datasheet's Appendix A has a detailed
259+ > example outlining the order of a proper radio setup.
260+
261+ <table><tr>
262+ <th>Old</th>
263+ <th>New (supported)</th>
264+ </tr><tr><td>
265+
266+ ```cpp
267+ // set TX address (pipe 0)
268+ radio.openWritingPipe(tx_address);
269+
270+ // set RX address (pipe 1)
271+ radio.openReadingPipe(1, rx_address);
272+
273+ // idle radio using inactive TX mode
274+ radio.stopListening();
275+ ```
276+
277+ </td ><td >
278+
279+ ``` cpp
280+ // set TX address (pipe 0)
281+ radio.stopListening(tx_address); // enters inactive TX mode
282+
283+ // set RX address (pipe 1)
284+ radio.openReadingPipe(1 , rx_address);
285+ ```
286+
287+ </td ></tr ></table >
0 commit comments