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 )
|
boolean RF24::read( void* buf, uint8_t len )
|
||||||
{
|
{
|
||||||
// was this the last of the data available?
|
|
||||||
boolean result = false;
|
|
||||||
|
|
||||||
// Fetch the payload
|
// Fetch the payload
|
||||||
read_payload( buf, len );
|
read_payload( buf, len );
|
||||||
|
|
||||||
uint8_t fifo_status;
|
// was this the last of the data available?
|
||||||
read_register(FIFO_STATUS,&fifo_status,1);
|
return read_register(FIFO_STATUS) & _BV(RX_EMPTY);
|
||||||
if ( fifo_status & _BV(RX_EMPTY) )
|
|
||||||
result = true;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue