Clean up read() to use new-style read_register, which reduces it to two lines of code

This commit is contained in:
maniacbug 2011-07-10 08:12:12 -07:00
parent 63eb62ebc3
commit 9566c82367
1 changed files with 2 additions and 9 deletions

View File

@ -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);
}
/******************************************************************/