kopia lustrzana https://github.com/jgromes/RadioLib
[CC1101] Implement finishReceive
rodzic
1890308f4f
commit
f32eece01d
|
@ -75,8 +75,7 @@ int16_t CC1101::receive(uint8_t* data, size_t len, RadioLibTime_t timeout) {
|
|||
this->mod->hal->yield();
|
||||
|
||||
if(this->mod->hal->millis() - start > timeout) {
|
||||
standby();
|
||||
SPIsendCommand(RADIOLIB_CC1101_CMD_FLUSH_RX);
|
||||
(void)finishReceive();
|
||||
return(RADIOLIB_ERR_RX_TIMEOUT);
|
||||
}
|
||||
}
|
||||
|
@ -87,8 +86,7 @@ int16_t CC1101::receive(uint8_t* data, size_t len, RadioLibTime_t timeout) {
|
|||
this->mod->hal->yield();
|
||||
|
||||
if(this->mod->hal->millis() - start > timeout) {
|
||||
standby();
|
||||
SPIsendCommand(RADIOLIB_CC1101_CMD_FLUSH_RX);
|
||||
(void)finishReceive();
|
||||
return(RADIOLIB_ERR_RX_TIMEOUT);
|
||||
}
|
||||
}
|
||||
|
@ -413,17 +411,18 @@ int16_t CC1101::readData(uint8_t* data, size_t len) {
|
|||
|
||||
// Flush then standby according to RXOFF_MODE (default: 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);
|
||||
finishReceive();
|
||||
}
|
||||
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t CC1101::finishReceive() {
|
||||
int16_t state = standby();
|
||||
SPIsendCommand(RADIOLIB_CC1101_CMD_FLUSH_RX);
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t CC1101::setFrequency(float freq) {
|
||||
// check allowed frequency range
|
||||
#if RADIOLIB_CHECK_PARAMS
|
||||
|
|
|
@ -749,6 +749,12 @@ class CC1101: public PhysicalLayer {
|
|||
*/
|
||||
int16_t readData(uint8_t* data, size_t len) override;
|
||||
|
||||
/*!
|
||||
\brief Clean up after reception is done.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t finishReceive() override;
|
||||
|
||||
// configuration methods
|
||||
|
||||
/*!
|
||||
|
|
Ładowanie…
Reference in New Issue