Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion RF24.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ bool RF24::read( void* buf, uint8_t len )

/****************************************************************************/

void RF24::whatHappened(bool& tx_ok,bool& tx_fail,bool& rx_ready)
uint8_t RF24::whatHappened(bool& tx_ok,bool& tx_fail,bool& rx_ready)
{
// Read the status & reset the status in one easy call
// Or is that such a good idea?
Expand All @@ -597,6 +597,10 @@ void RF24::whatHappened(bool& tx_ok,bool& tx_fail,bool& rx_ready)
tx_ok = status & _BV(TX_DS);
tx_fail = status & _BV(MAX_RT);
rx_ready = status & _BV(RX_DR);

// Return pipe number. However, it is only useful and valid when
// something is received (rx_ready == true)
return ( status >> RX_P_NO ) & B111;
}

/****************************************************************************/
Expand Down
4 changes: 3 additions & 1 deletion RF24.h
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,10 @@ class RF24
* @param[out] tx_ok The send was successful (TX_DS)
* @param[out] tx_fail The send failed, too many retries (MAX_RT)
* @param[out] rx_ready There is a message waiting to be read (RX_DS)
*
* @return Pipe number for which data is ready. Only valid if rx_ready == true
*/
void whatHappened(bool& tx_ok,bool& tx_fail,bool& rx_ready);
uint8_t whatHappened(bool& tx_ok,bool& tx_fail,bool& rx_ready);

/**
* Test whether there was a carrier on the line for the
Expand Down