[SX126x] Added option to change sleep mode (cold/warm start)
This commit is contained in:
parent
460a050a63
commit
02ac97b07e
2 changed files with 9 additions and 3 deletions
|
@ -370,8 +370,12 @@ int16_t SX126x::scanChannel() {
|
||||||
return(ERR_UNKNOWN);
|
return(ERR_UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t SX126x::sleep() {
|
int16_t SX126x::sleep(bool retainConfig) {
|
||||||
uint8_t data[] = {SX126X_SLEEP_START_COLD | SX126X_SLEEP_RTC_OFF};
|
uint8_t sleepMode = SX126X_SLEEP_START_WARM;
|
||||||
|
if(!retainConfig) {
|
||||||
|
sleepMode = SX126X_SLEEP_START_COLD;
|
||||||
|
}
|
||||||
|
uint8_t data[] = {sleepMode | SX126X_SLEEP_RTC_OFF};
|
||||||
int16_t state = SPIwriteCommand(SX126X_CMD_SET_SLEEP, data, 1, false);
|
int16_t state = SPIwriteCommand(SX126X_CMD_SET_SLEEP, data, 1, false);
|
||||||
|
|
||||||
// wait for SX126x to safely enter sleep mode
|
// wait for SX126x to safely enter sleep mode
|
||||||
|
|
|
@ -452,9 +452,11 @@ class SX126x: public PhysicalLayer {
|
||||||
/*!
|
/*!
|
||||||
\brief Sets the module to sleep mode.
|
\brief Sets the module to sleep mode.
|
||||||
|
|
||||||
|
\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
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t sleep();
|
int16_t sleep(bool retainConfig = true);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets the module to standby mode (overload for PhysicalLayer compatibility, uses 13 MHz RC oscillator).
|
\brief Sets the module to standby mode (overload for PhysicalLayer compatibility, uses 13 MHz RC oscillator).
|
||||||
|
|
Loading…
Add table
Reference in a new issue