From f049a4bc987cfc8c17667ffed003d151b162f47f Mon Sep 17 00:00:00 2001 From: Christophe Painchaud Date: Thu, 18 Mar 2021 22:21:04 +0100 Subject: [PATCH] SX127x::setOokPeakThresholdDecrement --- src/modules/SX127x/SX127x.cpp | 12 ++++++++++++ src/modules/SX127x/SX127x.h | 11 ++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/modules/SX127x/SX127x.cpp b/src/modules/SX127x/SX127x.cpp index ef495e67..21bc79e7 100644 --- a/src/modules/SX127x/SX127x.cpp +++ b/src/modules/SX127x/SX127x.cpp @@ -860,6 +860,18 @@ int16_t SX127x::setOokFixedOrFloorThreshold(short int value) { return(state); } +int16_t SX127x::setOokPeakThresholdDecrement(short int value) { + // check active modem + if(getActiveModem() != SX127X_FSK_OOK) { + return(ERR_WRONG_MODEM); + } + + int16_t state = ERR_NONE; + state = _mod->SPIsetRegValue(SX127X_REG_OOK_AVG, value, 7, 5, 5); + + return(state); +} + int16_t SX127x::setOOK(bool enableOOK) { diff --git a/src/modules/SX127x/SX127x.h b/src/modules/SX127x/SX127x.h index 94a1bbcf..fae2b2d6 100644 --- a/src/modules/SX127x/SX127x.h +++ b/src/modules/SX127x/SX127x.h @@ -862,12 +862,21 @@ class SX127x: public PhysicalLayer { /*! \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 + \param type SX127X_OOK_THRESH_FIXED, SX127X_OOK_THRESH_PEAK(default), SX127X_OOK_THRESH_AVERAGE \returns \ref status_codes */ int16_t setOokThresholdType(uint8_t type); + /*! + \brief Period of decrement of the RSSI threshold in the OOK demodulator + + \param value use defines SX127X_OOK_PEAK_THRESH_DEC_X_X_CHIP + + \returns \ref status_codes + */ + int16_t setOokPeakThresholdDecrement(short int value); + /*! \brief Fixed threshold for the Data Slicer in OOK mode Floor threshold for the Data Slicer in OOK when Peak mode is used