diff --git a/src/modules/SX127x/SX127x.cpp b/src/modules/SX127x/SX127x.cpp index 2fac82e7..dc150637 100644 --- a/src/modules/SX127x/SX127x.cpp +++ b/src/modules/SX127x/SX127x.cpp @@ -836,6 +836,19 @@ int16_t SX127x::disableAddressFiltering() { return(_mod->SPIsetRegValue(SX127X_REG_BROADCAST_ADRS, 0x00)); } +int16_t SX127x::setOokThresholdType(uint8_t type) { + // check active modem + if(getActiveModem() != SX127X_FSK_OOK) { + return(ERR_WRONG_MODEM); + } + + int16_t state = ERR_NONE; + state = _mod->SPIsetRegValue(SX127X_REG_OOK_PEAK, type, 4, 3, 5); + + return(state); +} + + int16_t SX127x::setOOK(bool enableOOK) { // check active modem if(getActiveModem() != SX127X_FSK_OOK) { diff --git a/src/modules/SX127x/SX127x.h b/src/modules/SX127x/SX127x.h index 90425b79..49170d51 100644 --- a/src/modules/SX127x/SX127x.h +++ b/src/modules/SX127x/SX127x.h @@ -859,6 +859,16 @@ class SX127x: public PhysicalLayer { */ int16_t setOOK(bool enableOOK); + /*! + \brief Selects the type of threshold in the OOK data slicer + + \param SX127X_OOK_THRESH_FIXED, SX127X_OOK_THRESH_PEAK(default), SX127X_OOK_THRESH_AVERAGE + + \returns \ref status_codes + */ + int16_t setOokThresholdType(uint8_t type); + + /*! \brief Query modem for the packet length of received payload.