Skip to content

Commit

Permalink
[SX126x] Added option to select standby mode (#1008)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgromes committed Mar 12, 2024
1 parent 24ffbfc commit b288485
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modules/SX126x/SX126x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
SX126x::SX126x(Module* mod) : PhysicalLayer(RADIOLIB_SX126X_FREQUENCY_STEP_SIZE, RADIOLIB_SX126X_MAX_PACKET_LENGTH) {
this->mod = mod;
this->XTAL = false;
this->standbyXOSC = false;
}

int16_t SX126x::begin(uint8_t cr, uint8_t syncWord, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) {
Expand Down Expand Up @@ -463,7 +464,7 @@ int16_t SX126x::sleep(bool retainConfig) {
}

int16_t SX126x::standby() {
return(SX126x::standby(RADIOLIB_SX126X_STANDBY_RC));
return(SX126x::standby(this->standbyXOSC ? RADIOLIB_SX126X_STANDBY_XOSC : RADIOLIB_SX126X_STANDBY_RC));
}

int16_t SX126x::standby(uint8_t mode, bool wakeup) {
Expand Down
5 changes: 5 additions & 0 deletions src/modules/SX126x/SX126x.h
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,11 @@ class SX126x: public PhysicalLayer {
*/
bool XTAL;

/*!
\brief Whether to use XOSC (true) or RC (false) oscillator in standby mode. Defaults to false.
*/
bool standbyXOSC;

// basic methods

/*!
Expand Down

0 comments on commit b288485

Please sign in to comment.