From 3df9cb27ff55fcb34fde6ee9ccff4bccc3426d2a Mon Sep 17 00:00:00 2001 From: jgromes Date: Sun, 30 Apr 2023 11:26:53 +0200 Subject: [PATCH] [CC1101] Fixed non-Hal functions --- src/modules/CC1101/CC1101.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/modules/CC1101/CC1101.cpp b/src/modules/CC1101/CC1101.cpp index f392a4cc..b7b4f4bd 100644 --- a/src/modules/CC1101/CC1101.cpp +++ b/src/modules/CC1101/CC1101.cpp @@ -93,11 +93,11 @@ int16_t CC1101::begin(float freq, float br, float freqDev, float rxBw, int8_t pw void CC1101::reset() { // 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->digitalWrite(this->mod->getCs(), HIGH); + this->mod->hal->digitalWrite(this->mod->getCs(), this->mod->hal->GpioLevelHigh); 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); 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()); } @@ -466,15 +464,14 @@ int16_t CC1101::readData(uint8_t* data, size_t len) { this->packetLengthQueried = false; // 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 standby(); // flush Rx FIFO SPIsendCommand(RADIOLIB_CC1101_CMD_FLUSH_RX | RADIOLIB_CC1101_CMD_READ); - delay(10); - //} + } return(RADIOLIB_ERR_NONE); }