Added TCXO control functions

This commit is contained in:
Mark Qvist 2023-06-07 20:49:26 +02:00
parent a29cfc6658
commit 1770557d09
3 changed files with 15 additions and 0 deletions

View File

@ -87,6 +87,7 @@
#define HAS_DISPLAY false #define HAS_DISPLAY false
#define HAS_BLUETOOTH false #define HAS_BLUETOOTH false
#define HAS_TCXO false
#define HAS_PMU false #define HAS_PMU false
#define HAS_NP false #define HAS_NP false
@ -147,6 +148,7 @@
const int pin_led_tx = 4; const int pin_led_tx = 4;
#define HAS_DISPLAY true #define HAS_DISPLAY true
#define HAS_PMU true #define HAS_PMU true
#define HAS_TCXO true
#define HAS_BLUETOOTH true #define HAS_BLUETOOTH true
#define HAS_CONSOLE true #define HAS_CONSOLE true
#define HAS_SD false #define HAS_SD false

View File

@ -67,6 +67,7 @@
#define REG_HIGH_BW_OPTIMIZE_2 0x3a #define REG_HIGH_BW_OPTIMIZE_2 0x3a
#define REG_DIO_MAPPING_1 0x40 #define REG_DIO_MAPPING_1 0x40
#define REG_VERSION 0x42 #define REG_VERSION 0x42
#define REG_TCXO 0x4b
#define REG_PA_DAC 0x4d #define REG_PA_DAC 0x4d
// Modes // Modes
@ -424,6 +425,16 @@ void LoRaClass::sleep()
writeRegister(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_SLEEP); writeRegister(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_SLEEP);
} }
void LoRaClass::enableTCXO() {
uint8_t tcxo_reg = readRegister(REG_TCXO);
writeRegister(REG_TCXO, tcxo_reg | 0x10);
}
void LoRaClass::disableTCXO() {
uint8_t tcxo_reg = readRegister(REG_TCXO);
writeRegister(REG_TCXO, tcxo_reg & 0xEF);
}
void LoRaClass::setTxPower(int level, int outputPin) { void LoRaClass::setTxPower(int level, int outputPin) {
if (PA_OUTPUT_RFO_PIN == outputPin) { if (PA_OUTPUT_RFO_PIN == outputPin) {
// RFO // RFO

2
LoRa.h
View File

@ -68,6 +68,8 @@ public:
uint8_t modemStatus(); uint8_t modemStatus();
void enableCrc(); void enableCrc();
void disableCrc(); void disableCrc();
void enableTCXO();
void disableTCXO();
// deprecated // deprecated
void crc() { enableCrc(); } void crc() { enableCrc(); }