Merge pull request #561 from obones/setRSSIThreshold
Introduce the setRSSIThreshold method
This commit is contained in:
commit
1bd9409bcf
5 changed files with 35 additions and 0 deletions
|
@ -213,6 +213,11 @@
|
|||
*/
|
||||
#define RADIOLIB_ERR_INVALID_DIO_PIN (-26)
|
||||
|
||||
/*!
|
||||
\brief The supplied RSSI threshold is invalid.
|
||||
*/
|
||||
#define RADIOLIB_ERR_INVALID_RSSI_THRESHOLD (-27)
|
||||
|
||||
// RF69-specific status codes
|
||||
|
||||
/*!
|
||||
|
|
|
@ -872,6 +872,12 @@ float RF69::getRSSI() {
|
|||
return(-1.0 * (_mod->SPIgetRegValue(RADIOLIB_RF69_REG_RSSI_VALUE)/2.0));
|
||||
}
|
||||
|
||||
int16_t RF69::setRSSIThreshold(float dbm) {
|
||||
RADIOLIB_CHECK_RANGE(dbm, -127.5, 0, RADIOLIB_ERR_INVALID_RSSI_THRESHOLD);
|
||||
|
||||
return _mod->SPIsetRegValue(RADIOLIB_RF69_REG_RSSI_THRESH, (uint8_t)(-2.0 * dbm), 7, 0);
|
||||
}
|
||||
|
||||
void RF69::setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn) {
|
||||
_mod->setRfSwitchPins(rxEn, txEn);
|
||||
}
|
||||
|
|
|
@ -961,6 +961,15 @@ class RF69: public PhysicalLayer {
|
|||
*/
|
||||
float getRSSI();
|
||||
|
||||
/*!
|
||||
\brief Sets the RSSI value above which the RSSI interrupt is signaled
|
||||
|
||||
\param dbm A dBm value between -127.5 and 0 inclusive
|
||||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setRSSIThreshold(float dbm);
|
||||
|
||||
/*!
|
||||
\brief Some modules contain external RF switch controlled by two pins. This function gives RadioLib control over those two pins to automatically switch Rx and Tx state.
|
||||
When using automatic RF switch control, DO NOT change the pin mode of rxEn or txEn from Arduino sketch!
|
||||
|
|
|
@ -1184,6 +1184,12 @@ int16_t SX127x::setCrcFiltering(bool crcOn) {
|
|||
}
|
||||
}
|
||||
|
||||
int16_t SX127x::setRSSIThreshold(float dbm) {
|
||||
RADIOLIB_CHECK_RANGE(dbm, -127.5, 0, RADIOLIB_ERR_INVALID_RSSI_THRESHOLD);
|
||||
|
||||
return _mod->SPIsetRegValue(RADIOLIB_SX127X_REG_RSSI_THRESH, (uint8_t)(-2.0 * dbm), 7, 0);
|
||||
}
|
||||
|
||||
int16_t SX127x::setRSSIConfig(uint8_t smoothingSamples, int8_t offset) {
|
||||
// check active modem
|
||||
if(getActiveModem() != RADIOLIB_SX127X_FSK_OOK) {
|
||||
|
|
|
@ -1227,6 +1227,15 @@ class SX127x: public PhysicalLayer {
|
|||
*/
|
||||
int16_t setDIOPreambleDetect(bool usePreambleDetect);
|
||||
|
||||
/*!
|
||||
\brief Sets the RSSI value above which the RSSI interrupt is signaled
|
||||
|
||||
\param dbm A dBm value between -127.5 and 0 inclusive
|
||||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setRSSIThreshold(float dbm);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
|
||||
protected:
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue