Skip to content

Commit

Permalink
[SX126x] Simplify rx gain configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
jgromes committed Sep 25, 2024
1 parent ec6de37 commit da74aa2
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/modules/SX126x/SX126x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,20 +1008,9 @@ int16_t SX126x::setRxBandwidth(float rxBw) {
}

int16_t SX126x::setRxBoostedGainMode(bool rxbgm, bool persist) {
// read the current register value
uint8_t rxGain = 0;
int16_t state = readRegister(RADIOLIB_SX126X_REG_RX_GAIN, &rxGain, 1);
RADIOLIB_ASSERT(state);

// gain mode register value (SX1261/2 datasheet v2.1 section 9.6)
if(rxbgm) {
rxGain = RADIOLIB_SX126X_RX_GAIN_BOOSTED;
} else {
rxGain = RADIOLIB_SX126X_RX_GAIN_POWER_SAVING;
}

// update RX gain setting register
state = writeRegister(RADIOLIB_SX126X_REG_RX_GAIN, &rxGain, 1);
uint8_t rxGain = rxbgm ? RADIOLIB_SX126X_RX_GAIN_BOOSTED : RADIOLIB_SX126X_RX_GAIN_POWER_SAVING;
int16_t state = writeRegister(RADIOLIB_SX126X_REG_RX_GAIN, &rxGain, 1);
RADIOLIB_ASSERT(state);

// add Rx Gain register to retention memory if requested
Expand Down

0 comments on commit da74aa2

Please sign in to comment.