From c151ffbf67c5b64baef1852ea9e7ec83ba7dc70f Mon Sep 17 00:00:00 2001 From: maniacbug Date: Tue, 28 Jun 2011 06:56:24 -0700 Subject: [PATCH] Tidied up EN_RXADDR setting --- RF24.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/RF24.cpp b/RF24.cpp index efc773a..86c8880 100644 --- a/RF24.cpp +++ b/RF24.cpp @@ -523,12 +523,10 @@ void RF24::openReadingPipe(uint8_t child, uint64_t value) write_register(child_payload_size[child],payload_size); - // Note this is kind of an inefficient way to set up these enable bits, bit I thought it made - // the calling code more simple - uint8_t en_rx; - read_register(EN_RXADDR,&en_rx,1); - en_rx |= _BV(child_pipe_enable[child]); - write_register(EN_RXADDR,en_rx); + // Note it would be more efficient to set all of the bits for all open + // pipes at once. However, I thought it would make the calling code + // more simple to do it this way. + write_register(EN_RXADDR,read_register(EN_RXADDR) | _BV(child_pipe_enable[child])); } }