From cd7adc03d7ccf09d1bbcd3149574fc236d333810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Grome=C5=A1?= Date: Sat, 14 Jul 2018 10:00:06 +0200 Subject: [PATCH] RF69 - Added method to disable address filtering --- keywords.txt | 2 ++ src/modules/RF69.cpp | 17 +++++++++++++++++ src/modules/RF69.h | 1 + 3 files changed, 20 insertions(+) diff --git a/keywords.txt b/keywords.txt index 2331c46f..35172581 100644 --- a/keywords.txt +++ b/keywords.txt @@ -32,6 +32,7 @@ HTTPClient KEYWORD1 # KiteLib ModuleA KEYWORD2 ModuleB KEYWORD2 +Module KEYWORD2 # SX1272/73/76/77/78/79 + RF69 dataRate KEYWORD2 @@ -54,6 +55,7 @@ setRxBandwidth KEYWORD2 setFrequencyDeviation KEYWORD2 setNodeAddress KEYWORD2 setBroadcastAddress KEYWORD2 +disableAddressFiltering KEYWORD2 # ESP8266 join KEYWORD2 diff --git a/src/modules/RF69.cpp b/src/modules/RF69.cpp index 310cb0ac..067e1473 100644 --- a/src/modules/RF69.cpp +++ b/src/modules/RF69.cpp @@ -433,6 +433,23 @@ uint8_t RF69::setBroadcastAddress(uint8_t broadAddr) { return(_mod->SPIsetRegValue(RF69_REG_BROADCAST_ADRS, broadAddr)); } +uint8_t RF69::disableAddressFiltering() { + // disable address filtering + uint8_t state = _mod->SPIsetRegValue(RF69_REG_PACKET_CONFIG_1, RF69_ADDRESS_FILTERING_OFF, 2, 1); + if(state != ERR_NONE) { + return(state); + } + + // set node address to default (0x00) + state = _mod->SPIsetRegValue(RF69_REG_NODE_ADRS, 0x00); + if(state != ERR_NONE) { + return(state); + } + + // set broadcast address to default (0x00) + return(_mod->SPIsetRegValue(RF69_REG_BROADCAST_ADRS, 0x00)); +} + uint8_t RF69::config() { uint8_t state = ERR_NONE; diff --git a/src/modules/RF69.h b/src/modules/RF69.h index d388feef..2c784db1 100644 --- a/src/modules/RF69.h +++ b/src/modules/RF69.h @@ -436,6 +436,7 @@ class RF69 { uint8_t setSyncWord(uint8_t* syncWord, size_t len, uint8_t maxErrBits = 0); uint8_t setNodeAddress(uint8_t nodeAddr); uint8_t setBroadcastAddress(uint8_t broadAddr); + uint8_t disableAddressFiltering(); protected: Module* _mod;