Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make available(pipe) depend on available(void) #1007

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
18 changes: 6 additions & 12 deletions RF24.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1488,23 +1488,18 @@ uint8_t RF24::getDynamicPayloadSize(void)

bool RF24::available(void)
{
uint8_t pipe = RF24_NO_FETCH_PIPE;
return available(&pipe);
return (read_register(FIFO_STATUS) & 1) == 0;
}

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

bool RF24::available(uint8_t* pipe_num)
{
if (read_register(FIFO_STATUS) & 1) { // if RX FIFO is empty
return 0;
}

// If the caller wants the pipe number, include that
if (*pipe_num != RF24_NO_FETCH_PIPE)
if (available()) { // if RX FIFO is not empty
*pipe_num = (get_status() >> RX_P_NO) & 0x07;

return 1;
return 1;
}
return 0;
}

/****************************************************************************/
Expand Down Expand Up @@ -1756,8 +1751,7 @@ bool RF24::writeAckPayload(uint8_t pipe, const void* buf, uint8_t len)

bool RF24::isAckPayloadAvailable(void)
{
uint8_t pipe = RF24_NO_FETCH_PIPE;
return available(&pipe);
return available();
}

/****************************************************************************/
Expand Down
3 changes: 0 additions & 3 deletions RF24_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@
#define RF24_SPI_SPEED 10000000
#endif

/// A sentinel used to control fetching the pipe info in `RF24::available()`.
#define RF24_NO_FETCH_PIPE 0XFF

//ATXMega
#if defined(__AVR_ATxmega64D3__) || defined(__AVR_ATxmega128D3__) || defined(__AVR_ATxmega192D3__) || defined(__AVR_ATxmega256D3__) || defined(__AVR_ATxmega384D3__)
// In order to be available both in Windows and Linux this should take presence here.
Expand Down