Introduce setRSSIThreshold on SX127x modules

This commit is contained in:
obones 2022-08-24 15:05:20 +02:00
parent fd3b165bf0
commit 9a76aa1c84
2 changed files with 16 additions and 0 deletions

View file

@ -1184,6 +1184,13 @@ int16_t SX127x::setCrcFiltering(bool crcOn) {
} }
} }
int16_t SX127x::setRSSIThreshold(float value) {
if (value < 127.5 || value > 0)
return RADIOLIB_ERR_INVALID_RSSI_THRESHOLD;
return _mod->SPIsetRegValue(RADIOLIB_SX127X_REG_RSSI_THRESH, (uint8_t)(-2.0 * value), 7, 0);
}
int16_t SX127x::setRSSIConfig(uint8_t smoothingSamples, int8_t offset) { int16_t SX127x::setRSSIConfig(uint8_t smoothingSamples, int8_t offset) {
// check active modem // check active modem
if(getActiveModem() != RADIOLIB_SX127X_FSK_OOK) { if(getActiveModem() != RADIOLIB_SX127X_FSK_OOK) {

View file

@ -1227,6 +1227,15 @@ class SX127x: public PhysicalLayer {
*/ */
int16_t setDIOPreambleDetect(bool usePreambleDetect); int16_t setDIOPreambleDetect(bool usePreambleDetect);
/*!
\brief Sets the RSSI value above which the RSSI interrupt is signaled
\param value A value between -127.5 and 0 inclusive
\returns \ref status_codes
*/
int16_t setRSSIThreshold(float value);
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL) #if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
protected: protected:
#endif #endif