@@ -46,6 +46,10 @@ There are overloaded functions that use a buffer instead:
46
46
These eliminate the unnecessary 24 bits by only using the length of the buffer (` uint8_t* ` )
47
47
specified by ` RF24::setAddressWidth() ` .
48
48
49
+ @see The ` RF24::openWritingPipe(const uint8_t*) ` is now deprecated in favor of the
50
+ overloaded ` RF24::stopListening(uint8_t*) ` function.
51
+ See the section below for more detail.
52
+
49
53
> [ !CAUTION]
50
54
> The endianness (byte order) of a buffer is reversed compared to a 64-bit integer.
51
55
> ``` c
@@ -211,3 +215,63 @@ radio.clearStatusFlags(RF24_RX_DR);
211
215
```
212
216
213
217
</td></tr></table>
218
+
219
+ ## openWritingPipe(const uint8_t*)
220
+
221
+ > Deprecated since v1.5
222
+
223
+ Originally, `RF24::openWritingPipe(const uint8_t*)` was just a compliment to
224
+ `RF24::openReadingPipe()`.
225
+ It changes the address on pipe 0 because that is the only pipe that can be
226
+ used for transmitting.
227
+
228
+ Unfortunately, there was a bug that prevented the given TX address from being
229
+ persistent on pipe 0 if the user code also set an RX address to pipe 0.
230
+ This bug would surface when switching between RX mode and TX mode (via
231
+ `RF24::startListening()` and `RF24::stopListening()` respectively) or after
232
+ `RF24::stopConstCarrier()`.
233
+ As a result the TX address has to be cached on the `RF24` instance.
234
+ Consequently, this solution does not fit well with the traditional order of
235
+ setting up the radio.
236
+
237
+ By overloading `RF24::stopListening(const uint8_t*)`, we are able to ensure proper radio
238
+ setup without requiring certain functions are called in a certain order.
239
+
240
+ - Use `RF24::stopListening(const uint8_t*)` to set the TX address and enter inactive TX mode.
241
+ `RF24::openReadingPipe()` can now (as of v1.5) be used in TX mode without consequence.
242
+ - Use `RF24::stopListening()` to enter inactive TX mode without changing the TX address.
243
+
244
+ > [!warning]
245
+ > Avoid using pipe 0 for RX operations to improve performance and reliability.
246
+ >
247
+ > For implementation detail, see the source for `RF24::openReadingPipe()` and
248
+ > `RF24::stopListening()`. Ultimately, the datasheet's Appendix A has a detailed
249
+ > example outlining the order of a proper radio setup.
250
+
251
+ <table><tr>
252
+ <th>Old</th>
253
+ <th>New (supported)</th>
254
+ </tr><tr><td>
255
+
256
+ ```cpp
257
+ // set TX address (pipe 0)
258
+ radio.openWritingPipe(tx_address);
259
+
260
+ // set RX address (pipe 1)
261
+ radio.openReadingPipe(1, rx_address);
262
+
263
+ // idle radio using inactive TX mode
264
+ radio.stopListening();
265
+ ```
266
+
267
+ </td ><td >
268
+
269
+ ``` cpp
270
+ // set TX address (pipe 0)
271
+ radio.stopListening(tx_address); // enters inactive TX mode
272
+
273
+ // set RX address (pipe 1)
274
+ radio.openReadingPipe(1 , rx_address);
275
+ ```
276
+
277
+ </td ></tr ></table >
0 commit comments