From 1517f1249de1713d0ec26c37476cbf2bf4291b58 Mon Sep 17 00:00:00 2001 From: maniacbug Date: Wed, 13 Jul 2011 19:13:32 -0700 Subject: [PATCH] Fixed bug in setcrclength and setdatarate which was mishandling the bits --- RF24.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RF24.cpp b/RF24.cpp index 11089e2..c16e034 100644 --- a/RF24.cpp +++ b/RF24.cpp @@ -677,7 +677,7 @@ bool RF24::testCarrier(void) void RF24::setDataRate(rf24_datarate_e speed) { - uint8_t setup = read_register(RF_SETUP) & _BV(RF_DR); + uint8_t setup = read_register(RF_SETUP) & ~_BV(RF_DR); if (speed == RF24_2MBPS) setup |= _BV(RF_DR); write_register(RF_SETUP,setup); @@ -688,7 +688,7 @@ void RF24::setDataRate(rf24_datarate_e speed) void RF24::setCRCLength(rf24_crclength_e length) { - uint8_t config = read_register(CONFIG) & _BV(CRCO); + uint8_t config = read_register(CONFIG) & ~_BV(CRCO); if (length == RF24_CRC_16) config |= _BV(CRCO); write_register(CONFIG,config);