diff --git a/keywords.txt b/keywords.txt index 8548153e..097cf08a 100644 --- a/keywords.txt +++ b/keywords.txt @@ -147,6 +147,8 @@ setOokFixedOrFloorThreshold KEYWORD2 setDirectSyncWord KEYWORD2 setDirectAction KEYWORD2 readBit KEYWORD2 +enableBitSync KEYWORD2 +disableBitSync KEYWORD2 # RF69-specific setAESKey KEYWORD2 @@ -154,7 +156,10 @@ enableAES KEYWORD2 disableAES KEYWORD2 getTemperature KEYWORD2 setAmbientTemperature KEYWORD2 -setLnaTestBoost KEYWORD2 +setLnaTestBoost KEYWORD2 +setOokFixedThreshold KEYWORD2 +enableContinuousModeBitSync KEYWORD2 +disableContinuousModeBitSync KEYWORD2 # CC1101-specific getLQI KEYWORD2 diff --git a/src/modules/RF69/RF69.cpp b/src/modules/RF69/RF69.cpp index 9b96143a..74a1a4a3 100644 --- a/src/modules/RF69/RF69.cpp +++ b/src/modules/RF69/RF69.cpp @@ -388,6 +388,14 @@ int16_t RF69::setOokThresholdType(uint8_t type) { return(_mod->SPIsetRegValue(RF69_REG_OOK_PEAK, type, 7, 3, 5)); } +int16_t RF69::setOokFixedThreshold(uint8_t value) { + return(_mod->SPIsetRegValue(RF69_REG_OOK_FIX, value, 7, 0, 5)); +} + +int16_t RF69::setOokPeakThresholdDecrement(uint8_t value) { + return(_mod->SPIsetRegValue(RF69_REG_OOK_PEAK, value, 2, 0, 5)); +} + int16_t RF69::setFrequency(float freq) { // check allowed frequency range if(!(((freq > 290.0) && (freq < 340.0)) || @@ -712,6 +720,14 @@ int16_t RF69::disableSyncWordFiltering() { return(state); } +int16_t RF69::enableContinuousModeBitSync() { + return(_mod->SPIsetRegValue(RF69_REG_DATA_MODUL, RF69_CONTINUOUS_MODE_WITH_SYNC, 6, 5)); +} + +int16_t RF69::disableContinuousModeBitSync() { + return(_mod->SPIsetRegValue(RF69_REG_DATA_MODUL, RF69_CONTINUOUS_MODE, 6, 5)); +} + int16_t RF69::setCrcFiltering(bool crcOn) { if (crcOn == true) { return(_mod->SPIsetRegValue(RF69_REG_PACKET_CONFIG_1, RF69_CRC_ON, 4, 4)); diff --git a/src/modules/RF69/RF69.h b/src/modules/RF69/RF69.h index d2acc5e8..c2f6b041 100644 --- a/src/modules/RF69/RF69.h +++ b/src/modules/RF69/RF69.h @@ -757,6 +757,24 @@ class RF69: public PhysicalLayer { */ int16_t setOokThresholdType(uint8_t type); + /*! + \brief Fixed threshold for the Data Slicer in OOK mode or floor threshold for the Data Slicer in OOK when Peak mode is used. + + \param value Fixed threshold value (in dB) in the OOK demodulator. Used when OokThresType = RF69_OOK_THRESH_FIXED. + + \returns \ref status_codes + */ + int16_t setOokFixedThreshold(uint8_t value); + + /*! + \brief Period of decrement of the RSSI threshold in the OOK demodulator. + + \param value Use defines RF69_OOK_PEAK_THRESH_DEC_X_X_CHIP + + \returns \ref status_codes + */ + int16_t setOokPeakThresholdDecrement(uint8_t value); + /*! \brief Set modem in fixed packet length mode. @@ -791,6 +809,20 @@ class RF69: public PhysicalLayer { */ int16_t disableSyncWordFiltering(); + /*! + \brief Enable Bit synchronization in continuous mode. + + \returns \ref status_codes + */ + int16_t enableContinuousModeBitSync(); + + /*! + \brief Disable Bit synchronization in continuous mode. + + \returns \ref status_codes + */ + int16_t disableContinuousModeBitSync(); + /*! \brief Enable CRC filtering and generation. diff --git a/src/modules/SX127x/SX127x.cpp b/src/modules/SX127x/SX127x.cpp index 81c24eef..07eae0e7 100644 --- a/src/modules/SX127x/SX127x.cpp +++ b/src/modules/SX127x/SX127x.cpp @@ -939,6 +939,14 @@ int16_t SX127x::setOokPeakThresholdDecrement(uint8_t value) { return(_mod->SPIsetRegValue(SX127X_REG_OOK_AVG, value, 7, 5, 5)); } +int16_t SX127x::enableBitSync() { + return(_mod->SPIsetRegValue(SX127X_REG_OOK_PEAK, SX127X_BIT_SYNC_ON, 5, 5, 5)); +} + +int16_t SX127x::disableBitSync() { + return(_mod->SPIsetRegValue(SX127X_REG_OOK_PEAK, SX127X_BIT_SYNC_OFF, 5, 5, 5)); +} + 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 bde973ac..50f8a308 100644 --- a/src/modules/SX127x/SX127x.h +++ b/src/modules/SX127x/SX127x.h @@ -921,13 +921,27 @@ class SX127x: public PhysicalLayer { /*! \brief Fixed threshold for the Data Slicer in OOK mode or floor threshold for the Data Slicer in OOK when Peak mode is used. - \param value The actual value used by teh data slicer is (128 - value/2). + \param value The actual value is devided by 2 because (0.5db step). ie: value=12 means 6dB \returns \ref status_codes */ int16_t setOokFixedOrFloorThreshold(uint8_t value); - /*! + /*! + \brief Enable Bit synchronizer. + + \returns \ref status_codes + */ + int16_t enableBitSync(); + + /*! + \brief Disable Bit synchronizer (not allowed in Packet mode). + + \returns \ref status_codes + */ + int16_t disableBitSync(); + + /*! \brief Query modem for the packet length of received payload. \param update Update received packet length. Will return cached value when set to false.