From 76ddaf5f6747790820538f7de8afaaa46e4d6370 Mon Sep 17 00:00:00 2001 From: matthias-bs <83612361+matthias-bs@users.noreply.github.com> Date: Mon, 23 May 2022 17:32:58 +0200 Subject: [PATCH] added setCrcFiltering() --- src/modules/SX127x/SX127x.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/modules/SX127x/SX127x.cpp b/src/modules/SX127x/SX127x.cpp index 0ab12eff..08680c06 100644 --- a/src/modules/SX127x/SX127x.cpp +++ b/src/modules/SX127x/SX127x.cpp @@ -1045,6 +1045,16 @@ int16_t SX127x::variablePacketLengthMode(uint8_t maxLen) { return(SX127x::setPacketMode(RADIOLIB_SX127X_PACKET_VARIABLE, maxLen)); } +int16_t SX127x::setCrcFiltering(bool crcOn) { + _crcOn = crcOn; + + if (crcOn == true) { + return(_mod->SPIsetRegValue(RADIOLIB_SX127X_REG_PACKET_CONFIG_1, RADIOLIB_SX127X_CRC_ON, 4, 4)); + } else { + return(_mod->SPIsetRegValue(RADIOLIB_SX127X_REG_PACKET_CONFIG_1, RADIOLIB_SX127X_CRC_OFF, 4, 4)); + } +} + int16_t SX127x::setRSSIConfig(uint8_t smoothingSamples, int8_t offset) { // check active modem if(getActiveModem() != RADIOLIB_SX127X_FSK_OOK) {