[SX126x] Added option to control XTAL/TCXO via member variable

This commit is contained in:
jgromes 2023-03-05 16:38:28 +01:00
parent 8174c58250
commit 8bf15941c7
2 changed files with 8 additions and 2 deletions

View file

@ -3,6 +3,7 @@
SX126x::SX126x(Module* mod) : PhysicalLayer(RADIOLIB_SX126X_FREQUENCY_STEP_SIZE, RADIOLIB_SX126X_MAX_PACKET_LENGTH) { SX126x::SX126x(Module* mod) : PhysicalLayer(RADIOLIB_SX126X_FREQUENCY_STEP_SIZE, RADIOLIB_SX126X_MAX_PACKET_LENGTH) {
_mod = mod; _mod = mod;
this->XTAL = false;
} }
Module* SX126x::getMod() { Module* SX126x::getMod() {
@ -57,7 +58,7 @@ int16_t SX126x::begin(uint8_t cr, uint8_t syncWord, uint16_t preambleLength, flo
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
// set TCXO control, if requested // set TCXO control, if requested
if(tcxoVoltage > 0.0) { if(!this->XTAL && tcxoVoltage > 0.0) {
state = setTCXO(tcxoVoltage); state = setTCXO(tcxoVoltage);
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
} }
@ -131,7 +132,7 @@ int16_t SX126x::beginFSK(float br, float freqDev, float rxBw, uint16_t preambleL
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
// set TCXO control, if requested // set TCXO control, if requested
if(tcxoVoltage > 0.0) { if(!this->XTAL && tcxoVoltage > 0.0) {
state = setTCXO(tcxoVoltage); state = setTCXO(tcxoVoltage);
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
} }

View file

@ -439,6 +439,11 @@ class SX126x: public PhysicalLayer {
Module* getMod(); Module* getMod();
/*!
\brief Whether the module has an XTAL (true) or TCXO (false). Defaults to false.
*/
bool XTAL;
// basic methods // basic methods
/*! /*!