[CC1101] Fixed non-Hal functions

This commit is contained in:
jgromes 2023-04-30 11:26:53 +02:00
parent 54c1255646
commit 3df9cb27ff

View file

@ -93,11 +93,11 @@ int16_t CC1101::begin(float freq, float br, float freqDev, float rxBw, int8_t pw
void CC1101::reset() { void CC1101::reset() {
// this is the manual power-on-reset sequence // this is the manual power-on-reset sequence
this->mod->hal->digitalWrite(this->mod->getCs(), LOW); this->mod->hal->digitalWrite(this->mod->getCs(), this->mod->hal->GpioLevelLow);
this->mod->hal->delayMicroseconds(5); this->mod->hal->delayMicroseconds(5);
this->mod->hal->digitalWrite(this->mod->getCs(), HIGH); this->mod->hal->digitalWrite(this->mod->getCs(), this->mod->hal->GpioLevelHigh);
this->mod->hal->delayMicroseconds(40); this->mod->hal->delayMicroseconds(40);
this->mod->hal->digitalWrite(this->mod->getCs(), LOW); this->mod->hal->digitalWrite(this->mod->getCs(), this->mod->hal->GpioLevelLow);
this->mod->hal->delay(10); this->mod->hal->delay(10);
SPIsendCommand(RADIOLIB_CC1101_CMD_RESET); SPIsendCommand(RADIOLIB_CC1101_CMD_RESET);
} }
@ -132,8 +132,6 @@ int16_t CC1101::transmit(uint8_t* data, size_t len, uint8_t addr) {
} }
} }
delay(20);
return(finishTransmit()); return(finishTransmit());
} }
@ -466,15 +464,14 @@ int16_t CC1101::readData(uint8_t* data, size_t len) {
this->packetLengthQueried = false; this->packetLengthQueried = false;
// Flush then standby according to RXOFF_MODE (default: RADIOLIB_CC1101_RXOFF_IDLE) // Flush then standby according to RXOFF_MODE (default: RADIOLIB_CC1101_RXOFF_IDLE)
//if (SPIgetRegValue(RADIOLIB_CC1101_REG_MCSM1, 3, 2) == RADIOLIB_CC1101_RXOFF_IDLE) { if (SPIgetRegValue(RADIOLIB_CC1101_REG_MCSM1, 3, 2) == RADIOLIB_CC1101_RXOFF_IDLE) {
// set mode to standby // set mode to standby
standby(); standby();
// flush Rx FIFO // flush Rx FIFO
SPIsendCommand(RADIOLIB_CC1101_CMD_FLUSH_RX | RADIOLIB_CC1101_CMD_READ); SPIsendCommand(RADIOLIB_CC1101_CMD_FLUSH_RX | RADIOLIB_CC1101_CMD_READ);
delay(10); }
//}
return(RADIOLIB_ERR_NONE); return(RADIOLIB_ERR_NONE);
} }