From dc904b3bd2233ba267ba94ee6fa9769754f78205 Mon Sep 17 00:00:00 2001 From: "Fred N. van Kempen" Date: Sat, 25 May 2024 20:17:44 -0500 Subject: [PATCH 1/4] Update README.md Updated link to frequencies-by-countries list. --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 9663b61..ab723ad 100644 --- a/README.md +++ b/README.md @@ -81,8 +81,7 @@ This library exposes the LoRa radio directly, and allows you to send data to any No, you have to manage it by your self. **6) Which frequencies can I use?** - -You can use [this table](https://www.thethingsnetwork.org/wiki/LoRaWAN/Frequencies/By-Country) to lookup the available frequencies by your country. The selectable frequency also depends on your hardware. You can lookup the data sheet or ask your supplier. +You can use [this table](https://www.thethingsnetwork.org/docs/lorawan/frequencies/by-country/) to lookup the available frequencies by your country. The selectable frequency also depends on your hardware. You can lookup the data sheet or ask your supplier. Please also notice the frequency dependent duty cycles for legal reasons! From 266873a8b923361040072b0eaf2739728e7db32f Mon Sep 17 00:00:00 2001 From: "Fred N. van Kempen" Date: Sat, 25 May 2024 20:18:43 -0500 Subject: [PATCH 2/4] Update README.md Grr, typo. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ab723ad..004faef 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ This library exposes the LoRa radio directly, and allows you to send data to any No, you have to manage it by your self. **6) Which frequencies can I use?** -You can use [this table](https://www.thethingsnetwork.org/docs/lorawan/frequencies/by-country/) to lookup the available frequencies by your country. The selectable frequency also depends on your hardware. You can lookup the data sheet or ask your supplier. +You can use [this table](https://www.thethingsnetwork.org/docs/lorawan/frequencies-by-country/) to lookup the available frequencies by your country. The selectable frequency also depends on your hardware. You can lookup the data sheet or ask your supplier. Please also notice the frequency dependent duty cycles for legal reasons! From a4922b44fa96b86cd3891a3f258b9b4c7b883811 Mon Sep 17 00:00:00 2001 From: "Fred N. van Kempen" Date: Sat, 26 Apr 2025 15:29:33 -0400 Subject: [PATCH 3/4] Moved two get/set functions from private to public, added getTxPower function. --- keywords.txt | 3 +++ library.properties | 2 +- src/LoRa.cpp | 12 ++++++++++++ src/LoRa.h | 8 +++++--- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/keywords.txt b/keywords.txt index 6b65872..1dc1074 100644 --- a/keywords.txt +++ b/keywords.txt @@ -40,6 +40,9 @@ receive KEYWORD2 idle KEYWORD2 sleep KEYWORD2 +getTxPower KEYWORD2 +getSpreadingFactor KEYWORD2 +getSignalBandwidth KEYWORD2 setTxPower KEYWORD2 setFrequency KEYWORD2 setSpreadingFactor KEYWORD2 diff --git a/library.properties b/library.properties index e869420..90941d9 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=LoRa -version=0.8.0 +version=0.8.1 author=Sandeep Mistry maintainer=Sandeep Mistry sentence=An Arduino library for sending and receiving data using LoRa radios. diff --git a/src/LoRa.cpp b/src/LoRa.cpp index a16e55e..7e2094b 100644 --- a/src/LoRa.cpp +++ b/src/LoRa.cpp @@ -450,6 +450,11 @@ void LoRaClass::sleep() writeRegister(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_SLEEP); } +int LoRaClass::getTxPower() +{ + return _level; +} + void LoRaClass::setTxPower(int level, int outputPin) { if (PA_OUTPUT_RFO_PIN == outputPin) { @@ -460,6 +465,8 @@ void LoRaClass::setTxPower(int level, int outputPin) level = 14; } + _level = level; + writeRegister(REG_PA_CONFIG, 0x70 | level); } else { // PA BOOST @@ -468,6 +475,8 @@ void LoRaClass::setTxPower(int level, int outputPin) level = 20; } + _level = level; + // subtract 3 from level, so 18 - 20 maps to 15 - 17 level -= 3; @@ -478,6 +487,9 @@ void LoRaClass::setTxPower(int level, int outputPin) if (level < 2) { level = 2; } + + _level = level; + //Default value PA_HF/LF or +17dBm writeRegister(REG_PA_DAC, 0x84); setOCP(100); diff --git a/src/LoRa.h b/src/LoRa.h index a7002b4..dd26de5 100644 --- a/src/LoRa.h +++ b/src/LoRa.h @@ -68,6 +68,10 @@ class LoRaClass : public Stream { void idle(); void sleep(); + int getTxPower(); + int getSpreadingFactor(); + long getSignalBandwidth(); + void setTxPower(int level, int outputPin = PA_OUTPUT_PA_BOOST_PIN); void setFrequency(long frequency); void setSpreadingFactor(int sf); @@ -105,9 +109,6 @@ class LoRaClass : public Stream { void handleDio0Rise(); bool isTransmitting(); - int getSpreadingFactor(); - long getSignalBandwidth(); - void setLdoFlag(); void setLdoFlagForced(const boolean); @@ -123,6 +124,7 @@ class LoRaClass : public Stream { int _ss; int _reset; int _dio0; + int _level; long _frequency; int _packetIndex; int _implicitHeaderMode; From fe88e02eef35c1c451e2897a639efb8ada03402f Mon Sep 17 00:00:00 2001 From: "Fred N. van Kempen" Date: Sat, 26 Apr 2025 15:40:57 -0400 Subject: [PATCH 4/4] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 004faef..abe9aab 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ This library exposes the LoRa radio directly, and allows you to send data to any No, you have to manage it by your self. **6) Which frequencies can I use?** + You can use [this table](https://www.thethingsnetwork.org/docs/lorawan/frequencies-by-country/) to lookup the available frequencies by your country. The selectable frequency also depends on your hardware. You can lookup the data sheet or ask your supplier. Please also notice the frequency dependent duty cycles for legal reasons!