Clean up read() to use new-style read_register, which reduces it to two lines of code
This commit is contained in:
parent
63eb62ebc3
commit
9566c82367
11
RF24.cpp
11
RF24.cpp
|
@ -486,18 +486,11 @@ boolean RF24::available(uint8_t* pipe_num)
|
|||
|
||||
boolean RF24::read( void* buf, uint8_t len )
|
||||
{
|
||||
// was this the last of the data available?
|
||||
boolean result = false;
|
||||
|
||||
// Fetch the payload
|
||||
read_payload( buf, len );
|
||||
|
||||
uint8_t fifo_status;
|
||||
read_register(FIFO_STATUS,&fifo_status,1);
|
||||
if ( fifo_status & _BV(RX_EMPTY) )
|
||||
result = true;
|
||||
|
||||
return result;
|
||||
// was this the last of the data available?
|
||||
return read_register(FIFO_STATUS) & _BV(RX_EMPTY);
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
|
|
Loading…
Reference in New Issue