Skip to content

Commit

Permalink
[LR11x0] Make regulator mode and Rx gain config public (#1108)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgromes committed May 26, 2024
1 parent 0d49106 commit c3e99c8
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 6 deletions.
27 changes: 22 additions & 5 deletions src/modules/LR11x0/LR11x0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ int16_t LR11x0::begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t
state = invertIQ(false);
RADIOLIB_ASSERT(state);

state = setRegulatorLDO();
RADIOLIB_ASSERT(state);

return(RADIOLIB_ERR_NONE);
}

Expand Down Expand Up @@ -85,6 +88,9 @@ int16_t LR11x0::beginGFSK(float br, float freqDev, float rxBw, int8_t power, uin
state = setCRC(2);
RADIOLIB_ASSERT(state);

state = setRegulatorLDO();
RADIOLIB_ASSERT(state);

return(RADIOLIB_ERR_NONE);
}

Expand All @@ -103,6 +109,9 @@ int16_t LR11x0::beginLRFHSS(uint8_t bw, uint8_t cr, int8_t power, float tcxoVolt
state = setSyncWord(0x12AD101B);
RADIOLIB_ASSERT(state);

state = setRegulatorLDO();
RADIOLIB_ASSERT(state);

// set fixed configuration
return(setModulationParamsLrFhss(RADIOLIB_LR11X0_LR_FHSS_BIT_RATE_RAW, RADIOLIB_LR11X0_LR_FHSS_SHAPING_GAUSSIAN_BT_1_0));
}
Expand Down Expand Up @@ -1363,6 +1372,19 @@ float LR11x0::getDataRate() const {
return(this->dataRateMeasured);
}

int16_t LR11x0::setRegulatorLDO() {
return(this->setRegMode(RADIOLIB_LR11X0_REG_MODE_LDO));
}

int16_t LR11x0::setRegulatorDCDC() {
return(this->setRegMode(RADIOLIB_LR11X0_REG_MODE_DC_DC));
}

int16_t LR11x0::setRxBoostedGainMode(bool en) {
uint8_t buff[1] = { (uint8_t)en };
return(this->SPIcommand(RADIOLIB_LR11X0_CMD_SET_RX_BOOSTED, true, buff, sizeof(buff)));
}

int16_t LR11x0::setLrFhssConfig(uint8_t bw, uint8_t cr, uint8_t hdrCount, uint16_t hopSeed) {
// check active modem
uint8_t type = RADIOLIB_LR11X0_PACKET_TYPE_NONE;
Expand Down Expand Up @@ -2476,11 +2498,6 @@ int16_t LR11x0::setGfskWhitParams(uint16_t seed) {
return(this->SPIcommand(RADIOLIB_LR11X0_CMD_SET_GFSK_WHIT_PARAMS, true, buff, sizeof(buff)));
}

int16_t LR11x0::setRxBoosted(bool en) {
uint8_t buff[1] = { (uint8_t)en };
return(this->SPIcommand(RADIOLIB_LR11X0_CMD_SET_RX_BOOSTED, true, buff, sizeof(buff)));
}

int16_t LR11x0::setRangingParameter(uint8_t symbolNum) {
// the first byte is reserved
uint8_t buff[2] = { 0x00, symbolNum };
Expand Down
20 changes: 19 additions & 1 deletion src/modules/LR11x0/LR11x0.h
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,25 @@ class LR11x0: public PhysicalLayer {
*/
float getDataRate() const;

/*!
\brief Set regulator mode to LDO.
\returns \ref status_codes
*/
int16_t setRegulatorLDO();

/*!
\brief Set regulator mode to DC-DC.
\returns \ref status_codes
*/
int16_t setRegulatorDCDC();

/*!
\brief Enables or disables Rx Boosted Gain mode (additional Rx gain for increased power consumption).
\param en True for Rx Boosted Gain, false for Rx Power Saving Gain
\returns \ref status_codes
*/
int16_t setRxBoostedGainMode(bool en);

/*!
\brief Sets LR-FHSS configuration.
\param bw LR-FHSS bandwidth, one of RADIOLIB_LR11X0_LR_FHSS_BW_* values.
Expand Down Expand Up @@ -1416,7 +1435,6 @@ class LR11x0: public PhysicalLayer {
int16_t setRangingTxRxDelay(uint32_t delay);
int16_t setGfskCrcParams(uint32_t init, uint32_t poly);
int16_t setGfskWhitParams(uint16_t seed);
int16_t setRxBoosted(bool en);
int16_t setRangingParameter(uint8_t symbolNum);
int16_t setRssiCalibration(const int8_t* tune, int16_t gainOffset);
int16_t setLoRaSyncWord(uint8_t sync);
Expand Down

0 comments on commit c3e99c8

Please sign in to comment.