[SX126x] Added option to disable TCXO using SX126x::setTCXO(0) (#99)

This commit is contained in:
jgromes 2020-09-22 07:49:27 +02:00
parent cd142df4b9
commit bb1bb59aff
2 changed files with 9 additions and 1 deletions

View file

@ -1203,6 +1203,11 @@ int16_t SX126x::setTCXO(float voltage, uint32_t delay) {
clearDeviceErrors(); clearDeviceErrors();
} }
// check 0 V disable
if(abs(voltage - 0.0) <= 0.001) {
return(reset(true));
}
// check alowed voltage values // check alowed voltage values
uint8_t data[4]; uint8_t data[4];
if(abs(voltage - 1.6) <= 0.001) { if(abs(voltage - 1.6) <= 0.001) {

View file

@ -733,9 +733,12 @@ class SX126x: public PhysicalLayer {
/*! /*!
\brief Sets TCXO (Temperature Compensated Crystal Oscillator) configuration. \brief Sets TCXO (Temperature Compensated Crystal Oscillator) configuration.
\param TCXO reference voltage in volts. Allowed values are 1.6, 1.7, 1.8, 2.2. 2.4, 2.7, 3.0 and 3.3 V \param TCXO reference voltage in volts. Allowed values are 1.6, 1.7, 1.8, 2.2. 2.4, 2.7, 3.0 and 3.3 V. Set to 0 to disable TCXO.
NOTE: After setting this parameter to 0, the module will be reset (since there's no other way to disable TCXO).
\param TCXO timeout in us. Defaults to 5000 us. \param TCXO timeout in us. Defaults to 5000 us.
\returns \ref status_codes
*/ */
int16_t setTCXO(float voltage, uint32_t delay = 5000); int16_t setTCXO(float voltage, uint32_t delay = 5000);