[SX126x] Parameter to use LDO in begin()

See 4231edee70
for context.
This commit is contained in:
Callan Bryant 2020-01-28 14:12:16 +00:00
parent 030fa1001e
commit 81fe2d09f8
No known key found for this signature in database
GPG key ID: C31FA9DF3ACBFFAA
2 changed files with 18 additions and 6 deletions

View file

@ -4,7 +4,7 @@ SX126x::SX126x(Module* mod) : PhysicalLayer(SX126X_CRYSTAL_FREQ, SX126X_DIV_EXPO
_mod = mod; _mod = mod;
} }
int16_t SX126x::begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, float currentLimit, uint16_t preambleLength, float tcxoVoltage) { int16_t SX126x::begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, float currentLimit, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) {
// set module properties // set module properties
_mod->init(RADIOLIB_USE_SPI); _mod->init(RADIOLIB_USE_SPI);
Module::pinMode(_mod->getIrq(), INPUT); Module::pinMode(_mod->getIrq(), INPUT);
@ -65,12 +65,16 @@ int16_t SX126x::begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, float
state = setDio2AsRfSwitch(true); state = setDio2AsRfSwitch(true);
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
if (useRegulatorLDO) {
state = setRegulatorLDO();
} else {
state = setRegulatorDCDC(); state = setRegulatorDCDC();
}
return(state); return(state);
} }
int16_t SX126x::beginFSK(float br, float freqDev, float rxBw, float currentLimit, uint16_t preambleLength, float dataShaping, float tcxoVoltage) { int16_t SX126x::beginFSK(float br, float freqDev, float rxBw, float currentLimit, uint16_t preambleLength, float dataShaping, float tcxoVoltage, bool useRegulatorLDO) {
// set module properties // set module properties
_mod->init(RADIOLIB_USE_SPI); _mod->init(RADIOLIB_USE_SPI);
Module::pinMode(_mod->getIrq(), INPUT); Module::pinMode(_mod->getIrq(), INPUT);
@ -136,7 +140,11 @@ int16_t SX126x::beginFSK(float br, float freqDev, float rxBw, float currentLimit
state = setDio2AsRfSwitch(false); state = setDio2AsRfSwitch(false);
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
if (useRegulatorLDO) {
state = setRegulatorLDO();
} else {
state = setRegulatorDCDC(); state = setRegulatorDCDC();
}
return(state); return(state);
} }

View file

@ -369,9 +369,11 @@ class SX126x: public PhysicalLayer {
\param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip. \param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip.
\param useRegulatorLDO use the LDO instead of DC-DC converter (default false). This is necessary for some modules such as the LAMBDA from RF solutions.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, float currentLimit, uint16_t preambleLength, float tcxoVoltage); int16_t begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, float currentLimit, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO = false);
/*! /*!
\brief Initialization method for FSK modem. \brief Initialization method for FSK modem.
@ -390,9 +392,11 @@ class SX126x: public PhysicalLayer {
\param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip. \param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip.
\param useRegulatorLDO use the LDO instead of DC-DC converter (default false). This is necessary for some modules such as the LAMBDA from RF solutions.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t beginFSK(float br, float freqDev, float rxBw, float currentLimit, uint16_t preambleLength, float dataShaping, float tcxoVoltage); int16_t beginFSK(float br, float freqDev, float rxBw, float currentLimit, uint16_t preambleLength, float dataShaping, float tcxoVoltage, bool useRegulatorLDO = false);
/*! /*!
\brief Reset method. Will reset the chip to the default state using RST pin. \brief Reset method. Will reset the chip to the default state using RST pin.