[CC1101] Check CRC only if validation is active.

This commit is contained in:
Andrea Guglielmini 2019-12-13 19:46:45 +01:00
parent c78847e9df
commit 6373c30729
2 changed files with 5 additions and 2 deletions

View file

@ -286,8 +286,8 @@ int16_t CC1101::readData(uint8_t* data, size_t len) {
standby();
// check CRC
if((val & 0b10000000) == 0b00000000) {
return(ERR_CRC_MISMATCH);
if (_crcOn && (val & 0b10000000) == 0b00000000) {
return (ERR_CRC_MISMATCH);
}
return(ERR_NONE);
@ -617,6 +617,8 @@ int16_t CC1101::disableSyncWordFiltering() {
}
int16_t CC1101::setCrcFiltering(bool crcOn) {
_crcOn = crcOn;
if (crcOn == true) {
return(SPIsetRegValue(CC1101_REG_PKTCTRL0, CC1101_CRC_ON, 2, 2));
} else {

View file

@ -831,6 +831,7 @@ class CC1101: public PhysicalLayer {
uint8_t _packetLengthConfig;
bool _promiscuous;
bool _crcOn = true;
uint8_t _syncWordLength;
int8_t _power;