[SX128x] Wakeup device on standby() call
This commit is contained in:
parent
d1d07af00b
commit
84ebdddcaf
2 changed files with 10 additions and 2 deletions
|
@ -460,8 +460,16 @@ int16_t SX128x::standby(uint8_t mode) {
|
||||||
this->mod->setRfSwitchState(Module::MODE_IDLE);
|
this->mod->setRfSwitchState(Module::MODE_IDLE);
|
||||||
|
|
||||||
uint8_t data[] = { mode };
|
uint8_t data[] = { mode };
|
||||||
|
int16_t state = this->mod->SPIwriteStream(RADIOLIB_SX128X_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_SX128X_CMD_SET_STANDBY, data, 1));
|
return(this->mod->SPIwriteStream(RADIOLIB_SX128X_CMD_SET_STANDBY, data, 1));
|
||||||
}
|
}
|
||||||
|
return(state);
|
||||||
|
}
|
||||||
|
|
||||||
void SX128x::setDio1Action(void (*func)(void)) {
|
void SX128x::setDio1Action(void (*func)(void)) {
|
||||||
this->mod->hal->attachInterrupt(this->mod->hal->pinToInterrupt(this->mod->getIrq()), func, this->mod->hal->GpioInterruptRising);
|
this->mod->hal->attachInterrupt(this->mod->hal->pinToInterrupt(this->mod->getIrq()), func, this->mod->hal->GpioInterruptRising);
|
||||||
|
|
|
@ -460,7 +460,7 @@ class SX128x: public PhysicalLayer {
|
||||||
int16_t scanChannel();
|
int16_t scanChannel();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\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 and data buffer or to false
|
\param retainConfig Set to true to retain configuration and data buffer or to false
|
||||||
to discard current configuration and data buffer. Defaults to true.
|
to discard current configuration and data buffer. Defaults to true.
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
|
|
Loading…
Add table
Reference in a new issue