File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -1521,22 +1521,21 @@ uint8_t RF24::getDynamicPayloadSize(void)
15211521
15221522bool RF24::available (void )
15231523{
1524- uint8_t pipe = 0 ;
1524+ uint8_t pipe = RF24_NO_FETCH_PIPE ;
15251525 return available (&pipe);
15261526}
15271527
15281528/* ***************************************************************************/
15291529
15301530bool RF24::available (uint8_t * pipe_num)
15311531{
1532- // get implied RX FIFO empty flag from status byte
1533- uint8_t pipe = (get_status () >> RX_P_NO) & 0x07 ;
1534- if (pipe > 5 )
1532+ if (read_register (FIFO_STATUS) & 1 ) { // if RX FIFO is empty
15351533 return 0 ;
1534+ }
15361535
15371536 // If the caller wants the pipe number, include that
1538- if (pipe_num)
1539- *pipe_num = pipe ;
1537+ if (* pipe_num != RF24_NO_FETCH_PIPE )
1538+ *pipe_num = ( get_status () >> RX_P_NO) & 0x07 ;
15401539
15411540 return 1 ;
15421541}
Original file line number Diff line number Diff line change 4444 #define RF24_SPI_SPEED 10000000
4545#endif
4646
47+ /// A sentinel used to control fetching the pipe info in `RF24::available()`.
48+ #define RF24_NO_FETCH_PIPE 0XFF
49+
4750//ATXMega
4851#if defined(__AVR_ATxmega64D3__ ) || defined(__AVR_ATxmega128D3__ ) || defined(__AVR_ATxmega192D3__ ) || defined(__AVR_ATxmega256D3__ ) || defined(__AVR_ATxmega384D3__ )
4952 // In order to be available both in Windows and Linux this should take presence here.
You can’t perform that action at this time.
0 commit comments