Fixed bug in setcrclength and setdatarate which was mishandling the bits

This commit is contained in:
maniacbug 2011-07-13 19:13:32 -07:00
parent 7640852edf
commit 1517f1249d
1 changed files with 2 additions and 2 deletions

View File

@ -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);