Skip to content

Commit

Permalink
an update of RadioLib
Browse files Browse the repository at this point in the history
  • Loading branch information
lyusupov committed Nov 22, 2024
1 parent 9f2dfd7 commit 239d7d1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ int16_t LR11x0::beginGNSS(uint8_t constellations, float tcxoVoltage) {
state = this->clearErrors();
RADIOLIB_ASSERT(state);

// set GNSS flag to reserve DIO11 for LF clock
this->gnss = true;
state = this->configLfClock(RADIOLIB_LR11X0_LF_BUSY_RELEASE_DISABLED | RADIOLIB_LR11X0_LF_CLK_XOSC);
RADIOLIB_ASSERT(state);

Expand Down Expand Up @@ -2066,6 +2068,7 @@ int16_t LR11x0::modSetup(float tcxoVoltage, uint8_t modem) {
this->mod->spiConfig.stream = true;
this->mod->spiConfig.parseStatusCb = SPIparseStatus;
this->mod->spiConfig.checkStatusCb = SPIcheckStatus;
this->gnss = false;

// try to find the LR11x0 chip - this will also reset the module at least once
if(!LR11x0::findChip(this->chipType)) {
Expand Down Expand Up @@ -2452,7 +2455,7 @@ int16_t LR11x0::setDioIrqParams(uint32_t irq1, uint32_t irq2) {
}

int16_t LR11x0::setDioIrqParams(uint32_t irq) {
return(setDioIrqParams(irq, irq));
return(setDioIrqParams(irq, this->gnss ? 0 : irq));
}

int16_t LR11x0::clearIrq(uint32_t irq) {
Expand All @@ -2463,7 +2466,7 @@ int16_t LR11x0::clearIrq(uint32_t irq) {
}

int16_t LR11x0::configLfClock(uint8_t setup) {
return(this->SPIcommand(RADIOLIB_LR11X0_CMD_CONFIG_LF_LOCK, true, &setup, 1));
return(this->SPIcommand(RADIOLIB_LR11X0_CMD_CONFIG_LF_CLOCK, true, &setup, 1));
}

int16_t LR11x0::setTcxoMode(uint8_t tune, uint32_t delay) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#define RADIOLIB_LR11X0_CMD_SET_DIO_AS_RF_SWITCH (0x0112)
#define RADIOLIB_LR11X0_CMD_SET_DIO_IRQ_PARAMS (0x0113)
#define RADIOLIB_LR11X0_CMD_CLEAR_IRQ (0x0114)
#define RADIOLIB_LR11X0_CMD_CONFIG_LF_LOCK (0x0116)
#define RADIOLIB_LR11X0_CMD_CONFIG_LF_CLOCK (0x0116)
#define RADIOLIB_LR11X0_CMD_SET_TCXO_MODE (0x0117)
#define RADIOLIB_LR11X0_CMD_REBOOT (0x0118)
#define RADIOLIB_LR11X0_CMD_GET_VBAT (0x0119)
Expand Down Expand Up @@ -281,7 +281,7 @@
#define RADIOLIB_LR11X0_IRQ_ALL (0x1BF80FFCUL) // 31 0 all interrupts
#define RADIOLIB_LR11X0_IRQ_NONE (0x00UL << 0) // 31 0 no interrupts

// RADIOLIB_LR11X0_CMD_CONFIG_LF_LOCK
// RADIOLIB_LR11X0_CMD_CONFIG_LF_CLOCK
#define RADIOLIB_LR11X0_LF_CLK_RC (0x00UL << 0) // 1 0 32.768 kHz source: RC oscillator
#define RADIOLIB_LR11X0_LF_CLK_XOSC (0x01UL << 0) // 1 0 crystal oscillator
#define RADIOLIB_LR11X0_LF_CLK_EXT (0x02UL << 0) // 1 0 external signal on DIO11
Expand Down Expand Up @@ -1828,6 +1828,7 @@ class LR11x0: public PhysicalLayer {
float dataRateMeasured = 0;

uint8_t wifiScanMode = 0;
bool gnss = false;

int16_t modSetup(float tcxoVoltage, uint8_t modem);
static int16_t SPIparseStatus(uint8_t in);
Expand Down

0 comments on commit 239d7d1

Please sign in to comment.