From 6f5ab06652b3f5941b0f0315acfc0613c3edea4c Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Mon, 7 Sep 2020 09:17:12 -0500 Subject: [PATCH 01/14] fix lora random added LoRandomSeed --- src/LoRa.cpp | 14 +++++++++++++- src/LoRa.h | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/LoRa.cpp b/src/LoRa.cpp index 4396518..1cba0a2 100644 --- a/src/LoRa.cpp +++ b/src/LoRa.cpp @@ -607,9 +607,21 @@ void LoRaClass::setOCP(uint8_t mA) writeRegister(REG_OCP, 0x20 | (0x1F & ocpTrim)); } +void LoRaClass::LoRandomSeed() { + writeRegister(REG_OP_MODE, 0b10001101); + writeRegister(REG_MODEM_CONFIG_1, 0b01110010); + writeRegister(REG_MODEM_CONFIG_2, 0b01110000); +} + byte LoRaClass::random() { - return readRegister(REG_RSSI_WIDEBAND); + uint8_t x = 0; + for (uint8_t j = 0; j < 8; j++) { + x += (readRegister(REG_RSSI_WIDEBAND) & 0b00000001); + x = x << 1; + delay(1); + } + return x; } void LoRaClass::setPins(int ss, int reset, int dio0) diff --git a/src/LoRa.h b/src/LoRa.h index c1671c1..634868d 100644 --- a/src/LoRa.h +++ b/src/LoRa.h @@ -81,7 +81,8 @@ class LoRaClass : public Stream { // deprecated void crc() { enableCrc(); } void noCrc() { disableCrc(); } - + + void LoRandomSeed(); byte random(); void setPins(int ss = LORA_DEFAULT_SS_PIN, int reset = LORA_DEFAULT_RESET_PIN, int dio0 = LORA_DEFAULT_DIO0_PIN); From 4d8f70036850128ffb52ec0b3de8ab7dfe7f1b39 Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Mon, 7 Sep 2020 09:24:55 -0500 Subject: [PATCH 02/14] Add example LoRandom --- examples/LoRandom/LoRandom.ino | 88 ++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 examples/LoRandom/LoRandom.ino diff --git a/examples/LoRandom/LoRandom.ino b/examples/LoRandom/LoRandom.ino new file mode 100644 index 0000000..8d69fa9 --- /dev/null +++ b/examples/LoRandom/LoRandom.ino @@ -0,0 +1,88 @@ +/* + LoRandomSeed + + Example demonstrating how to generate random numbers using LoRa. + + created 7 Sep 2020 + by Konduino + adapted by Andres Sabas + + SX1276 Register (address) Register bit field (bit #) Values Note + RegOpMode (0x01) LongRangeMode[7] ‘1’ LoRa mode enable + Mode[2:0] ‘101’ Receive Continuous mode + ------------------------------------------------------------------------------------------------------------------ + RegModemConfig1 (0x1D) Bw[7:4] ‘0111’ ‘0111’ for 125kHz modulation Bandwidth + CodingRate[3:1] ‘001’ 4/5 error coding rate + ImplicitHeaderModeOn[0] ‘0’ Packets have up-front header + ------------------------------------------------------------------------------------------------------------------ + RegModemConfig2 (0x1E) SpreadingFactor[7:4] ‘0111’ ‘0111’ (SF7) = 6kbit/s + + To generate an N bit random number, perform N read operation of the register RegRssiWideband (address 0x2c) + and use the LSB of the fetched value. The value from RegRssiWideband is derived from a wideband (4MHz) signal strength + at the receiver input and the LSB of this value constantly and randomly changes. +*/ + +#include +#include + +void hexDump(unsigned char *buf, uint16_t len) { + String s = "|", t = "| |"; + Serial.println(F(" |.0 .1 .2 .3 .4 .5 .6 .7 .8 .9 .a .b .c .d .e .f |")); + Serial.println(F(" +------------------------------------------------+ +----------------+")); + for (uint16_t i = 0; i < len; i += 16) { + for (uint8_t j = 0; j < 16; j++) { + if (i + j >= len) { + s = s + " "; t = t + " "; + } else { + char c = buf[i + j]; + if (c < 16) s = s + "0"; + s = s + String(c, HEX) + " "; + if (c < 32 || c > 127) t = t + "."; + else t = t + (char)c; + } + } + uint8_t index = i / 16; + Serial.print(index, HEX); Serial.write('.'); + Serial.println(s + t + "|"); + s = "|"; t = "| |"; + } + Serial.println(F(" +------------------------------------------------+ +----------------+")); +} + +void setup() { + Serial.begin(115200); + while(!Serial); + Serial.print(F("\n\n\n[SX1276] Initializing ... ")); + LoRa.setPins(SS, RFM_RST, RFM_DIO0); + Serial.println("SS: " + String(SS)); + Serial.println("RFM_RST: " + String(RFM_RST)); + Serial.println("RFM_DIO0: " + String(RFM_DIO0)); + Serial.println("RFM_SWITCH: " + String(RFM_SWITCH)); + if (!LoRa.begin(868E6)) { + Serial.println("Starting LoRa failed!"); + while (1); + } + Serial.print("Setting up LoRa "); + pinMode(RFM_SWITCH, OUTPUT); + digitalWrite(RFM_SWITCH, 1); + LoRa.setTxPower(20, PA_OUTPUT_PA_BOOST_PIN); + LoRa.setPreambleLength(8); + LoRa.LoRandomSeed(); + Serial.println("[o]"); + delay(1000); + Serial.println("End of setup\n\n"); +} + +void loop() { + unsigned char randomStock[256]; + // We'll build a stock of random bytes for use in code + uint8_t randomIndex = 0; + uint16_t i; + for (i = 0; i < 256; i++) { + uint8_t x = LoRa.random(); + randomStock[i] = x; + } + randomIndex = 0; + hexDump(randomStock, 256); + delay(2000); +} From ebe3bfd2609ac96e45fff1f9e354857372005a75 Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Mon, 7 Sep 2020 10:33:08 -0500 Subject: [PATCH 03/14] numbers to hex --- src/LoRa.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/LoRa.cpp b/src/LoRa.cpp index 1cba0a2..2a1a074 100644 --- a/src/LoRa.cpp +++ b/src/LoRa.cpp @@ -608,16 +608,16 @@ void LoRaClass::setOCP(uint8_t mA) } void LoRaClass::LoRandomSeed() { - writeRegister(REG_OP_MODE, 0b10001101); - writeRegister(REG_MODEM_CONFIG_1, 0b01110010); - writeRegister(REG_MODEM_CONFIG_2, 0b01110000); + writeRegister(REG_OP_MODE, 0x72); + writeRegister(REG_MODEM_CONFIG_1, 0x72); + writeRegister(REG_MODEM_CONFIG_2, 0x70); } byte LoRaClass::random() { uint8_t x = 0; for (uint8_t j = 0; j < 8; j++) { - x += (readRegister(REG_RSSI_WIDEBAND) & 0b00000001); + x += (readRegister(REG_RSSI_WIDEBAND) & 0x01); x = x << 1; delay(1); } From 318627bdcd0f623983d79272ee7f9cb25d0daf15 Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Mon, 7 Sep 2020 10:34:28 -0500 Subject: [PATCH 04/14] define for SAMR34 --- examples/LoRandom/LoRandom.ino | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/LoRandom/LoRandom.ino b/examples/LoRandom/LoRandom.ino index 8d69fa9..b40a0b9 100644 --- a/examples/LoRandom/LoRandom.ino +++ b/examples/LoRandom/LoRandom.ino @@ -63,8 +63,12 @@ void setup() { while (1); } Serial.print("Setting up LoRa "); + + ifdef SAMR34 pinMode(RFM_SWITCH, OUTPUT); digitalWrite(RFM_SWITCH, 1); + #endif + LoRa.setTxPower(20, PA_OUTPUT_PA_BOOST_PIN); LoRa.setPreambleLength(8); LoRa.LoRandomSeed(); From 4d7262001985cb5ef301c45c9f4afd6d69ab912f Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Mon, 7 Sep 2020 14:09:18 -0500 Subject: [PATCH 05/14] fix typo --- examples/LoRandom/LoRandom.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/LoRandom/LoRandom.ino b/examples/LoRandom/LoRandom.ino index b40a0b9..6f302d0 100644 --- a/examples/LoRandom/LoRandom.ino +++ b/examples/LoRandom/LoRandom.ino @@ -64,7 +64,7 @@ void setup() { } Serial.print("Setting up LoRa "); - ifdef SAMR34 + #ifdef SAMR34 pinMode(RFM_SWITCH, OUTPUT); digitalWrite(RFM_SWITCH, 1); #endif From b51bf9f01bc26b1a51bb670d6bcedd69af919cb5 Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Mon, 7 Sep 2020 15:56:08 -0500 Subject: [PATCH 06/14] fix name --- examples/LoRandom/LoRandom.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/LoRandom/LoRandom.ino b/examples/LoRandom/LoRandom.ino index 6f302d0..2b47fbb 100644 --- a/examples/LoRandom/LoRandom.ino +++ b/examples/LoRandom/LoRandom.ino @@ -4,7 +4,7 @@ Example demonstrating how to generate random numbers using LoRa. created 7 Sep 2020 - by Konduino + by Kongduino adapted by Andres Sabas SX1276 Register (address) Register bit field (bit #) Values Note From 4753838984a670d1075a086a2eef8d282ca0cb5a Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Thu, 10 Sep 2020 12:11:17 -0500 Subject: [PATCH 07/14] Added function beginRandom --- API.md | 8 ++++++++ keywords.txt | 1 + src/LoRa.cpp | 3 +-- src/LoRa.h | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/API.md b/API.md index 2d86815..fc712b3 100644 --- a/API.md +++ b/API.md @@ -366,6 +366,14 @@ LoRa.disableInvertIQ(); ## Other functions +### beginRandom + +Initializes the random number generator. + +``` +LoRa.beginRandom(); +``` + ### Random Generate a random byte, based on the Wideband RSSI measurement. diff --git a/keywords.txt b/keywords.txt index 63e0e9a..5d3bde3 100644 --- a/keywords.txt +++ b/keywords.txt @@ -48,6 +48,7 @@ disableCrc KEYWORD2 enableInvertIQ KEYWORD2 disableInvertIQ KEYWORD2 +beginRandom KEYWORD2 random KEYWORD2 setPins KEYWORD2 setSPIFrequency KEYWORD2 diff --git a/src/LoRa.cpp b/src/LoRa.cpp index 2a1a074..8740348 100644 --- a/src/LoRa.cpp +++ b/src/LoRa.cpp @@ -607,7 +607,7 @@ void LoRaClass::setOCP(uint8_t mA) writeRegister(REG_OCP, 0x20 | (0x1F & ocpTrim)); } -void LoRaClass::LoRandomSeed() { +void LoRaClass::beginRandom() { writeRegister(REG_OP_MODE, 0x72); writeRegister(REG_MODEM_CONFIG_1, 0x72); writeRegister(REG_MODEM_CONFIG_2, 0x70); @@ -619,7 +619,6 @@ byte LoRaClass::random() for (uint8_t j = 0; j < 8; j++) { x += (readRegister(REG_RSSI_WIDEBAND) & 0x01); x = x << 1; - delay(1); } return x; } diff --git a/src/LoRa.h b/src/LoRa.h index 634868d..a7ed0d2 100644 --- a/src/LoRa.h +++ b/src/LoRa.h @@ -82,7 +82,7 @@ class LoRaClass : public Stream { void crc() { enableCrc(); } void noCrc() { disableCrc(); } - void LoRandomSeed(); + void beginRandom(); byte random(); void setPins(int ss = LORA_DEFAULT_SS_PIN, int reset = LORA_DEFAULT_RESET_PIN, int dio0 = LORA_DEFAULT_DIO0_PIN); From 28c5431c7dc4db78b770598696b6c30d339d5b93 Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Thu, 10 Sep 2020 12:11:52 -0500 Subject: [PATCH 08/14] Fix example --- examples/LoRandom/LoRandom.ino | 87 ++++++++++++---------------------- 1 file changed, 31 insertions(+), 56 deletions(-) diff --git a/examples/LoRandom/LoRandom.ino b/examples/LoRandom/LoRandom.ino index 2b47fbb..43da39c 100644 --- a/examples/LoRandom/LoRandom.ino +++ b/examples/LoRandom/LoRandom.ino @@ -1,4 +1,4 @@ -/* +/******************************************************************** LoRandomSeed Example demonstrating how to generate random numbers using LoRa. @@ -6,87 +6,62 @@ created 7 Sep 2020 by Kongduino adapted by Andres Sabas - - SX1276 Register (address) Register bit field (bit #) Values Note - RegOpMode (0x01) LongRangeMode[7] ‘1’ LoRa mode enable - Mode[2:0] ‘101’ Receive Continuous mode - ------------------------------------------------------------------------------------------------------------------ - RegModemConfig1 (0x1D) Bw[7:4] ‘0111’ ‘0111’ for 125kHz modulation Bandwidth - CodingRate[3:1] ‘001’ 4/5 error coding rate - ImplicitHeaderModeOn[0] ‘0’ Packets have up-front header - ------------------------------------------------------------------------------------------------------------------ - RegModemConfig2 (0x1E) SpreadingFactor[7:4] ‘0111’ ‘0111’ (SF7) = 6kbit/s - - To generate an N bit random number, perform N read operation of the register RegRssiWideband (address 0x2c) - and use the LSB of the fetched value. The value from RegRssiWideband is derived from a wideband (4MHz) signal strength - at the receiver input and the LSB of this value constantly and randomly changes. -*/ +***********************************************************************/ #include #include -void hexDump(unsigned char *buf, uint16_t len) { - String s = "|", t = "| |"; - Serial.println(F(" |.0 .1 .2 .3 .4 .5 .6 .7 .8 .9 .a .b .c .d .e .f |")); - Serial.println(F(" +------------------------------------------------+ +----------------+")); - for (uint16_t i = 0; i < len; i += 16) { - for (uint8_t j = 0; j < 16; j++) { - if (i + j >= len) { - s = s + " "; t = t + " "; - } else { - char c = buf[i + j]; - if (c < 16) s = s + "0"; - s = s + String(c, HEX) + " "; - if (c < 32 || c > 127) t = t + "."; - else t = t + (char)c; - } - } - uint8_t index = i / 16; - Serial.print(index, HEX); Serial.write('.'); - Serial.println(s + t + "|"); - s = "|"; t = "| |"; - } - Serial.println(F(" +------------------------------------------------+ +----------------+")); -} - void setup() { - Serial.begin(115200); + Serial.begin(9600); while(!Serial); Serial.print(F("\n\n\n[SX1276] Initializing ... ")); LoRa.setPins(SS, RFM_RST, RFM_DIO0); - Serial.println("SS: " + String(SS)); - Serial.println("RFM_RST: " + String(RFM_RST)); - Serial.println("RFM_DIO0: " + String(RFM_DIO0)); - Serial.println("RFM_SWITCH: " + String(RFM_SWITCH)); if (!LoRa.begin(868E6)) { Serial.println("Starting LoRa failed!"); while (1); } Serial.print("Setting up LoRa "); - #ifdef SAMR34 - pinMode(RFM_SWITCH, OUTPUT); - digitalWrite(RFM_SWITCH, 1); - #endif - LoRa.setTxPower(20, PA_OUTPUT_PA_BOOST_PIN); LoRa.setPreambleLength(8); - LoRa.LoRandomSeed(); - Serial.println("[o]"); - delay(1000); + LoRa.beginRandom(); Serial.println("End of setup\n\n"); } void loop() { - unsigned char randomStock[256]; + byte randomBytes[256]; // We'll build a stock of random bytes for use in code uint8_t randomIndex = 0; uint16_t i; for (i = 0; i < 256; i++) { uint8_t x = LoRa.random(); - randomStock[i] = x; + randomBytes[i] = x; } randomIndex = 0; - hexDump(randomStock, 256); + hexDump(randomBytes, 256); delay(2000); } + +void hexDump(unsigned char *buf, uint16_t len) { + String s = "|", t = "| |"; + Serial.println(F(" |.0 .1 .2 .3 .4 .5 .6 .7 .8 .9 .a .b .c .d .e .f |")); + Serial.println(F(" +------------------------------------------------+ +----------------+")); + for (uint16_t i = 0; i < len; i += 16) { + for (uint8_t j = 0; j < 16; j++) { + if (i + j >= len) { + s = s + " "; t = t + " "; + } else { + char c = buf[i + j]; + if (c < 16) s = s + "0"; + s = s + String(c, HEX) + " "; + if (c < 32 || c > 127) t = t + "."; + else t = t + (String(c)); + } + } + int index = i / 16; + Serial.print(index, HEX); Serial.write('.'); + Serial.println(s + t + "|"); + s = "|"; t = "| |"; + } + Serial.println(F(" +------------------------------------------------+ +----------------+")); +} \ No newline at end of file From 507cf039b6c5d4abfd167b6321a7e0b0d8a4169d Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Thu, 10 Sep 2020 12:12:08 -0500 Subject: [PATCH 09/14] Added travis example LoRandom --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b574b4e..43f50ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,3 +37,4 @@ script: - buildExampleSketch LoRaSenderNonBlocking - buildExampleSketch LoRaSetSpread - buildExampleSketch LoRaSetSyncWord + - buildExampleSketch LoRandom From 3ce7be104a96dc9fb8fbd9d5fa642966939bc770 Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Wed, 23 Sep 2020 12:26:45 -0500 Subject: [PATCH 10/14] remove define pins --- examples/LoRandom/LoRandom.ino | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/LoRandom/LoRandom.ino b/examples/LoRandom/LoRandom.ino index 43da39c..2a2faef 100644 --- a/examples/LoRandom/LoRandom.ino +++ b/examples/LoRandom/LoRandom.ino @@ -15,7 +15,6 @@ void setup() { Serial.begin(9600); while(!Serial); Serial.print(F("\n\n\n[SX1276] Initializing ... ")); - LoRa.setPins(SS, RFM_RST, RFM_DIO0); if (!LoRa.begin(868E6)) { Serial.println("Starting LoRa failed!"); while (1); From 449e0e185ec47abb894ef5405a34e8097564c920 Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Thu, 8 Oct 2020 23:24:43 -0500 Subject: [PATCH 11/14] re-use existing API's added continuosMode(); --- src/LoRa.cpp | 12 +++++++++--- src/LoRa.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/LoRa.cpp b/src/LoRa.cpp index 8740348..ee7f784 100644 --- a/src/LoRa.cpp +++ b/src/LoRa.cpp @@ -412,6 +412,11 @@ void LoRaClass::sleep() writeRegister(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_SLEEP); } +void LoRaClass::continuosMode() +{ + writeRegister(REG_OP_MODE, 0x72); +} + void LoRaClass::setTxPower(int level, int outputPin) { if (PA_OUTPUT_RFO_PIN == outputPin) { @@ -608,9 +613,10 @@ void LoRaClass::setOCP(uint8_t mA) } void LoRaClass::beginRandom() { - writeRegister(REG_OP_MODE, 0x72); - writeRegister(REG_MODEM_CONFIG_1, 0x72); - writeRegister(REG_MODEM_CONFIG_2, 0x70); + continuosMode(); + setSignalBandwidth(125E3); + setCodingRate4(5); + setSpreadingFactor(7); } byte LoRaClass::random() diff --git a/src/LoRa.h b/src/LoRa.h index a7ed0d2..491bc18 100644 --- a/src/LoRa.h +++ b/src/LoRa.h @@ -63,6 +63,7 @@ class LoRaClass : public Stream { #endif void idle(); void sleep(); + void continuosMode(); void setTxPower(int level, int outputPin = PA_OUTPUT_PA_BOOST_PIN); void setFrequency(long frequency); From cc721bfe8f23925a591846c9c3a03e732e275bc2 Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Thu, 8 Oct 2020 23:27:31 -0500 Subject: [PATCH 12/14] Fix types variables --- examples/LoRandom/LoRandom.ino | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/LoRandom/LoRandom.ino b/examples/LoRandom/LoRandom.ino index 2a2faef..2ffd8d8 100644 --- a/examples/LoRandom/LoRandom.ino +++ b/examples/LoRandom/LoRandom.ino @@ -30,10 +30,10 @@ void setup() { void loop() { byte randomBytes[256]; // We'll build a stock of random bytes for use in code - uint8_t randomIndex = 0; - uint16_t i; + int randomIndex = 0; + unsigned int i; for (i = 0; i < 256; i++) { - uint8_t x = LoRa.random(); + int x = LoRa.random(); randomBytes[i] = x; } randomIndex = 0; @@ -41,12 +41,12 @@ void loop() { delay(2000); } -void hexDump(unsigned char *buf, uint16_t len) { +void hexDump(unsigned char *buf, unsigned int len) { String s = "|", t = "| |"; Serial.println(F(" |.0 .1 .2 .3 .4 .5 .6 .7 .8 .9 .a .b .c .d .e .f |")); Serial.println(F(" +------------------------------------------------+ +----------------+")); - for (uint16_t i = 0; i < len; i += 16) { - for (uint8_t j = 0; j < 16; j++) { + for ( unsigned int i = 0; i < len; i += 16) { + for (int j = 0; j < 16; j++) { if (i + j >= len) { s = s + " "; t = t + " "; } else { From 26ee29472833c4d848de4859054e7a9088d52430 Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Sat, 10 Oct 2020 14:06:52 -0500 Subject: [PATCH 13/14] fix typo in method name --- src/LoRa.cpp | 4 ++-- src/LoRa.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/LoRa.cpp b/src/LoRa.cpp index ee7f784..c8d67ef 100644 --- a/src/LoRa.cpp +++ b/src/LoRa.cpp @@ -412,7 +412,7 @@ void LoRaClass::sleep() writeRegister(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_SLEEP); } -void LoRaClass::continuosMode() +void LoRaClass::continuousMode() { writeRegister(REG_OP_MODE, 0x72); } @@ -613,7 +613,7 @@ void LoRaClass::setOCP(uint8_t mA) } void LoRaClass::beginRandom() { - continuosMode(); + continuousMode(); setSignalBandwidth(125E3); setCodingRate4(5); setSpreadingFactor(7); diff --git a/src/LoRa.h b/src/LoRa.h index 491bc18..330a58a 100644 --- a/src/LoRa.h +++ b/src/LoRa.h @@ -63,7 +63,7 @@ class LoRaClass : public Stream { #endif void idle(); void sleep(); - void continuosMode(); + void continuousMode(); void setTxPower(int level, int outputPin = PA_OUTPUT_PA_BOOST_PIN); void setFrequency(long frequency); From 522fbb814114f04df98741b3638cb0b4ee7772cd Mon Sep 17 00:00:00 2001 From: sabas1080 Date: Mon, 12 Oct 2020 09:17:29 -0500 Subject: [PATCH 14/14] renaming continuousRxMode --- src/LoRa.cpp | 4 ++-- src/LoRa.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/LoRa.cpp b/src/LoRa.cpp index c8d67ef..e69e089 100644 --- a/src/LoRa.cpp +++ b/src/LoRa.cpp @@ -412,7 +412,7 @@ void LoRaClass::sleep() writeRegister(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_SLEEP); } -void LoRaClass::continuousMode() +void LoRaClass::continuousRxMode() { writeRegister(REG_OP_MODE, 0x72); } @@ -613,7 +613,7 @@ void LoRaClass::setOCP(uint8_t mA) } void LoRaClass::beginRandom() { - continuousMode(); + continuousRxMode(); setSignalBandwidth(125E3); setCodingRate4(5); setSpreadingFactor(7); diff --git a/src/LoRa.h b/src/LoRa.h index 330a58a..8860256 100644 --- a/src/LoRa.h +++ b/src/LoRa.h @@ -63,7 +63,6 @@ class LoRaClass : public Stream { #endif void idle(); void sleep(); - void continuousMode(); void setTxPower(int level, int outputPin = PA_OUTPUT_PA_BOOST_PIN); void setFrequency(long frequency); @@ -110,6 +109,8 @@ class LoRaClass : public Stream { static void onDio0Rise(); + void continuousRxMode(); + private: SPISettings _spiSettings; SPIClass* _spi;