Skip to content

Commit

Permalink
[SX126x] Added option to disable TCXO using SX126x::setTCXO(0) (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgromes committed Sep 22, 2020
1 parent cd142df commit bb1bb59
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/modules/SX126x/SX126x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,11 @@ int16_t SX126x::setTCXO(float voltage, uint32_t delay) {
clearDeviceErrors();
}

// check 0 V disable
if(abs(voltage - 0.0) <= 0.001) {
return(reset(true));
}

// check alowed voltage values
uint8_t data[4];
if(abs(voltage - 1.6) <= 0.001) {
Expand Down
5 changes: 4 additions & 1 deletion src/modules/SX126x/SX126x.h
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,12 @@ class SX126x: public PhysicalLayer {
/*!
\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.
\returns \ref status_codes
*/
int16_t setTCXO(float voltage, uint32_t delay = 5000);

Expand Down

0 comments on commit bb1bb59

Please sign in to comment.