[SX126x] Wakeup device on standby() call (#740)
This commit is contained in:
parent
84ebdddcaf
commit
bdc5bb0bba
2 changed files with 11 additions and 3 deletions
|
@ -453,8 +453,16 @@ int16_t SX126x::standby(uint8_t mode) {
|
|||
// set RF switch (if present)
|
||||
this->mod->setRfSwitchState(Module::MODE_IDLE);
|
||||
|
||||
uint8_t data[] = {mode};
|
||||
uint8_t data[] = { mode };
|
||||
int16_t state = this->mod->SPIwriteStream(RADIOLIB_SX126X_CMD_SET_STANDBY, data, 1);
|
||||
if(state == RADIOLIB_ERR_NONE) {
|
||||
return(state);
|
||||
} else if(state == RADIOLIB_ERR_SPI_CMD_TIMEOUT) {
|
||||
// the device might be in sleep mode, pull NSS low to wake up and try again
|
||||
this->mod->hal->digitalWrite(this->mod->getCs(), this->mod->hal->GpioLevelLow);
|
||||
return(this->mod->SPIwriteStream(RADIOLIB_SX126X_CMD_SET_STANDBY, data, 1));
|
||||
}
|
||||
return(state);
|
||||
}
|
||||
|
||||
void SX126x::setDio1Action(void (*func)(void)) {
|
||||
|
|
|
@ -538,7 +538,7 @@ class SX126x: public PhysicalLayer {
|
|||
int16_t scanChannel(uint8_t symbolNum = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, uint8_t detPeak = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, uint8_t detMin = RADIOLIB_SX126X_CAD_PARAM_DEFAULT);
|
||||
|
||||
/*!
|
||||
\brief Sets the module to sleep mode.
|
||||
\brief Sets the module to sleep mode. To wake the device up, call standby().
|
||||
\param retainConfig Set to true to retain configuration of the currently active modem ("warm start")
|
||||
or to false to discard current configuration ("cold start"). Defaults to true.
|
||||
\returns \ref status_codes
|
||||
|
|
Loading…
Add table
Reference in a new issue