From 9566c82367a735b1db7b603880dc657352a1793a Mon Sep 17 00:00:00 2001 From: maniacbug Date: Sun, 10 Jul 2011 08:12:12 -0700 Subject: [PATCH] Clean up read() to use new-style read_register, which reduces it to two lines of code --- RF24.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/RF24.cpp b/RF24.cpp index 24e5fc8..1f2858b 100644 --- a/RF24.cpp +++ b/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); } /******************************************************************/