added RF69::setOokThresholdType

This commit is contained in:
Christophe Painchaud 2021-03-24 18:05:32 +01:00
parent 97cdce7b64
commit 7b6f1d075a
3 changed files with 23 additions and 0 deletions

View file

@ -325,6 +325,11 @@
*/
#define ERR_INVALID_MODULATION -107
/*!
\brief Supplied Peak type is invalid.
*/
#define ERR_INVALID_OOK_RSSI_PEAK_TYPE -108
// ESP8266 status codes
/*!

View file

@ -384,6 +384,16 @@ int16_t RF69::setOOK(bool enableOOK) {
return(state);
}
int16_t RF69::setOokThresholdType(uint8_t type) {
if(type != RF69_OOK_THRESH_FIXED && type != RF69_OOK_THRESH_PEAK && RF69_OOK_THRESH_AVERAGE)
return ERR_INVALID_OOK_RSSI_PEAK_TYPE;
int16_t state = ERR_NONE;
state = _mod->SPIsetRegValue(RF69_REG_OOK_PEAK, type, 7, 3, 5);
return(state);
}
int16_t RF69::setFrequency(float freq) {
// check allowed frequency range
if(!(((freq > 290.0) && (freq < 340.0)) ||

View file

@ -748,6 +748,14 @@ class RF69: public PhysicalLayer {
*/
int16_t setOOK(bool enableOOK);
/*!
\brief Selects the type of threshold in the OOK data slicer
\param type RF69_OOK_THRESH_FIXED RF69_OOK_THRESH_PEAK(default) RF69_OOK_THRESH_AVERAGE
\returns \ref status_codes
*/
int16_t setOokThresholdType(uint8_t type);
/*!
\brief Set modem in fixed packet length mode.