Add method to support SX128x High Sensitivity Mode.

This commit is contained in:
Robert 2022-02-23 23:51:54 -05:00
parent 01fc7fb844
commit 89de031e18
2 changed files with 24 additions and 0 deletions

View file

@ -1020,6 +1020,21 @@ int16_t SX128x::setAccessAddress(uint32_t addr) {
return(SX128x::writeRegister(RADIOLIB_SX128X_REG_ACCESS_ADDRESS_BYTE_3, addrBuff, 4)); return(SX128x::writeRegister(RADIOLIB_SX128X_REG_ACCESS_ADDRESS_BYTE_3, addrBuff, 4));
} }
int16_t SX128x::setHighSensitivityMode(bool hsm) {
// update register
uint8_t RxGain = 0;
int16_t state = readRegister(RADIOLIB_SX128X_REG_GAIN_MODE, &RxGain, 1);
RADIOLIB_ASSERT(state);
if (hsm) {
RxGain |= 0xC0; // Set bits 6 and 7
} else {
RxGain &= ~0xC0; // Unset bits 6 and 7
}
state = writeRegister(RADIOLIB_SX128X_REG_GAIN_MODE, &RxGain, 1);
RADIOLIB_ASSERT(state);
return(0);
}
float SX128x::getRSSI() { float SX128x::getRSSI() {
// get packet status // get packet status
uint8_t packetStatus[5]; uint8_t packetStatus[5];

View file

@ -713,6 +713,15 @@ class SX128x: public PhysicalLayer {
*/ */
int16_t setAccessAddress(uint32_t addr); int16_t setAccessAddress(uint32_t addr);
/*!
\brief Enables or disables receiver high sensitivity mode.
\param True to enable and false to disable.
\returns 0
*/
int16_t setHighSensitivityMode(bool hsm = false);
/*! /*!
\brief Gets RSSI (Recorded Signal Strength Indicator) of the last received packet. \brief Gets RSSI (Recorded Signal Strength Indicator) of the last received packet.