Fixed bug in setcrclength and setdatarate which was mishandling the bits
This commit is contained in:
parent
7640852edf
commit
1517f1249d
4
RF24.cpp
4
RF24.cpp
|
@ -677,7 +677,7 @@ bool RF24::testCarrier(void)
|
||||||
|
|
||||||
void RF24::setDataRate(rf24_datarate_e speed)
|
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)
|
if (speed == RF24_2MBPS)
|
||||||
setup |= _BV(RF_DR);
|
setup |= _BV(RF_DR);
|
||||||
write_register(RF_SETUP,setup);
|
write_register(RF_SETUP,setup);
|
||||||
|
@ -688,7 +688,7 @@ void RF24::setDataRate(rf24_datarate_e speed)
|
||||||
|
|
||||||
void RF24::setCRCLength(rf24_crclength_e length)
|
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)
|
if (length == RF24_CRC_16)
|
||||||
config |= _BV(CRCO);
|
config |= _BV(CRCO);
|
||||||
write_register(CONFIG,config);
|
write_register(CONFIG,config);
|
||||||
|
|
Loading…
Reference in New Issue