Added setCRCLength
This commit is contained in:
parent
ec33f03368
commit
34efd5ac94
11
RF24.cpp
11
RF24.cpp
|
@ -619,6 +619,17 @@ void RF24::setDataRate(rf24_datarate_e speed)
|
||||||
if (speed == RF24_2MBPS)
|
if (speed == RF24_2MBPS)
|
||||||
setup |= RF_DR;
|
setup |= RF_DR;
|
||||||
write_register(RF_SETUP,setup);
|
write_register(RF_SETUP,setup);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************/
|
||||||
|
|
||||||
|
void RF24::setCRCLength(rf24_crclength_e length)
|
||||||
|
{
|
||||||
|
uint8_t config = read_register(CONFIG) & _BV(CRCO);
|
||||||
|
if (length == RF24_CRC_16)
|
||||||
|
config |= _BV(CRCO);
|
||||||
|
write_register(CONFIG,config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// vim:ai:cin:sts=2 sw=2 ft=cpp
|
// vim:ai:cin:sts=2 sw=2 ft=cpp
|
||||||
|
|
9
RF24.h
9
RF24.h
|
@ -12,6 +12,7 @@
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
typedef enum { RF24_1MBPS = 0, RF24_2MBPS } rf24_datarate_e;
|
typedef enum { RF24_1MBPS = 0, RF24_2MBPS } rf24_datarate_e;
|
||||||
|
typedef enum { RF24_CRC_8 = 0, RF24_CRC_16 } rf24_crclength_e;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
|
* Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
|
||||||
|
@ -420,7 +421,6 @@ public:
|
||||||
*
|
*
|
||||||
* @return true if was carrier, false if not
|
* @return true if was carrier, false if not
|
||||||
*/
|
*/
|
||||||
|
|
||||||
boolean testCarrier(void);
|
boolean testCarrier(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -429,6 +429,13 @@ public:
|
||||||
* @param speed RF24_1MBPS for 1Mbps or RF24_2MBPS for 2Mbps
|
* @param speed RF24_1MBPS for 1Mbps or RF24_2MBPS for 2Mbps
|
||||||
*/
|
*/
|
||||||
void setDataRate(rf24_datarate_e speed);
|
void setDataRate(rf24_datarate_e speed);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the CRC length
|
||||||
|
*
|
||||||
|
* @param length RF24_CRC_8 for 8-bit or RF24_CRC_16 for 16-bit
|
||||||
|
*/
|
||||||
|
void setCRCLength(rf24_crclength_e length);
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue