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