Compare commits
262 commits
Author | SHA1 | Date | |
---|---|---|---|
6ea0884898 | |||
6488c1e20e | |||
82bb7ac946 | |||
4548b9ffc4 | |||
a6e737a055 | |||
![]() |
ec785005aa | ||
![]() |
f0e686eaa9 | ||
![]() |
416f52d92a | ||
![]() |
d526ac3091 | ||
![]() |
1b62bc3208 | ||
![]() |
77db225396 | ||
![]() |
15745bbd1d | ||
![]() |
7577ae413f | ||
![]() |
c88cf551cc | ||
![]() |
6bf0c3f735 | ||
![]() |
d605bc2058 | ||
![]() |
08e0c0e613 | ||
![]() |
d142928e9f | ||
![]() |
01d1bdae2c | ||
![]() |
56729041b3 | ||
![]() |
b203323ff9 | ||
![]() |
07792dc90f | ||
![]() |
c9690a7955 | ||
![]() |
cf776230a4 | ||
![]() |
648ecbed3b | ||
![]() |
6a96d44b2b | ||
![]() |
ae65265268 | ||
![]() |
9c82d1bdc2 | ||
![]() |
4a557f5162 | ||
![]() |
5f1303aaba | ||
![]() |
24c7166170 | ||
![]() |
699f025581 | ||
![]() |
c420d69193 | ||
![]() |
558e60b18d | ||
![]() |
e4daea6251 | ||
![]() |
78e2991459 | ||
![]() |
8286e2d770 | ||
![]() |
2fd2926c9f | ||
![]() |
35059a86ff | ||
![]() |
977b2c28c8 | ||
![]() |
b9c214db95 | ||
![]() |
bcbf2a12e1 | ||
![]() |
584f547954 | ||
![]() |
2e35481fc2 | ||
![]() |
e087449c0b | ||
![]() |
e86fb27649 | ||
![]() |
8c2c7b6cb5 | ||
![]() |
45de7978dc | ||
![]() |
2550fae4cb | ||
![]() |
3563e7257a | ||
![]() |
9e832526a5 | ||
![]() |
33fd649288 | ||
![]() |
f2461edaec | ||
![]() |
4deec953e8 | ||
![]() |
8ab989ab53 | ||
![]() |
b634c9c711 | ||
![]() |
8c304a89c1 | ||
![]() |
27653e1cf7 | ||
![]() |
5eb90ea17a | ||
![]() |
779e0aa4dd | ||
![]() |
c187960cc1 | ||
![]() |
fc6ff698b9 | ||
![]() |
c6096ad3b8 | ||
![]() |
d0cfd5a461 | ||
![]() |
73b6a7d5e9 | ||
![]() |
5979a2a7be | ||
![]() |
bedab1a66d | ||
![]() |
c4ac0ac68b | ||
![]() |
3e146c891e | ||
![]() |
4733fdd9d1 | ||
![]() |
8126e6f508 | ||
![]() |
650d00b3e3 | ||
![]() |
21a77a6389 | ||
![]() |
cbb8126442 | ||
![]() |
269eb2fe38 | ||
![]() |
0cd69b2e6f | ||
![]() |
64f0f5028b | ||
![]() |
1324b53f7b | ||
![]() |
ff24e2b2ae | ||
![]() |
aab3e05386 | ||
![]() |
cc9ce359b6 | ||
![]() |
de33ce4d6a | ||
![]() |
d685534154 | ||
![]() |
bf1933a0c4 | ||
![]() |
208f4f8ad4 | ||
![]() |
1357d672c7 | ||
![]() |
9b8b9c2802 | ||
![]() |
dab2c3497c | ||
![]() |
d4d98d37ce | ||
![]() |
80a44a3232 | ||
![]() |
06b3049e38 | ||
![]() |
ddd4b23e65 | ||
![]() |
aaa48ba4d8 | ||
![]() |
5e7be10364 | ||
![]() |
d23983bc1f | ||
![]() |
d3d16433bf | ||
![]() |
beb6689287 | ||
![]() |
77dad34c05 | ||
![]() |
3354cd89df | ||
![]() |
21b8e5a364 | ||
![]() |
af34dd9691 | ||
![]() |
6733847186 | ||
![]() |
5efdfb342a | ||
![]() |
4088db2cf2 | ||
![]() |
7c464a0632 | ||
![]() |
c538cac769 | ||
![]() |
10c38164f2 | ||
![]() |
6fb3c0968a | ||
![]() |
cad09196de | ||
![]() |
a5011914c5 | ||
![]() |
f3276c2e66 | ||
![]() |
4f1d367c93 | ||
![]() |
04b96873a3 | ||
![]() |
9a8affde8e | ||
![]() |
2ca2ddf968 | ||
![]() |
d26b1ff38e | ||
![]() |
49f21cc707 | ||
![]() |
06f416935f | ||
![]() |
5ea881c595 | ||
![]() |
92c08c1ebf | ||
![]() |
cbb8d419d1 | ||
![]() |
a63ca70558 | ||
![]() |
33b65344c4 | ||
![]() |
f346dd3687 | ||
![]() |
a3782b432c | ||
![]() |
283bfb43fe | ||
![]() |
5952106e93 | ||
![]() |
617d759ea5 | ||
![]() |
6ab358c292 | ||
![]() |
92d2dc0f09 | ||
![]() |
01e7fa0731 | ||
![]() |
b5d36f11e5 | ||
![]() |
7141d261be | ||
![]() |
680e88c739 | ||
![]() |
bd4ede2fb7 | ||
![]() |
92b687821f | ||
![]() |
60a093775a | ||
![]() |
c7fb065310 | ||
![]() |
8e35b14fae | ||
![]() |
422dc867e0 | ||
![]() |
af6de6a0e0 | ||
![]() |
b2b4c9e0f7 | ||
![]() |
ff387e93ad | ||
![]() |
9bff1582bd | ||
![]() |
c37015ef94 | ||
![]() |
afa5da7fd6 | ||
![]() |
6622a0ac99 | ||
![]() |
c2b44d2552 | ||
![]() |
02fe9f3119 | ||
![]() |
89424a3025 | ||
![]() |
661b36cc4c | ||
![]() |
8c0e8a6586 | ||
![]() |
6e3b870317 | ||
![]() |
67547615af | ||
![]() |
eeff547aa4 | ||
![]() |
5a8ba0003b | ||
![]() |
75f087b5c2 | ||
![]() |
ded508cc25 | ||
![]() |
0cc72c8310 | ||
![]() |
111de250ec | ||
![]() |
f2a8a894d9 | ||
![]() |
933981e97d | ||
![]() |
957a533089 | ||
![]() |
67e5c6ee7b | ||
![]() |
577a0761ac | ||
![]() |
116d60deb2 | ||
![]() |
a692b72347 | ||
![]() |
5d6ca6251f | ||
![]() |
5e063e7ad8 | ||
![]() |
3e634ffb88 | ||
![]() |
855a64c053 | ||
![]() |
24f1535088 | ||
![]() |
0bd5bdc896 | ||
![]() |
35f18b049b | ||
![]() |
53e7a309a0 | ||
![]() |
ef16e431af | ||
![]() |
8d119fc242 | ||
![]() |
17bcfcd0bb | ||
![]() |
a579eed780 | ||
![]() |
0a6d6a26e1 | ||
![]() |
12d81e6d0f | ||
![]() |
1fa7d479ad | ||
![]() |
f95de45be7 | ||
![]() |
2dd69398e3 | ||
![]() |
b33647adc3 | ||
![]() |
b3efc8445c | ||
![]() |
8eb6f0cf24 | ||
![]() |
c467b005c2 | ||
![]() |
c7d6ad3e95 | ||
![]() |
9d9d480a48 | ||
![]() |
f3a8c6dc2d | ||
![]() |
9ac8bb9a7e | ||
![]() |
29ede2c354 | ||
![]() |
fe52311371 | ||
![]() |
cb45f4fe5e | ||
![]() |
49868938d6 | ||
![]() |
f15de1e7dd | ||
![]() |
72ecc275af | ||
![]() |
b1d8850d92 | ||
![]() |
e9dd3dc843 | ||
![]() |
a608075fc1 | ||
![]() |
4564d87721 | ||
![]() |
0096c11f99 | ||
![]() |
8f3a5c7430 | ||
![]() |
15a751a543 | ||
![]() |
7bbaf38651 | ||
![]() |
5cd5d714a8 | ||
![]() |
05d5ef2947 | ||
![]() |
6a5dcc6a6a | ||
![]() |
19b09a0de1 | ||
![]() |
ef0cfddd01 | ||
![]() |
9f04da29af | ||
![]() |
4bd05dee3d | ||
![]() |
e2fd3f7532 | ||
![]() |
f8b66b1cb5 | ||
![]() |
1c0019ad18 | ||
![]() |
a953475b9a | ||
![]() |
412136845f | ||
![]() |
0156c9004e | ||
![]() |
9f4d4ea15e | ||
![]() |
334b5fd499 | ||
![]() |
88e11fa0a2 | ||
![]() |
b8b1afdae1 | ||
![]() |
28360f9b0f | ||
![]() |
9f4c15333c | ||
![]() |
f23f798fe0 | ||
![]() |
709fbdb13a | ||
![]() |
b12f7052bf | ||
![]() |
3952fe9139 | ||
![]() |
6b05e9fd23 | ||
![]() |
e44e9b4bce | ||
![]() |
64253f6e36 | ||
![]() |
fada24c1c4 | ||
![]() |
434afa52f2 | ||
![]() |
8bc4b9a330 | ||
![]() |
61494b8270 | ||
![]() |
33ab117c6d | ||
![]() |
d407908269 | ||
![]() |
9e7c0129e6 | ||
![]() |
a525d457ef | ||
![]() |
2aa8c6e82a | ||
![]() |
afdf3783c3 | ||
![]() |
cc720a7a24 | ||
![]() |
4a155b1922 | ||
![]() |
0f2f5fdf4a | ||
![]() |
00699ce225 | ||
![]() |
710a1540b5 | ||
![]() |
56ae9ad76b | ||
![]() |
94d5d59d80 | ||
![]() |
3633391442 | ||
![]() |
16504803d1 | ||
![]() |
e9b6e27739 | ||
![]() |
1ca12abc88 | ||
![]() |
d9ea40032f | ||
![]() |
aecef28380 | ||
![]() |
a7feeee1e0 | ||
![]() |
bce4d91715 | ||
![]() |
9db98f2ab4 | ||
![]() |
dc77e6e662 | ||
![]() |
1f11cd1dd5 | ||
![]() |
6e66570241 | ||
![]() |
46a086cfa8 |
257 changed files with 8711 additions and 4602 deletions
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
|
@ -7,8 +7,8 @@ assignees: ''
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**IMPORTANT: Check the wiki**
|
**IMPORTANT: Check the docs**
|
||||||
Before submitting new issue, please check the [Troubleshooting Guide](https://github.com/jgromes/RadioLib/wiki/Troubleshooting-Guide) Wiki page and the [API documentation](https://jgromes.github.io/RadioLib/). You might find a solution to your issue there.
|
Before submitting new issue, please check the [Troubleshooting Guide](https://github.com/jgromes/RadioLib/wiki/Troubleshooting-Guide) Wiki page and the [API documentation](https://jgromes.github.io/RadioLib/). If you are seeing an error code, we have [online status code decoder](https://radiolib-org.github.io/status_decoder/decode.html).
|
||||||
|
|
||||||
**Describe the bug**
|
**Describe the bug**
|
||||||
A clear and concise description of what the bug is. When applicable, please include [debug mode output](https://github.com/jgromes/RadioLib/wiki/Debug-mode) **using the appropriate debug mode**.
|
A clear and concise description of what the bug is. When applicable, please include [debug mode output](https://github.com/jgromes/RadioLib/wiki/Debug-mode) **using the appropriate debug mode**.
|
||||||
|
|
4
.github/ISSUE_TEMPLATE/feature_request.md
vendored
4
.github/ISSUE_TEMPLATE/feature_request.md
vendored
|
@ -7,8 +7,8 @@ assignees: ''
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**IMPORTANT: Check the wiki**
|
**IMPORTANT: Check the docs**
|
||||||
Before submitting new issue, please check the [Troubleshooting Guide](https://github.com/jgromes/RadioLib/wiki/Troubleshooting-Guide) Wiki page and the [API documentation](https://jgromes.github.io/RadioLib/). You might find a solution to your issue there.
|
Before submitting new issue, please check the [Troubleshooting Guide](https://github.com/jgromes/RadioLib/wiki/Troubleshooting-Guide) Wiki page and the [API documentation](https://jgromes.github.io/RadioLib/). If you are seeing an error code, we have [online status code decoder](https://radiolib-org.github.io/status_decoder/decode.html).
|
||||||
|
|
||||||
**Is your feature request related to a problem? Please describe.**
|
**Is your feature request related to a problem? Please describe.**
|
||||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
2
.github/ISSUE_TEMPLATE/module-not-working.md
vendored
2
.github/ISSUE_TEMPLATE/module-not-working.md
vendored
|
@ -9,7 +9,7 @@ assignees: ''
|
||||||
|
|
||||||
**IMPORTANT: Before submitting an issue, please check the following:**
|
**IMPORTANT: Before submitting an issue, please check the following:**
|
||||||
1. **Read [CONTRIBUTING.md](https://github.com/jgromes/RadioLib/blob/master/CONTRIBUTING.md)!** Issues that do not follow this document will be closed/locked/deleted/ignored.
|
1. **Read [CONTRIBUTING.md](https://github.com/jgromes/RadioLib/blob/master/CONTRIBUTING.md)!** Issues that do not follow this document will be closed/locked/deleted/ignored.
|
||||||
2. RadioLib has a [Troubleshooting Guide](https://github.com/jgromes/RadioLib/wiki/Troubleshooting-Guide) Wiki page and an extensive [API documentation](https://jgromes.github.io/RadioLib/). You might find a solution to your issue there.
|
2. RadioLib has a [Troubleshooting Guide](https://github.com/jgromes/RadioLib/wiki/Troubleshooting-Guide) Wiki page and an extensive [API documentation](https://jgromes.github.io/RadioLib/). If you are seeing an error code, we have [online status code decoder](https://radiolib-org.github.io/status_decoder/decode.html).
|
||||||
3. Make sure you're using the latest release of the library! Releases can be found [here](https://github.com/jgromes/RadioLib/releases).
|
3. Make sure you're using the latest release of the library! Releases can be found [here](https://github.com/jgromes/RadioLib/releases).
|
||||||
4. Use [Arduino forums](https://forum.arduino.cc/) to ask generic questions about wireless modules, wiring, usage, etc. Only create issues for problems specific to RadioLib!
|
4. Use [Arduino forums](https://forum.arduino.cc/) to ask generic questions about wireless modules, wiring, usage, etc. Only create issues for problems specific to RadioLib!
|
||||||
5. Error codes, their meaning and how to fix them can be found on [this page](https://jgromes.github.io/RadioLib/group__status__codes.html).
|
5. Error codes, their meaning and how to fix them can be found on [this page](https://jgromes.github.io/RadioLib/group__status__codes.html).
|
||||||
|
|
2
.github/ISSUE_TEMPLATE/regular-issue.md
vendored
2
.github/ISSUE_TEMPLATE/regular-issue.md
vendored
|
@ -9,7 +9,7 @@ assignees: ''
|
||||||
|
|
||||||
**IMPORTANT: Before submitting an issue, please check the following:**
|
**IMPORTANT: Before submitting an issue, please check the following:**
|
||||||
1. **Read [CONTRIBUTING.md](https://github.com/jgromes/RadioLib/blob/master/CONTRIBUTING.md)!** Issues that do not follow this document will be closed/locked/deleted/ignored.
|
1. **Read [CONTRIBUTING.md](https://github.com/jgromes/RadioLib/blob/master/CONTRIBUTING.md)!** Issues that do not follow this document will be closed/locked/deleted/ignored.
|
||||||
2. RadioLib has a [Troubleshooting Guide](https://github.com/jgromes/RadioLib/wiki/Troubleshooting-Guide) Wiki page and an extensive [API documentation](https://jgromes.github.io/RadioLib/). You might find a solution to your issue there.
|
2. RadioLib has a [Troubleshooting Guide](https://github.com/jgromes/RadioLib/wiki/Troubleshooting-Guide) Wiki page and an extensive [API documentation](https://jgromes.github.io/RadioLib/). If you are seeing an error code, we have [online status code decoder](https://radiolib-org.github.io/status_decoder/decode.html).
|
||||||
3. Make sure you're using the latest release of the library! Releases can be found [here](https://github.com/jgromes/RadioLib/releases).
|
3. Make sure you're using the latest release of the library! Releases can be found [here](https://github.com/jgromes/RadioLib/releases).
|
||||||
4. Use [Arduino forums](https://forum.arduino.cc/) to ask generic questions about wireless modules, wiring, usage, etc. Only create issues for problems specific to RadioLib!
|
4. Use [Arduino forums](https://forum.arduino.cc/) to ask generic questions about wireless modules, wiring, usage, etc. Only create issues for problems specific to RadioLib!
|
||||||
5. Error codes, their meaning and how to fix them can be found on [this page](https://jgromes.github.io/RadioLib/group__status__codes.html).
|
5. Error codes, their meaning and how to fix them can be found on [this page](https://jgromes.github.io/RadioLib/group__status__codes.html).
|
||||||
|
|
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
|
@ -54,7 +54,7 @@ jobs:
|
||||||
|
|
||||||
- name: Build example
|
- name: Build example
|
||||||
run:
|
run:
|
||||||
arduino-cli compile --libraries /home/runner/work/RadioLib --fqbn arduino:avr:uno $PWD/examples/SX126x/SX126x_Transmit_Blocking/SX126x_Transmit_Blocking.ino --warnings=all
|
arduino-cli compile --libraries /home/runner/work/RadioLib --fqbn arduino:avr:uno $PWD/examples/SX123x/SX123x_Transmit_Blocking/SX123x_Transmit_Blocking.ino --warnings=all
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v3
|
uses: github/codeql-action/analyze@v3
|
||||||
|
|
107
.github/workflows/main.yml
vendored
107
.github/workflows/main.yml
vendored
|
@ -10,12 +10,11 @@ on:
|
||||||
id:
|
id:
|
||||||
description: The ID of the platform on which the build is run
|
description: The ID of the platform on which the build is run
|
||||||
required: true
|
required: true
|
||||||
default: arduino:avr:uno
|
default: arduino:avr:mega
|
||||||
type: choice
|
type: choice
|
||||||
options:
|
options:
|
||||||
- all
|
- all
|
||||||
- none
|
- none
|
||||||
- arduino:avr:uno
|
|
||||||
- arduino:avr:mega
|
- arduino:avr:mega
|
||||||
- arduino:mbed:nano33ble
|
- arduino:mbed:nano33ble
|
||||||
- arduino:mbed:envie_m4
|
- arduino:mbed:envie_m4
|
||||||
|
@ -27,7 +26,6 @@ on:
|
||||||
- esp32:esp32:esp32
|
- esp32:esp32:esp32
|
||||||
- esp8266:esp8266:generic
|
- esp8266:esp8266:generic
|
||||||
- Intel:arc32:arduino_101
|
- Intel:arc32:arduino_101
|
||||||
- SparkFun:apollo3:sfe_artemis
|
|
||||||
- STMicroelectronics:stm32:GenF3:pnum=BLACKPILL_F303CC
|
- STMicroelectronics:stm32:GenF3:pnum=BLACKPILL_F303CC
|
||||||
- STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_WL55JC1
|
- STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_WL55JC1
|
||||||
- stm32duino:STM32F1:mapleMini
|
- stm32duino:STM32F1:mapleMini
|
||||||
|
@ -38,6 +36,7 @@ on:
|
||||||
- MegaCore:avr:1281
|
- MegaCore:avr:1281
|
||||||
- teensy:avr:teensy41
|
- teensy:avr:teensy41
|
||||||
- arduino:renesas_uno:minima
|
- arduino:renesas_uno:minima
|
||||||
|
- SiliconLabs:silabs:xg24explorerkit
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -45,8 +44,6 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
# platform-dependent settings - extra board options, board index URLs, skip patterns etc.
|
# platform-dependent settings - extra board options, board index URLs, skip patterns etc.
|
||||||
include:
|
include:
|
||||||
- id: arduino:avr:uno
|
|
||||||
run: echo "skip-pattern=(STM32WL|SSTV|LoRaWAN|LR11x0_Firmware_Update|Pager|APRS|Morse)" >> $GITHUB_OUTPUT
|
|
||||||
- id: arduino:avr:mega
|
- id: arduino:avr:mega
|
||||||
run: |
|
run: |
|
||||||
echo "options=':cpu=atmega2560'" >> $GITHUB_OUTPUT
|
echo "options=':cpu=atmega2560'" >> $GITHUB_OUTPUT
|
||||||
|
@ -86,19 +83,16 @@ jobs:
|
||||||
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
|
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
|
||||||
echo "options=':xtal=80,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=qio,eesz=512K'" >> $GITHUB_OUTPUT
|
echo "options=':xtal=80,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=qio,eesz=512K'" >> $GITHUB_OUTPUT
|
||||||
echo "index-url=--additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json" >> $GITHUB_OUTPUT
|
echo "index-url=--additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json" >> $GITHUB_OUTPUT
|
||||||
- id: SparkFun:apollo3:sfe_artemis
|
- id: STMicroelectronics:stm32:GenF3
|
||||||
run: |
|
|
||||||
echo "skip-pattern=(STM32WL|LoRaWAN)" >> $GITHUB_OUTPUT
|
|
||||||
echo "warnings='none'" >> $GITHUB_OUTPUT
|
|
||||||
echo "index-url=--additional-urls https://raw.githubusercontent.com/sparkfun/Arduino_Apollo3/master/package_sparkfun_apollo3_index.json" >> $GITHUB_OUTPUT
|
|
||||||
- id: STMicroelectronics:stm32:GenF3:pnum=BLACKPILL_F303CC
|
|
||||||
run: |
|
run: |
|
||||||
|
echo "options=':pnum=BLACKPILL_F303CC'" >> $GITHUB_OUTPUT
|
||||||
echo "index-url=--additional-urls https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json" >> $GITHUB_OUTPUT
|
echo "index-url=--additional-urls https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json" >> $GITHUB_OUTPUT
|
||||||
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
|
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
|
||||||
- id: STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_WL55JC1
|
- id: STMicroelectronics:stm32:Nucleo_64
|
||||||
run: |
|
run: |
|
||||||
|
echo "options=':pnum=NUCLEO_WL55JC1'" >> $GITHUB_OUTPUT
|
||||||
# Do *not* skip STM32WL examples
|
# Do *not* skip STM32WL examples
|
||||||
echo "skip-pattern='LR11x0_Firmware_Update'" >> $GITHUB_OUTPUT
|
echo "skip-pattern=(LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
|
||||||
echo "index-url=--additional-urls https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json" >> $GITHUB_OUTPUT
|
echo "index-url=--additional-urls https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json" >> $GITHUB_OUTPUT
|
||||||
- id: stm32duino:STM32F1:mapleMini
|
- id: stm32duino:STM32F1:mapleMini
|
||||||
run: |
|
run: |
|
||||||
|
@ -127,11 +121,14 @@ jobs:
|
||||||
- id: arduino:renesas_uno:minima
|
- id: arduino:renesas_uno:minima
|
||||||
run: |
|
run: |
|
||||||
echo "skip-pattern=(STM32WL|LoRaWAN|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
|
echo "skip-pattern=(STM32WL|LoRaWAN|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
|
||||||
|
- id: SiliconLabs:silabs:xg24explorerkit
|
||||||
|
run: |
|
||||||
|
echo "index-url=--additional-urls https://siliconlabs.github.io/arduino/package_arduinosilabs_index.json" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: ${{ matrix.id }}
|
name: ${{ matrix.id }}
|
||||||
env:
|
env:
|
||||||
run-build: ${{ (inputs.id != 'none' && matrix.id == 'arduino:avr:uno') || contains(github.event.head_commit.message, 'CI_BUILD_ALL') || contains(github.event.head_commit.message, 'Bump version to') || contains(github.event.head_commit.message, format('{0}', matrix.id)) || inputs.id == 'all' || inputs.id == matrix.id }}
|
run-build: ${{ (inputs.id != 'none' && matrix.id == 'arduino:avr:mega') || contains(github.event.head_commit.message, 'CI_BUILD_ALL') || contains(github.event.head_commit.message, 'Bump version to') || contains(github.event.head_commit.message, format('{0}', matrix.id)) || inputs.id == 'all' || inputs.id == matrix.id }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Free Disk Space (Ubuntu)
|
- name: Free Disk Space (Ubuntu)
|
||||||
|
@ -185,28 +182,64 @@ jobs:
|
||||||
if: ${{ env.run-build == 'true' }}
|
if: ${{ env.run-build == 'true' }}
|
||||||
run:
|
run:
|
||||||
|
|
|
|
||||||
for example in $(find $PWD/examples -name '*.ino' | sort); do
|
cd $PWD/extras/test/ci
|
||||||
# check whether to skip this sketch
|
./build_examples.sh ${{ matrix.id }} "${{ steps.prep.outputs.skip-pattern }}" ${{ steps.prep.outputs.options }}
|
||||||
if [ ! -z '${{ steps.prep.outputs.skip-pattern }}' ] && [[ ${example} =~ ${{ steps.prep.outputs.skip-pattern }} ]]; then
|
|
||||||
# skip sketch
|
|
||||||
echo -e "\n\033[1;33mSkipped ${example##*/} (matched with ${{ steps.prep.outputs.skip-pattern }})\033[0m";
|
|
||||||
else
|
|
||||||
# apply special flags for LoRaWAN
|
|
||||||
if [[ ${example} =~ "LoRaWAN" ]]; then
|
|
||||||
flags="-DRADIOLIB_LORAWAN_DEV_ADDR=0 -DRADIOLIB_LORAWAN_FNWKSINT_KEY=0 -DRADIOLIB_LORAWAN_SNWKSINT_KEY=0 -DRADIOLIB_LORAWAN_NWKSENC_KEY=0 -DRADIOLIB_LORAWAN_APPS_KEY=0 -DRADIOLIB_LORAWAN_APP_KEY=0 -DRADIOLIB_LORAWAN_NWK_KEY=0 -DRADIOLIB_LORAWAN_DEV_EUI=0 -DARDUINO_TTGO_LORA32_V1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# build sketch
|
- name: Extract short commit hash
|
||||||
echo -e "\n\033[1;33mBuilding ${example##*/} ... \033[0m";
|
id: short-hash
|
||||||
arduino-cli compile --libraries /home/runner/work/RadioLib --fqbn ${{ matrix.id }}${{ steps.prep.outputs.options }} --build-property compiler.cpp.extra_flags="$flags" $example --warnings=${{ steps.prep.outputs.warnings }}
|
run: echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo -e "\033[1;31m${example##*/} build FAILED\033[0m\n";
|
- name: Parse sizes
|
||||||
exit 1;
|
if: ${{ env.run-build == 'true' }}
|
||||||
else
|
run:
|
||||||
echo -e "\033[1;32m${example##*/} build PASSED\033[0m\n";
|
|
|
||||||
fi
|
cd $PWD/extras/test/ci
|
||||||
fi
|
./parse_size.sh ${{ matrix.id }}
|
||||||
done
|
cat size_${{ steps.short-hash.outputs.short_sha }}_${{ steps.split.outputs._0 }}-${{ steps.split.outputs._1 }}-${{ steps.split.outputs._2 }}.csv
|
||||||
|
|
||||||
|
- name: Upload size report as artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: size-file-${{ steps.split.outputs._0 }}-${{ steps.split.outputs._1 }}-${{ steps.split.outputs._2 }}
|
||||||
|
path: extras/test/ci/size_${{ steps.short-hash.outputs.short_sha }}_${{ steps.split.outputs._0 }}-${{ steps.split.outputs._1 }}-${{ steps.split.outputs._2 }}.csv
|
||||||
|
|
||||||
|
metrics:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
steps:
|
||||||
|
- name: Set up SSH
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "${{ secrets.ACTIONS_METRICS_DEPLOY_KEY }}" > ~/.ssh/id_rsa
|
||||||
|
chmod 600 ~/.ssh/id_rsa
|
||||||
|
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
- name: Clone artifact repo
|
||||||
|
run:
|
||||||
|
|
|
||||||
|
cd $PWD/..
|
||||||
|
git clone git@github.com:radiolib-org/artifacts.git
|
||||||
|
cd artifacts
|
||||||
|
git config --global user.name "${{ github.actor }}"
|
||||||
|
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
|
||||||
|
|
||||||
|
- name: Download size artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: aggregated-sizes
|
||||||
|
|
||||||
|
- name: Push size files
|
||||||
|
run:
|
||||||
|
|
|
||||||
|
ls -R aggregated-sizes
|
||||||
|
mkdir -p $PWD/../artifacts/radiolib-ci/l0
|
||||||
|
cp aggregated-sizes/*/size_*.csv $PWD/../artifacts/radiolib-ci/l0/.
|
||||||
|
cd $PWD/../artifacts/radiolib-ci
|
||||||
|
git add .
|
||||||
|
COMMIT_URL="https://github.com/jgromes/RadioLib/commit/$GITHUB_SHA"
|
||||||
|
git commit -m "Push artifacts from $COMMIT_URL"
|
||||||
|
git push origin main
|
||||||
|
|
||||||
esp-build:
|
esp-build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -256,10 +289,11 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
cd $PWD/examples/NonArduino/Tock
|
cd $PWD/examples/NonArduino/Tock
|
||||||
git clone https://github.com/tock/libtock-c.git
|
git clone https://github.com/tock/libtock-c.git
|
||||||
cd libtock-c; git checkout dbee65a56d74b4bad166317f199e80b959f7c82c; cd ../
|
cd libtock-c; git checkout c0202f9ab78da4a6e95f136cf5250701e3778f63; cd ../
|
||||||
LIBTOCK_C_DIRECTORY="$(pwd)/libtock-c" ./build.sh
|
LIBTOCK_C_DIRECTORY="$(pwd)/libtock-c" ./build.sh
|
||||||
|
|
||||||
rpi-build:
|
rpi-build:
|
||||||
|
if: false # self-hosted runner temporarily disabled
|
||||||
runs-on: [self-hosted, ARM64]
|
runs-on: [self-hosted, ARM64]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
@ -291,6 +325,7 @@ jobs:
|
||||||
./build.sh
|
./build.sh
|
||||||
|
|
||||||
rpi-test:
|
rpi-test:
|
||||||
|
if: false # self-hosted runner temporarily disabled
|
||||||
needs: rpi-build
|
needs: rpi-build
|
||||||
runs-on: [self-hosted, ARM64]
|
runs-on: [self-hosted, ARM64]
|
||||||
steps:
|
steps:
|
||||||
|
|
37
.github/workflows/release.yml
vendored
Normal file
37
.github/workflows/release.yml
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
name: "Release"
|
||||||
|
|
||||||
|
on: workflow_dispatch
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: Release RadioLib update
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Checkout latest tag
|
||||||
|
run: git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
|
||||||
|
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.9'
|
||||||
|
|
||||||
|
- name: Install PlatformIO and ESP-IDF
|
||||||
|
run: |
|
||||||
|
pip install --upgrade platformio
|
||||||
|
pip install --upgrade idf-component-manager
|
||||||
|
|
||||||
|
- name: PlatformIO publish
|
||||||
|
env:
|
||||||
|
PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }}
|
||||||
|
run: pio pkg publish --no-interactive
|
||||||
|
|
||||||
|
- name: ESP-IDF publish
|
||||||
|
env:
|
||||||
|
IDF_COMPONENT_API_TOKEN: ${{ secrets.IDF_COMPONENT_API_TOKEN }}
|
||||||
|
run: compote component upload --name RadioLib --namespace jgromes
|
48
.github/workflows/unit-test.yml
vendored
Normal file
48
.github/workflows/unit-test.yml
vendored
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
name: "Unit test"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
unit-test:
|
||||||
|
name: Build and run unit test
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y libboost-all-dev libfmt-dev lcov
|
||||||
|
|
||||||
|
- name: Run unit test
|
||||||
|
run: |
|
||||||
|
cd extras/test/unit
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
- name: Measure test coverage
|
||||||
|
run: |
|
||||||
|
cd extras/test/unit
|
||||||
|
./coverage.sh
|
||||||
|
|
||||||
|
- name: Upload coverage report as artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: coverage_report
|
||||||
|
path: extras/test/unit/lcov.report
|
||||||
|
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish_branch: gh-pages
|
||||||
|
publish_dir: extras/test/unit/lcov.report
|
||||||
|
destination_dir: coverage
|
||||||
|
keep_files: true
|
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -11,13 +11,6 @@
|
||||||
# Jetbrain IDEs
|
# Jetbrain IDEs
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
# Debug decoder
|
|
||||||
extras/decoder/log.txt
|
|
||||||
extras/decoder/out.txt
|
|
||||||
|
|
||||||
# Spectrum scan
|
|
||||||
extras/SX126x_Spectrum_Scan/out/*
|
|
||||||
|
|
||||||
# PlatformIO
|
# PlatformIO
|
||||||
.pio*
|
.pio*
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ target_include_directories(RadioLib
|
||||||
set_property(TARGET RadioLib PROPERTY CXX_STANDARD 20)
|
set_property(TARGET RadioLib PROPERTY CXX_STANDARD 20)
|
||||||
|
|
||||||
# enable most warnings
|
# enable most warnings
|
||||||
target_compile_options(RadioLib PRIVATE -Wall -Wextra)
|
target_compile_options(RadioLib PRIVATE -Wall -Wextra -Wpedantic -Wdouble-promotion)
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
|
15
README.md
15
README.md
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
## Universal wireless communication library for embedded devices
|
## Universal wireless communication library for embedded devices
|
||||||
|
|
||||||
## See the [Wiki](https://github.com/jgromes/RadioLib/wiki) and [FAQ](https://github.com/jgromes/RadioLib/wiki/Frequently-Asked-Questions) for further information. See the [GitHub Pages](https://jgromes.github.io/RadioLib) for detailed and up-to-date API reference.
|
|
||||||
|
|
||||||
RadioLib allows its users to integrate all sorts of different wireless communication modules, protocols and even digital modes into a single consistent system.
|
RadioLib allows its users to integrate all sorts of different wireless communication modules, protocols and even digital modes into a single consistent system.
|
||||||
Want to add a Bluetooth interface to your LoRa network? Sure thing! Do you just want to go really old-school and play around with radio teletype, slow-scan TV, or even Hellschreiber using nothing but a cheap radio module? Why not!
|
Want to add a Bluetooth interface to your LoRa network? Sure thing! Do you just want to go really old-school and play around with radio teletype, slow-scan TV, or even Hellschreiber using nothing but a cheap radio module? Why not!
|
||||||
|
|
||||||
|
@ -13,6 +11,13 @@ RadioLib natively supports Arduino, but can run in non-Arduino environments as w
|
||||||
|
|
||||||
RadioLib was originally created as a driver for [__RadioShield__](https://github.com/jgromes/RadioShield), but it can be used to control as many different wireless modules as you like - or at least as many as your microcontroller can handle!
|
RadioLib was originally created as a driver for [__RadioShield__](https://github.com/jgromes/RadioShield), but it can be used to control as many different wireless modules as you like - or at least as many as your microcontroller can handle!
|
||||||
|
|
||||||
|
### Quick links:
|
||||||
|
* [__Wiki__](https://github.com/jgromes/RadioLib/wiki) - contains useful general information on using this library
|
||||||
|
* [__FAQ__](https://github.com/jgromes/RadioLib/wiki/Frequently-Asked-Questions) - frequently asked questions, and answers
|
||||||
|
* [__API Reference__](https://jgromes.github.io/RadioLib) - full API reference, automatically generated from the source code
|
||||||
|
* [__Status Code Decoder__](https://radiolib-org.github.io/status_decoder/decode.html) - decoder for status codes returned by RadioLib methods
|
||||||
|
* [__Debug Log Decoder__](https://radiolib-org.github.io/debug_decoder/decode.html) - decoder for RadioLib SPI debug logs
|
||||||
|
|
||||||
### Supported modules:
|
### Supported modules:
|
||||||
* __CC1101__ FSK radio module
|
* __CC1101__ FSK radio module
|
||||||
* __LLCC68__ LoRa module
|
* __LLCC68__ LoRa module
|
||||||
|
@ -43,12 +48,13 @@ SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x, LR11x0 and
|
||||||
SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x and SX128x
|
SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x and SX128x
|
||||||
* [__POCSAG__](https://www.sigidwiki.com/wiki/POCSAG) using 2-FSK for modules:
|
* [__POCSAG__](https://www.sigidwiki.com/wiki/POCSAG) using 2-FSK for modules:
|
||||||
SX127x, RFM9x, RF69, SX1231, CC1101, nRF24L01, RFM2x and Si443x
|
SX127x, RFM9x, RF69, SX1231, CC1101, nRF24L01, RFM2x and Si443x
|
||||||
* [__LoRaWAN__](https://lora-alliance.org/) using LoRa for modules:
|
* [__LoRaWAN__](https://lora-alliance.org/) using LoRa and FSK for modules:
|
||||||
SX127x, RFM9x, SX126x, LR11x0 and SX128x
|
SX127x, RFM9x, SX126x, LR11x0 and SX128x
|
||||||
|
|
||||||
### Supported Arduino platforms:
|
### Supported Arduino platforms:
|
||||||
* __Arduino__
|
* __Arduino__
|
||||||
* [__AVR__](https://github.com/arduino/ArduinoCore-avr) - Arduino Uno, Mega, Leonardo, Pro Mini, Nano etc.
|
* [__AVR__](https://github.com/arduino/ArduinoCore-avr) - Arduino Uno, Mega, Leonardo, Pro Mini, Nano etc.
|
||||||
|
* NOTE: Arduino boards based on ATmega328 (Uno, Pro Mini, Nano etc.) and smaller are NOT recommended. This is because the ATmega328 MCU is very constrained in terms of program and memory size, so the library will end up taking most of the space available.
|
||||||
* [__mbed__](https://github.com/arduino/ArduinoCore-mbed) - Arduino Nano 33 BLE and Arduino Portenta H7
|
* [__mbed__](https://github.com/arduino/ArduinoCore-mbed) - Arduino Nano 33 BLE and Arduino Portenta H7
|
||||||
* [__megaAVR__](https://github.com/arduino/ArduinoCore-megaavr) - Arduino Uno WiFi Rev.2 and Nano Every
|
* [__megaAVR__](https://github.com/arduino/ArduinoCore-megaavr) - Arduino Uno WiFi Rev.2 and Nano Every
|
||||||
* [__SAM__](https://github.com/arduino/ArduinoCore-sam) - Arduino Due
|
* [__SAM__](https://github.com/arduino/ArduinoCore-sam) - Arduino Due
|
||||||
|
@ -88,4 +94,7 @@ SX127x, RFM9x, SX126x, LR11x0 and SX128x
|
||||||
* __PJRC__
|
* __PJRC__
|
||||||
* [__Teensy__](https://github.com/PaulStoffregen/cores) - Teensy 2.x, 3.x and 4.x boards
|
* [__Teensy__](https://github.com/PaulStoffregen/cores) - Teensy 2.x, 3.x and 4.x boards
|
||||||
|
|
||||||
|
* __Silicon Labs__
|
||||||
|
* [__EFR32__](https://github.com/SiliconLabs/arduino) - Silicon Labs xG24, xG27 and other boards
|
||||||
|
|
||||||
The list above is by no means exhaustive - RadioLib code is independent of the used platform! Compilation of all examples is tested for all platforms officially supported prior to releasing new version. In addition, RadioLib includes an internal hardware abstraction layer, which allows it to be easily ported even to non-Arduino environments.
|
The list above is by no means exhaustive - RadioLib code is independent of the used platform! Compilation of all examples is tested for all platforms officially supported prior to releasing new version. In addition, RadioLib includes an internal hardware abstraction layer, which allows it to be easily ported even to non-Arduino environments.
|
||||||
|
|
|
@ -35,9 +35,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// this requires connection to the module direct
|
// this requires connection to the module direct
|
||||||
|
|
|
@ -35,9 +35,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// this requires connection to the module direct
|
// this requires connection to the module direct
|
||||||
|
@ -105,32 +109,49 @@ void setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
Serial.print(F("[APRS] Sending position ... "));
|
Serial.println(F("[APRS] Sending location reports"));
|
||||||
|
|
||||||
// send a location without message or timestamp
|
// send a location without message or timestamp
|
||||||
char destination[] = "N0CALL";
|
char destination[] = "N0CALL";
|
||||||
char latitude[] = "4911.67N";
|
char latitude[] = "4911.67N";
|
||||||
char longitude[] = "01635.96E";
|
char longitude[] = "01635.96E";
|
||||||
int state = aprs.sendPosition(destination, 0, latitude, longitude);
|
int state = aprs.sendPosition(destination, 0, latitude, longitude);
|
||||||
|
if(state != RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.print(F("[APRS] Failed to send location, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
}
|
||||||
delay(500);
|
delay(500);
|
||||||
|
|
||||||
// send a location with message and without timestamp
|
// send a location with message and without timestamp
|
||||||
char message[] = "I'm here!";
|
char message[] = "I'm here!";
|
||||||
state |= aprs.sendPosition(destination, 0, latitude, longitude, message);
|
state = aprs.sendPosition(destination, 0, latitude, longitude, message);
|
||||||
|
if(state != RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.print(F("[APRS] Failed to send location and message code "));
|
||||||
|
Serial.println(state);
|
||||||
|
}
|
||||||
delay(500);
|
delay(500);
|
||||||
|
|
||||||
|
// you can also set repeater callsigns and SSIDs
|
||||||
|
// up to 8 repeaters may be used
|
||||||
|
// sendPosition will be sent with "WIDE2-2" path
|
||||||
|
char* repeaterCallsigns[] = { "WIDE2" };
|
||||||
|
uint8_t repeaterSSIDs[] = { 2 };
|
||||||
|
aprs.useRepeaters(repeaterCallsigns, repeaterSSIDs, 1);
|
||||||
|
|
||||||
// send a location with message and timestamp
|
// send a location with message and timestamp
|
||||||
char timestamp[] = "093045z";
|
char timestamp[] = "093045z";
|
||||||
state |= aprs.sendPosition(destination, 0, latitude, longitude, message, timestamp);
|
state = aprs.sendPosition(destination, 0, latitude, longitude, message, timestamp);
|
||||||
delay(500);
|
if(state != RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.print(F("[APRS] Failed to send location, message and timestamp code "));
|
||||||
if(state == RADIOLIB_ERR_NONE) {
|
|
||||||
Serial.println(F("success!"));
|
|
||||||
} else {
|
|
||||||
Serial.print(F("failed, code "));
|
|
||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
}
|
}
|
||||||
|
delay(500);
|
||||||
|
|
||||||
|
// when repeaters are no longer needed, they can be dropped
|
||||||
|
aprs.dropRepeaters();
|
||||||
|
|
||||||
// wait one minute before transmitting again
|
// wait one minute before transmitting again
|
||||||
|
Serial.println(F("[APRS] All done!"));
|
||||||
delay(60000);
|
delay(60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create APRS client instance using the LoRa radio
|
// create APRS client instance using the LoRa radio
|
||||||
APRSClient aprs(&radio);
|
APRSClient aprs(&radio);
|
||||||
|
|
|
@ -38,9 +38,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AX.25 client instance using the FSK module
|
// create AX.25 client instance using the FSK module
|
||||||
AX25Client ax25(&radio);
|
AX25Client ax25(&radio);
|
||||||
|
|
|
@ -31,9 +31,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AX.25 client instance using the FSK module
|
// create AX.25 client instance using the FSK module
|
||||||
AX25Client ax25(&radio);
|
AX25Client ax25(&radio);
|
||||||
|
|
|
@ -32,9 +32,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// this requires connection to the module direct
|
// this requires connection to the module direct
|
||||||
|
|
|
@ -24,9 +24,13 @@
|
||||||
// GDO2 pin: 3 (optional)
|
// GDO2 pin: 3 (optional)
|
||||||
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//CC1101 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -31,9 +31,13 @@
|
||||||
// GDO2 pin: 3 (optional)
|
// GDO2 pin: 3 (optional)
|
||||||
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//CC1101 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -29,9 +29,28 @@
|
||||||
// GDO2 pin: 3 (optional)
|
// GDO2 pin: 3 (optional)
|
||||||
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//CC1101 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
|
// flag to indicate that a packet was received
|
||||||
|
volatile bool receivedFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a complete packet
|
||||||
|
// is received by the module
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlag(void) {
|
||||||
|
// we got a packet, set the flag
|
||||||
|
receivedFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
@ -72,21 +91,6 @@ void setup() {
|
||||||
// radio.readData();
|
// radio.readData();
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a packet was received
|
|
||||||
volatile bool receivedFlag = false;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
|
||||||
// is received by the module
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlag(void) {
|
|
||||||
// we got a packet, set the flag
|
|
||||||
receivedFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(receivedFlag) {
|
if(receivedFlag) {
|
||||||
|
|
|
@ -35,9 +35,13 @@ CC1101 radio1 = new Module(10, 2, RADIOLIB_NC, 3);
|
||||||
// GDO2 pin: 5 (optional)
|
// GDO2 pin: 5 (optional)
|
||||||
CC1101 radio2 = new Module(9, 4, RADIOLIB_NC, 5);
|
CC1101 radio2 = new Module(9, 4, RADIOLIB_NC, 5);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//CC1101 radio3 = RadioShield.ModuleB;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio3 = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -24,9 +24,13 @@
|
||||||
// GDO2 pin: 3 (optional)
|
// GDO2 pin: 3 (optional)
|
||||||
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//CC1101 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
@ -78,10 +82,11 @@ void setup() {
|
||||||
void loop() {
|
void loop() {
|
||||||
Serial.print(F("[CC1101] Transmitting packet ... "));
|
Serial.print(F("[CC1101] Transmitting packet ... "));
|
||||||
|
|
||||||
// you can transmit C-string or Arduino string up to 63 characters long
|
// you can transmit C-string or Arduino string up to 255 characters long
|
||||||
int state = radio.transmit("Hello World!");
|
int state = radio.transmit("Hello World!");
|
||||||
|
|
||||||
// you can also transmit byte array up to 63 bytes long
|
// you can also transmit byte array up to 255 bytes long
|
||||||
|
// With some limitations see here: https://github.com/jgromes/RadioLib/discussions/1138
|
||||||
/*
|
/*
|
||||||
byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
|
byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
|
||||||
int state = radio.transmit(byteArr, 8);
|
int state = radio.transmit(byteArr, 8);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
RadioLib CC1101 Blocking Transmit Example
|
RadioLib CC1101 Blocking Transmit Example
|
||||||
|
|
||||||
This example transmits packets using CC1101 FSK radio module.
|
This example transmits packets using CC1101 FSK radio module.
|
||||||
Each packet contains up to 64 bytes of data, in the form of:
|
Each packet contains up to 255 bytes of data with some limitations (https://github.com/jgromes/RadioLib/discussions/1138), in the form of:
|
||||||
- Arduino String
|
- Arduino String
|
||||||
- null-terminated char array (C-string)
|
- null-terminated char array (C-string)
|
||||||
- arbitrary binary data (byte array)
|
- arbitrary binary data (byte array)
|
||||||
|
@ -28,9 +28,13 @@
|
||||||
// GDO2 pin: 3
|
// GDO2 pin: 3
|
||||||
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//CC1101 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
@ -53,11 +57,11 @@ int count = 0;
|
||||||
void loop() {
|
void loop() {
|
||||||
Serial.print(F("[CC1101] Transmitting packet ... "));
|
Serial.print(F("[CC1101] Transmitting packet ... "));
|
||||||
|
|
||||||
// you can transmit C-string or Arduino string up to 63 characters long
|
// you can transmit C-string or Arduino string up to 255 characters long
|
||||||
String str = "Hello World! #" + String(count++);
|
String str = "Hello World! #" + String(count++);
|
||||||
int state = radio.transmit(str);
|
int state = radio.transmit(str);
|
||||||
|
|
||||||
// you can also transmit byte array up to 63 bytes long
|
// you can also transmit byte array up to 255 bytes long with some limitations; https://github.com/jgromes/RadioLib/discussions/1138
|
||||||
/*
|
/*
|
||||||
byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
|
byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
|
||||||
int state = radio.transmit(byteArr, 8);
|
int state = radio.transmit(byteArr, 8);
|
||||||
|
@ -68,7 +72,7 @@ void loop() {
|
||||||
Serial.println(F("success!"));
|
Serial.println(F("success!"));
|
||||||
|
|
||||||
} else if (state == RADIOLIB_ERR_PACKET_TOO_LONG) {
|
} else if (state == RADIOLIB_ERR_PACKET_TOO_LONG) {
|
||||||
// the supplied packet was longer than 64 bytes
|
// the supplied packet was longer than 255 bytes
|
||||||
Serial.println(F("too long!"));
|
Serial.println(F("too long!"));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
This example transmits packets using CC1101 FSK radio module.
|
This example transmits packets using CC1101 FSK radio module.
|
||||||
Once a packet is transmitted, an interrupt is triggered.
|
Once a packet is transmitted, an interrupt is triggered.
|
||||||
Each packet contains up to 64 bytes of data, in the form of:
|
Each packet contains up to 255 bytes of data with some limitations (https://github.com/jgromes/RadioLib/discussions/1138), in the form of:
|
||||||
- Arduino String
|
- Arduino String
|
||||||
- null-terminated char array (C-string)
|
- null-terminated char array (C-string)
|
||||||
- arbitrary binary data (byte array)
|
- arbitrary binary data (byte array)
|
||||||
|
@ -25,13 +25,32 @@
|
||||||
// GDO2 pin: 3
|
// GDO2 pin: 3
|
||||||
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//CC1101 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// save transmission state between loops
|
// save transmission state between loops
|
||||||
int transmissionState = RADIOLIB_ERR_NONE;
|
int transmissionState = RADIOLIB_ERR_NONE;
|
||||||
|
|
||||||
|
// flag to indicate that a packet was sent
|
||||||
|
volatile bool transmittedFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a complete packet
|
||||||
|
// is transmitted by the module
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlag(void) {
|
||||||
|
// we sent a packet, set the flag
|
||||||
|
transmittedFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
@ -54,10 +73,12 @@ void setup() {
|
||||||
Serial.print(F("[CC1101] Sending first packet ... "));
|
Serial.print(F("[CC1101] Sending first packet ... "));
|
||||||
|
|
||||||
// you can transmit C-string or Arduino string up to
|
// you can transmit C-string or Arduino string up to
|
||||||
// 64 characters long
|
// 255 characters long
|
||||||
transmissionState = radio.startTransmit("Hello World!");
|
transmissionState = radio.startTransmit("Hello World!");
|
||||||
|
|
||||||
// you can also transmit byte array up to 64 bytes long
|
// you can also transmit byte array up to 255 bytes long
|
||||||
|
// When transmitting more than 64 bytes startTransmit blocks to refill the FIFO.
|
||||||
|
// Blocking ceases once the last bytes have been placed in the FIFO
|
||||||
/*
|
/*
|
||||||
byte byteArr[] = {0x01, 0x23, 0x45, 0x56,
|
byte byteArr[] = {0x01, 0x23, 0x45, 0x56,
|
||||||
0x78, 0xAB, 0xCD, 0xEF};
|
0x78, 0xAB, 0xCD, 0xEF};
|
||||||
|
@ -65,21 +86,6 @@ void setup() {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a packet was sent
|
|
||||||
volatile bool transmittedFlag = false;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
|
||||||
// is transmitted by the module
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlag(void) {
|
|
||||||
// we sent a packet, set the flag
|
|
||||||
transmittedFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// counter to keep track of transmitted packets
|
// counter to keep track of transmitted packets
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
@ -115,11 +121,11 @@ void loop() {
|
||||||
Serial.print(F("[CC1101] Sending another packet ... "));
|
Serial.print(F("[CC1101] Sending another packet ... "));
|
||||||
|
|
||||||
// you can transmit C-string or Arduino string up to
|
// you can transmit C-string or Arduino string up to
|
||||||
// 256 characters long
|
// 255 characters long
|
||||||
String str = "Hello World! #" + String(count++);
|
String str = "Hello World! #" + String(count++);
|
||||||
transmissionState = radio.startTransmit(str);
|
transmissionState = radio.startTransmit(str);
|
||||||
|
|
||||||
// you can also transmit byte array up to 256 bytes long
|
// you can also transmit byte array up to 255 bytes long with limitations https://github.com/jgromes/RadioLib/discussions/1138
|
||||||
/*
|
/*
|
||||||
byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
|
byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
|
||||||
0x89, 0xAB, 0xCD, 0xEF};
|
0x89, 0xAB, 0xCD, 0xEF};
|
||||||
|
|
|
@ -34,9 +34,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create FSK4 client instance using the FSK module
|
// create FSK4 client instance using the FSK module
|
||||||
FSK4Client fsk4(&radio);
|
FSK4Client fsk4(&radio);
|
||||||
|
|
|
@ -32,9 +32,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// this requires connection to the module direct
|
// this requires connection to the module direct
|
||||||
|
|
|
@ -32,9 +32,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create Hellschreiber client instance using the FSK module
|
// create Hellschreiber client instance using the FSK module
|
||||||
HellClient hell(&radio);
|
HellClient hell(&radio);
|
||||||
|
|
|
@ -31,9 +31,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// this requires connection to the module direct
|
// this requires connection to the module direct
|
||||||
|
|
|
@ -34,6 +34,14 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// set RF switch configuration for Wio WM1110
|
// set RF switch configuration for Wio WM1110
|
||||||
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
// NOTE: other boards may be different!
|
// NOTE: other boards may be different!
|
||||||
|
@ -57,10 +65,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// set RF switch control configuration
|
|
||||||
// this has to be done prior to calling begin()
|
|
||||||
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
|
||||||
|
|
||||||
// initialize LR1110 with default settings
|
// initialize LR1110 with default settings
|
||||||
Serial.print(F("[LR1110] Initializing ... "));
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
int state = radio.begin();
|
int state = radio.begin();
|
||||||
|
@ -71,6 +75,9 @@ void setup() {
|
||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
while (true) { delay(10); }
|
while (true) { delay(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
|
@ -29,6 +29,14 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// set RF switch configuration for Wio WM1110
|
// set RF switch configuration for Wio WM1110
|
||||||
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
// NOTE: other boards may be different!
|
// NOTE: other boards may be different!
|
||||||
|
@ -49,13 +57,24 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
END_OF_MODE_TABLE,
|
END_OF_MODE_TABLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// flag to indicate that a packet was detected or CAD timed out
|
||||||
|
volatile bool scanFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a complete packet
|
||||||
|
// is received by the module
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlag(void) {
|
||||||
|
// something happened, set the flag
|
||||||
|
scanFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// set RF switch control configuration
|
|
||||||
// this has to be done prior to calling begin()
|
|
||||||
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
|
||||||
|
|
||||||
// initialize LR1110 with default settings
|
// initialize LR1110 with default settings
|
||||||
Serial.print(F("[LR1110] Initializing ... "));
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
int state = radio.begin();
|
int state = radio.begin();
|
||||||
|
@ -67,6 +86,9 @@ void setup() {
|
||||||
while (true) { delay(10); }
|
while (true) { delay(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
|
|
||||||
// set the function that will be called
|
// set the function that will be called
|
||||||
// when LoRa packet or timeout is detected
|
// when LoRa packet or timeout is detected
|
||||||
radio.setIrqAction(setFlag);
|
radio.setIrqAction(setFlag);
|
||||||
|
@ -82,21 +104,6 @@ void setup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a packet was detected or CAD timed out
|
|
||||||
volatile bool scanFlag = false;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
|
||||||
// is received by the module
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlag(void) {
|
|
||||||
// something happened, set the flag
|
|
||||||
scanFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(scanFlag) {
|
if(scanFlag) {
|
||||||
|
|
|
@ -48,9 +48,13 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//LR1110 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -26,9 +26,13 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//LR1110 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -0,0 +1,182 @@
|
||||||
|
/*
|
||||||
|
RadioLib LR11x0 GNSS Almanac Update Example
|
||||||
|
|
||||||
|
This example updates the LR11x0 GNSS almanac.
|
||||||
|
Almanac is a database of orbital predictions of
|
||||||
|
GNSS satellites, which allows the module to predict
|
||||||
|
when different satellites will appear in the sky,
|
||||||
|
and frequency of their signal.
|
||||||
|
|
||||||
|
Up-to-date almanac is necessary for operation!
|
||||||
|
After an update, data will remain valid for 30 days.
|
||||||
|
All GNSS examples require at least limited
|
||||||
|
visibility of the sky!
|
||||||
|
|
||||||
|
NOTE: This example will only work for LR11x0 devices
|
||||||
|
with sufficiently recent firmware!
|
||||||
|
LR1110: 4.1
|
||||||
|
LR1120: 2.1
|
||||||
|
If your device firmware reports older firmware,
|
||||||
|
update it using the LR11x0_Firmware_Update example.
|
||||||
|
|
||||||
|
For full API reference, see the GitHub Pages
|
||||||
|
https://jgromes.github.io/RadioLib/
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library
|
||||||
|
#include <RadioLib.h>
|
||||||
|
|
||||||
|
// LR1110 has the following connections:
|
||||||
|
// NSS pin: 10
|
||||||
|
// DIO1 pin: 2
|
||||||
|
// NRST pin: 3
|
||||||
|
// BUSY pin: 9
|
||||||
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
|
// set RF switch configuration for Wio WM1110
|
||||||
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
|
// NOTE: other boards may be different!
|
||||||
|
static const uint32_t rfswitch_dio_pins[] = {
|
||||||
|
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
|
||||||
|
RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC
|
||||||
|
};
|
||||||
|
|
||||||
|
static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
|
// mode DIO5 DIO6
|
||||||
|
{ LR11x0::MODE_STBY, { LOW, LOW } },
|
||||||
|
{ LR11x0::MODE_RX, { HIGH, LOW } },
|
||||||
|
{ LR11x0::MODE_TX, { HIGH, HIGH } },
|
||||||
|
{ LR11x0::MODE_TX_HP, { LOW, HIGH } },
|
||||||
|
{ LR11x0::MODE_TX_HF, { LOW, LOW } },
|
||||||
|
{ LR11x0::MODE_GNSS, { LOW, LOW } },
|
||||||
|
{ LR11x0::MODE_WIFI, { LOW, LOW } },
|
||||||
|
END_OF_MODE_TABLE,
|
||||||
|
};
|
||||||
|
|
||||||
|
// structure to save information about the GNSS almanac
|
||||||
|
LR11x0GnssAlmanacStatus_t almStatus;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
// initialize LR1110 with default settings
|
||||||
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
|
int state = radio.beginGNSS(RADIOLIB_LR11X0_GNSS_CONSTELLATION_GPS);
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.println(F("success!"));
|
||||||
|
} else {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
|
|
||||||
|
// check the firmware version
|
||||||
|
Serial.print(F("[LR1110] Checking firmware version ... "));
|
||||||
|
state = radio.isGnssScanCapable();
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.println(F("check passed!"));
|
||||||
|
} else {
|
||||||
|
Serial.println(F("check failed, firmware update needed."));
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// run GNSS scans until we get at least the time
|
||||||
|
// NOTE: Depending on visibility of satellites,
|
||||||
|
// this may take multiple attempts!
|
||||||
|
while(true) {
|
||||||
|
// run GNSS scan
|
||||||
|
Serial.print(F("[LR1110] Running GNSS scan ... "));
|
||||||
|
state = radio.gnssScan(NULL);
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.println(F("success!"));
|
||||||
|
} else {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// check almanac status
|
||||||
|
Serial.print(F("[LR1110] Checking GNSS almanac ... "));
|
||||||
|
state = radio.getGnssAlmanacStatus(&almStatus);
|
||||||
|
if (state != RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// we have the status, check if we have demodulated time
|
||||||
|
if(almStatus.gps.status < RADIOLIB_LR11X0_GNSS_ALMANAC_STATUS_UP_TO_DATE) {
|
||||||
|
Serial.println(F("time unknown, another scan needed."));
|
||||||
|
|
||||||
|
} else if(almStatus.gps.numUpdateNeeded > 0) {
|
||||||
|
Serial.print(almStatus.gps.numUpdateNeeded);
|
||||||
|
Serial.println(F(" satellites out-of-date."));
|
||||||
|
break;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Serial.println(F("no update needed!"));
|
||||||
|
while (true) { delay(10); }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// wait until almanac data is available in the signal
|
||||||
|
// multiple attempts are needed for this
|
||||||
|
Serial.print(F("[LR1110] Waiting for subframe ... "));
|
||||||
|
int state = radio.gnssDelayUntilSubframe(&almStatus, RADIOLIB_LR11X0_GNSS_CONSTELLATION_GPS);
|
||||||
|
if(state == RADIOLIB_ERR_GNSS_SUBFRAME_NOT_AVAILABLE) {
|
||||||
|
Serial.println(F("not enough time left."));
|
||||||
|
|
||||||
|
// wait until the next update window
|
||||||
|
delay(2000);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Serial.println(F("done!"));
|
||||||
|
|
||||||
|
// we have enough time to start the update
|
||||||
|
Serial.print(F("[LR1110] Starting update ... "));
|
||||||
|
state = radio.updateGnssAlmanac(RADIOLIB_LR11X0_GNSS_CONSTELLATION_GPS);
|
||||||
|
if(state != RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
} else {
|
||||||
|
Serial.println(F("done!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// check whether another update is needed
|
||||||
|
Serial.print(F("[LR1110] Checking GNSS almanac ... "));
|
||||||
|
state = radio.getGnssAlmanacStatus(&almStatus);
|
||||||
|
if(state != RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if we have completed the update
|
||||||
|
if(almStatus.gps.numUpdateNeeded == 0) {
|
||||||
|
Serial.println(F("all satellites up-to-date!"));
|
||||||
|
while (true) { delay(10); }
|
||||||
|
} else {
|
||||||
|
Serial.print(almStatus.gps.numUpdateNeeded);
|
||||||
|
Serial.println(F(" satellites out-of-date."));
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait a bit before the next update attempt
|
||||||
|
delay(1000);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,134 @@
|
||||||
|
/*
|
||||||
|
RadioLib LR11x0 GNSS Autonomous Position Example
|
||||||
|
|
||||||
|
This example performs GNSS scans and calculates
|
||||||
|
position of the device using autonomous mode.
|
||||||
|
In this mode, scan data does not need to be uploaded
|
||||||
|
to LoRaCloud, however, it requires up-to-date almanac
|
||||||
|
data. Run the LR11x0_Almanac_Update example to update
|
||||||
|
the device almanac.
|
||||||
|
|
||||||
|
NOTE: This example will only work for LR11x0 devices
|
||||||
|
with sufficiently recent firmware!
|
||||||
|
LR1110: 4.1
|
||||||
|
LR1120: 2.1
|
||||||
|
If your device firmware reports older firmware,
|
||||||
|
update it using the LR11x0_Firmware_Update example.
|
||||||
|
|
||||||
|
For full API reference, see the GitHub Pages
|
||||||
|
https://jgromes.github.io/RadioLib/
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library
|
||||||
|
#include <RadioLib.h>
|
||||||
|
|
||||||
|
// LR1110 has the following connections:
|
||||||
|
// NSS pin: 10
|
||||||
|
// DIO1 pin: 2
|
||||||
|
// NRST pin: 3
|
||||||
|
// BUSY pin: 9
|
||||||
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
|
// set RF switch configuration for Wio WM1110
|
||||||
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
|
// NOTE: other boards may be different!
|
||||||
|
static const uint32_t rfswitch_dio_pins[] = {
|
||||||
|
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
|
||||||
|
RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC
|
||||||
|
};
|
||||||
|
|
||||||
|
static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
|
// mode DIO5 DIO6
|
||||||
|
{ LR11x0::MODE_STBY, { LOW, LOW } },
|
||||||
|
{ LR11x0::MODE_RX, { HIGH, LOW } },
|
||||||
|
{ LR11x0::MODE_TX, { HIGH, HIGH } },
|
||||||
|
{ LR11x0::MODE_TX_HP, { LOW, HIGH } },
|
||||||
|
{ LR11x0::MODE_TX_HF, { LOW, LOW } },
|
||||||
|
{ LR11x0::MODE_GNSS, { LOW, LOW } },
|
||||||
|
{ LR11x0::MODE_WIFI, { LOW, LOW } },
|
||||||
|
END_OF_MODE_TABLE,
|
||||||
|
};
|
||||||
|
|
||||||
|
// structure to save information about the GNSS scan result
|
||||||
|
LR11x0GnssResult_t gnssResult;
|
||||||
|
|
||||||
|
// structure to save information about the calculated GNSS position
|
||||||
|
LR11x0GnssPosition_t gnssPosition;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
// initialize LR1110 with default settings
|
||||||
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
|
int state = radio.beginGNSS(RADIOLIB_LR11X0_GNSS_CONSTELLATION_GPS);
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.println(F("success!"));
|
||||||
|
} else {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
|
|
||||||
|
// check the firmware version
|
||||||
|
Serial.print(F("[LR1110] Checking firmware version ... "));
|
||||||
|
state = radio.isGnssScanCapable();
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.println(F("check passed!"));
|
||||||
|
} else {
|
||||||
|
Serial.println(F("check failed, firmware update needed."));
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
Serial.println(F("Scan result\t| Latitude\t| Longitude\t| Accuracy\t| Number of satellites"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// run GNSS scan
|
||||||
|
int state = radio.gnssScan(&gnssResult);
|
||||||
|
if(state == RADIOLIB_ERR_NONE) {
|
||||||
|
// success!
|
||||||
|
Serial.print(gnssResult.demodStat); Serial.print("\t\t| ");
|
||||||
|
|
||||||
|
// get the actual data
|
||||||
|
state = radio.getGnssPosition(&gnssPosition);
|
||||||
|
if(state == RADIOLIB_ERR_NONE) {
|
||||||
|
// print the position
|
||||||
|
Serial.print(gnssPosition.latitude, 6);
|
||||||
|
Serial.print("\t| ");
|
||||||
|
Serial.print(gnssPosition.longitude, 6);
|
||||||
|
Serial.print("\t| ");
|
||||||
|
Serial.print(gnssPosition.accuracy);
|
||||||
|
Serial.print("\t\t| ");
|
||||||
|
Serial.println(gnssPosition.numSatsUsed);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Serial.print(F("Failed to read result, code "));
|
||||||
|
Serial.print(state);
|
||||||
|
Serial.print(F(" (solver error "));
|
||||||
|
Serial.print(RADIOLIB_GET_GNSS_SOLVER_ERROR(state));
|
||||||
|
Serial.println(F(")"));
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Serial.print(F("Scan failed, code "));
|
||||||
|
Serial.print(state);
|
||||||
|
Serial.print(F(" (demodulator error "));
|
||||||
|
Serial.print(RADIOLIB_GET_GNSS_DEMOD_ERROR(state));
|
||||||
|
Serial.println(F(")"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait a bit before the next scan
|
||||||
|
delay(1000);
|
||||||
|
}
|
|
@ -0,0 +1,133 @@
|
||||||
|
/*
|
||||||
|
RadioLib LR11x0 GNSS Satellites Example
|
||||||
|
|
||||||
|
This example performs GNSS scans and shows the satellites
|
||||||
|
currently in view. It is mostly useful to verify
|
||||||
|
visibility and antenna setup.
|
||||||
|
|
||||||
|
NOTE: This example will only work for LR11x0 devices
|
||||||
|
with sufficiently recent firmware!
|
||||||
|
LR1110: 4.1
|
||||||
|
LR1120: 2.1
|
||||||
|
If your device firmware reports older firmware,
|
||||||
|
update it using the LR11x0_Firmware_Update example.
|
||||||
|
|
||||||
|
For default module settings, see the wiki page
|
||||||
|
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---wifi-scan
|
||||||
|
|
||||||
|
For full API reference, see the GitHub Pages
|
||||||
|
https://jgromes.github.io/RadioLib/
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library
|
||||||
|
#include <RadioLib.h>
|
||||||
|
|
||||||
|
// LR1110 has the following connections:
|
||||||
|
// NSS pin: 10
|
||||||
|
// DIO1 pin: 2
|
||||||
|
// NRST pin: 3
|
||||||
|
// BUSY pin: 9
|
||||||
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
|
// set RF switch configuration for Wio WM1110
|
||||||
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
|
// NOTE: other boards may be different!
|
||||||
|
static const uint32_t rfswitch_dio_pins[] = {
|
||||||
|
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
|
||||||
|
RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC
|
||||||
|
};
|
||||||
|
|
||||||
|
static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
|
// mode DIO5 DIO6
|
||||||
|
{ LR11x0::MODE_STBY, { LOW, LOW } },
|
||||||
|
{ LR11x0::MODE_RX, { HIGH, LOW } },
|
||||||
|
{ LR11x0::MODE_TX, { HIGH, HIGH } },
|
||||||
|
{ LR11x0::MODE_TX_HP, { LOW, HIGH } },
|
||||||
|
{ LR11x0::MODE_TX_HF, { LOW, LOW } },
|
||||||
|
{ LR11x0::MODE_GNSS, { LOW, LOW } },
|
||||||
|
{ LR11x0::MODE_WIFI, { LOW, LOW } },
|
||||||
|
END_OF_MODE_TABLE,
|
||||||
|
};
|
||||||
|
|
||||||
|
// structure to save information about the GNSS scan result
|
||||||
|
LR11x0GnssResult_t gnssResult;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
// initialize LR1110 with default settings
|
||||||
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
|
int state = radio.beginGNSS(RADIOLIB_LR11X0_GNSS_CONSTELLATION_GPS);
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.println(F("success!"));
|
||||||
|
} else {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
|
|
||||||
|
// check the firmware version
|
||||||
|
Serial.print(F("[LR1110] Checking firmware version ... "));
|
||||||
|
state = radio.isGnssScanCapable();
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.println(F("check passed!"));
|
||||||
|
} else {
|
||||||
|
Serial.println(F("check failed, firmware update needed."));
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
Serial.print(F("[LR1110] Running GNSS scan ... "));
|
||||||
|
int state = radio.gnssScan(&gnssResult);
|
||||||
|
if(state != RADIOLIB_ERR_NONE) {
|
||||||
|
// some error occurred
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.print(state);
|
||||||
|
Serial.print(F(" (demodulator error "));
|
||||||
|
Serial.print(RADIOLIB_GET_GNSS_DEMOD_ERROR(state));
|
||||||
|
Serial.println(F(")"));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Serial.println(F("success!"));
|
||||||
|
|
||||||
|
// print the table header
|
||||||
|
Serial.print(F("[LR1110] Detected "));
|
||||||
|
Serial.print(gnssResult.numSatsDet);
|
||||||
|
Serial.println(F(" satellite(s):"));
|
||||||
|
Serial.println(F(" # | ID | C/N0 [dB]\t| Doppler [Hz]"));
|
||||||
|
|
||||||
|
// read all results at once
|
||||||
|
LR11x0GnssSatellite_t satellites[32];
|
||||||
|
state = radio.getGnssSatellites(satellites, gnssResult.numSatsDet);
|
||||||
|
if(state != RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.print(F("Failed to read results, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
} else {
|
||||||
|
// print all the results
|
||||||
|
for(int i = 0; i < gnssResult.numSatsDet; i++) {
|
||||||
|
if(i < 10) { Serial.print(" "); } Serial.print(i); Serial.print(" | ");
|
||||||
|
Serial.print(satellites[i].svId); Serial.print(" | ");
|
||||||
|
Serial.print(satellites[i].c_n0); Serial.print("\t\t| ");
|
||||||
|
Serial.println(satellites[i].doppler);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait for a second before scanning again
|
||||||
|
delay(1000);
|
||||||
|
}
|
|
@ -27,9 +27,13 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//LR1110 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
@ -58,7 +62,8 @@ void setup() {
|
||||||
3, // header count
|
3, // header count
|
||||||
0x13A); // hopping sequence seed
|
0x13A); // hopping sequence seed
|
||||||
state = radio.setOutputPower(10.0);
|
state = radio.setOutputPower(10.0);
|
||||||
state = radio.setSyncWord(0x12345678);
|
uint8_t syncWord[] = {0x01, 0x23, 0x45, 0x67};
|
||||||
|
state = radio.setSyncWord(syncWord, 4);
|
||||||
if (state != RADIOLIB_ERR_NONE) {
|
if (state != RADIOLIB_ERR_NONE) {
|
||||||
Serial.print(F("Unable to set configuration, code "));
|
Serial.print(F("Unable to set configuration, code "));
|
||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
|
|
|
@ -22,6 +22,14 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// set RF switch configuration for Wio WM1110
|
// set RF switch configuration for Wio WM1110
|
||||||
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
// NOTE: other boards may be different!
|
// NOTE: other boards may be different!
|
||||||
|
@ -66,10 +74,6 @@ void setFlag(void) {
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// set RF switch control configuration
|
|
||||||
// this has to be done prior to calling begin()
|
|
||||||
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
|
||||||
|
|
||||||
// initialize LR1110 with default settings
|
// initialize LR1110 with default settings
|
||||||
Serial.print(F("[LR1110] Initializing ... "));
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
int state = radio.begin();
|
int state = radio.begin();
|
||||||
|
@ -81,6 +85,9 @@ void setup() {
|
||||||
while (true) { delay(10); }
|
while (true) { delay(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
|
|
||||||
// set the function that will be called
|
// set the function that will be called
|
||||||
// when new packet is received
|
// when new packet is received
|
||||||
radio.setIrqAction(setFlag);
|
radio.setIrqAction(setFlag);
|
||||||
|
|
|
@ -39,6 +39,14 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// set RF switch configuration for Wio WM1110
|
// set RF switch configuration for Wio WM1110
|
||||||
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
// NOTE: other boards may be different!
|
// NOTE: other boards may be different!
|
||||||
|
@ -62,10 +70,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// set RF switch control configuration
|
|
||||||
// this has to be done prior to calling begin()
|
|
||||||
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
|
||||||
|
|
||||||
// initialize LR1110 with default settings
|
// initialize LR1110 with default settings
|
||||||
Serial.print(F("[LR1110] Initializing ... "));
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
int state = radio.begin();
|
int state = radio.begin();
|
||||||
|
@ -76,6 +80,9 @@ void setup() {
|
||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
while (true) { delay(10); }
|
while (true) { delay(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
|
@ -35,6 +35,14 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// set RF switch configuration for Wio WM1110
|
// set RF switch configuration for Wio WM1110
|
||||||
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
// NOTE: other boards may be different!
|
// NOTE: other boards may be different!
|
||||||
|
@ -55,13 +63,24 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
END_OF_MODE_TABLE,
|
END_OF_MODE_TABLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// flag to indicate that a packet was received
|
||||||
|
volatile bool receivedFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a complete packet
|
||||||
|
// is received by the module
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlag(void) {
|
||||||
|
// we got a packet, set the flag
|
||||||
|
receivedFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// set RF switch control configuration
|
|
||||||
// this has to be done prior to calling begin()
|
|
||||||
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
|
||||||
|
|
||||||
// initialize LR1110 with default settings
|
// initialize LR1110 with default settings
|
||||||
Serial.print(F("[LR1110] Initializing ... "));
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
int state = radio.begin();
|
int state = radio.begin();
|
||||||
|
@ -73,6 +92,9 @@ void setup() {
|
||||||
while (true) { delay(10); }
|
while (true) { delay(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
|
|
||||||
// set the function that will be called
|
// set the function that will be called
|
||||||
// when new packet is received
|
// when new packet is received
|
||||||
radio.setPacketReceivedAction(setFlag);
|
radio.setPacketReceivedAction(setFlag);
|
||||||
|
@ -98,21 +120,6 @@ void setup() {
|
||||||
// radio.scanChannel();
|
// radio.scanChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a packet was received
|
|
||||||
volatile bool receivedFlag = false;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
|
||||||
// is received by the module
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlag(void) {
|
|
||||||
// we got a packet, set the flag
|
|
||||||
receivedFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(receivedFlag) {
|
if(receivedFlag) {
|
||||||
|
|
|
@ -30,6 +30,14 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// set RF switch configuration for Wio WM1110
|
// set RF switch configuration for Wio WM1110
|
||||||
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
// NOTE: other boards may be different!
|
// NOTE: other boards may be different!
|
||||||
|
@ -53,10 +61,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// set RF switch control configuration
|
|
||||||
// this has to be done prior to calling begin()
|
|
||||||
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
|
||||||
|
|
||||||
// initialize LR1110 with default settings
|
// initialize LR1110 with default settings
|
||||||
Serial.print(F("[LR1110] Initializing ... "));
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
int state = radio.begin();
|
int state = radio.begin();
|
||||||
|
@ -68,6 +72,9 @@ void setup() {
|
||||||
delay(1000);
|
delay(1000);
|
||||||
while (true) { delay(10); }
|
while (true) { delay(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
// counter to keep track of transmitted packets
|
// counter to keep track of transmitted packets
|
||||||
|
|
|
@ -31,6 +31,14 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// set RF switch configuration for Wio WM1110
|
// set RF switch configuration for Wio WM1110
|
||||||
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
// NOTE: other boards may be different!
|
// NOTE: other boards may be different!
|
||||||
|
@ -54,13 +62,24 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
// save transmission state between loops
|
// save transmission state between loops
|
||||||
int transmissionState = RADIOLIB_ERR_NONE;
|
int transmissionState = RADIOLIB_ERR_NONE;
|
||||||
|
|
||||||
|
// flag to indicate that a packet was sent
|
||||||
|
volatile bool transmittedFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a complete packet
|
||||||
|
// is transmitted by the module
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlag(void) {
|
||||||
|
// we sent a packet, set the flag
|
||||||
|
transmittedFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// set RF switch control configuration
|
|
||||||
// this has to be done prior to calling begin()
|
|
||||||
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
|
||||||
|
|
||||||
// initialize LR1110 with default settings
|
// initialize LR1110 with default settings
|
||||||
Serial.print(F("[LR1110] Initializing ... "));
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
int state = radio.begin();
|
int state = radio.begin();
|
||||||
|
@ -72,6 +91,9 @@ void setup() {
|
||||||
while (true) { delay(10); }
|
while (true) { delay(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
|
|
||||||
// set the function that will be called
|
// set the function that will be called
|
||||||
// when packet transmission is finished
|
// when packet transmission is finished
|
||||||
radio.setPacketSentAction(setFlag);
|
radio.setPacketSentAction(setFlag);
|
||||||
|
@ -91,21 +113,6 @@ void setup() {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a packet was sent
|
|
||||||
volatile bool transmittedFlag = false;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
|
||||||
// is transmitted by the module
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlag(void) {
|
|
||||||
// we sent a packet, set the flag
|
|
||||||
transmittedFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// counter to keep track of transmitted packets
|
// counter to keep track of transmitted packets
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,14 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// set RF switch configuration for Wio WM1110
|
// set RF switch configuration for Wio WM1110
|
||||||
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
// NOTE: other boards may be different!
|
// NOTE: other boards may be different!
|
||||||
|
@ -55,10 +63,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// set RF switch control configuration
|
|
||||||
// this has to be done prior to calling begin()
|
|
||||||
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
|
||||||
|
|
||||||
// initialize LR1110 with default settings
|
// initialize LR1110 with default settings
|
||||||
Serial.print(F("[LR1110] Initializing ... "));
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
int state = radio.begin();
|
int state = radio.begin();
|
||||||
|
@ -69,6 +73,9 @@ void setup() {
|
||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
while (true) { delay(10); }
|
while (true) { delay(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
|
@ -32,6 +32,14 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// set RF switch configuration for Wio WM1110
|
// set RF switch configuration for Wio WM1110
|
||||||
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
// NOTE: other boards may be different!
|
// NOTE: other boards may be different!
|
||||||
|
@ -52,13 +60,23 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
END_OF_MODE_TABLE,
|
END_OF_MODE_TABLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// flag to indicate that a scan was completed
|
||||||
|
volatile bool scanFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a scan is completed
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlag(void) {
|
||||||
|
// scan is complete, set the flag
|
||||||
|
scanFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// set RF switch control configuration
|
|
||||||
// this has to be done prior to calling begin()
|
|
||||||
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
|
||||||
|
|
||||||
// initialize LR1110 with default settings
|
// initialize LR1110 with default settings
|
||||||
Serial.print(F("[LR1110] Initializing ... "));
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
int state = radio.begin();
|
int state = radio.begin();
|
||||||
|
@ -70,6 +88,9 @@ void setup() {
|
||||||
while (true) { delay(10); }
|
while (true) { delay(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
|
|
||||||
// set the function that will be called
|
// set the function that will be called
|
||||||
// when WiFi scan is complete
|
// when WiFi scan is complete
|
||||||
radio.setIrqAction(setFlag);
|
radio.setIrqAction(setFlag);
|
||||||
|
@ -85,20 +106,6 @@ void setup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a scan was completed
|
|
||||||
volatile bool scanFlag = false;
|
|
||||||
|
|
||||||
// this function is called when a scan is completed
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlag(void) {
|
|
||||||
// scan is complete, set the flag
|
|
||||||
scanFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(scanFlag) {
|
if(scanFlag) {
|
||||||
|
|
|
@ -41,9 +41,11 @@ const uint32_t uplinkIntervalSeconds = 5UL * 60UL; // minutes x seconds
|
||||||
// for the curious, the #ifndef blocks allow for automated testing &/or you can
|
// for the curious, the #ifndef blocks allow for automated testing &/or you can
|
||||||
// put your EUI & keys in to your platformio.ini - see wiki for more tips
|
// put your EUI & keys in to your platformio.ini - see wiki for more tips
|
||||||
|
|
||||||
// regional choices: EU868, US915, AU915, AS923, AS923_2, AS923_3, AS923_4, IN865, KR920, CN500
|
// regional choices: EU868, US915, AU915, AS923, AS923_2, AS923_3, AS923_4, IN865, KR920, CN470
|
||||||
const LoRaWANBand_t Region = EU868;
|
const LoRaWANBand_t Region = EU868;
|
||||||
const uint8_t subBand = 0; // For US915, change this to 2, otherwise leave on 0
|
|
||||||
|
// subband choice: for US915/AU915 set to 2, for CN470 set to 1, otherwise leave on 0
|
||||||
|
const uint8_t subBand = 0;
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Below is to support the sketch - only make changes if the notes say so ...
|
// Below is to support the sketch - only make changes if the notes say so ...
|
||||||
|
|
|
@ -48,6 +48,9 @@ void setup() {
|
||||||
// Override the default join rate
|
// Override the default join rate
|
||||||
uint8_t joinDR = 4;
|
uint8_t joinDR = 4;
|
||||||
|
|
||||||
|
// Optionally provide a custom sleep function - see config.h
|
||||||
|
//node.setSleepFunction(customDelay);
|
||||||
|
|
||||||
// Setup the OTAA session information
|
// Setup the OTAA session information
|
||||||
node.beginOTAA(joinEUI, devEUI, nwkKey, appKey);
|
node.beginOTAA(joinEUI, devEUI, nwkKey, appKey);
|
||||||
|
|
||||||
|
@ -68,7 +71,7 @@ void setup() {
|
||||||
// Manages uplink intervals to the TTN Fair Use Policy
|
// Manages uplink intervals to the TTN Fair Use Policy
|
||||||
node.setDutyCycle(true, 1250);
|
node.setDutyCycle(true, 1250);
|
||||||
|
|
||||||
// Enable the dwell time limits - 400ms is the limit for the US
|
// Update dwell time limits - 400ms is the limit for the US
|
||||||
node.setDwellTime(true, 400);
|
node.setDwellTime(true, 400);
|
||||||
|
|
||||||
Serial.println(F("Ready!\n"));
|
Serial.println(F("Ready!\n"));
|
||||||
|
|
|
@ -37,9 +37,11 @@ const uint32_t uplinkIntervalSeconds = 5UL * 60UL; // minutes x seconds
|
||||||
// for the curious, the #ifndef blocks allow for automated testing &/or you can
|
// for the curious, the #ifndef blocks allow for automated testing &/or you can
|
||||||
// put your EUI & keys in to your platformio.ini - see wiki for more tips
|
// put your EUI & keys in to your platformio.ini - see wiki for more tips
|
||||||
|
|
||||||
// regional choices: EU868, US915, AU915, AS923, AS923_2, AS923_3, AS923_4, IN865, KR920, CN500
|
// regional choices: EU868, US915, AU915, AS923, AS923_2, AS923_3, AS923_4, IN865, KR920, CN470
|
||||||
const LoRaWANBand_t Region = EU868;
|
const LoRaWANBand_t Region = EU868;
|
||||||
const uint8_t subBand = 0; // For US915, change this to 2, otherwise leave on 0
|
|
||||||
|
// subband choice: for US915/AU915 set to 2, for CN470 set to 1, otherwise leave on 0
|
||||||
|
const uint8_t subBand = 0;
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Below is to support the sketch - only make changes if the notes say so ...
|
// Below is to support the sketch - only make changes if the notes say so ...
|
||||||
|
@ -142,4 +144,19 @@ void arrayDump(uint8_t *buffer, uint16_t len) {
|
||||||
Serial.println();
|
Serial.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Custom delay function:
|
||||||
|
// Communication over LoRaWAN includes a lot of delays.
|
||||||
|
// By default, RadioLib will use the Arduino delay() function,
|
||||||
|
// which will waste a lot of power. However, you can put your
|
||||||
|
// microcontroller to sleep instead by customizing the function below,
|
||||||
|
// and providing it to RadioLib via "node.setSleepFunction".
|
||||||
|
// NOTE: You ahve to ensure that this function is timed precisely, and
|
||||||
|
// does actually wait for the amount of time specified!
|
||||||
|
// Failure to do so will result in missed downlinks or failed join!
|
||||||
|
void customDelay(RadioLibTime_t ms) {
|
||||||
|
// this is just an example, so we use the Arduino delay() function,
|
||||||
|
// but you can put your microcontroller to sleep here
|
||||||
|
::delay(ms);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,9 +37,11 @@ const uint32_t uplinkIntervalSeconds = 5UL * 60UL; // minutes x seconds
|
||||||
// for the curious, the #ifndef blocks allow for automated testing &/or you can
|
// for the curious, the #ifndef blocks allow for automated testing &/or you can
|
||||||
// put your EUI & keys in to your platformio.ini - see wiki for more tips
|
// put your EUI & keys in to your platformio.ini - see wiki for more tips
|
||||||
|
|
||||||
// regional choices: EU868, US915, AU915, AS923, AS923_2, AS923_3, AS923_4, IN865, KR920, CN500
|
// regional choices: EU868, US915, AU915, AS923, AS923_2, AS923_3, AS923_4, IN865, KR920, CN470
|
||||||
const LoRaWANBand_t Region = EU868;
|
const LoRaWANBand_t Region = EU868;
|
||||||
const uint8_t subBand = 0; // For US915, change this to 2, otherwise leave on 0
|
|
||||||
|
// subband choice: for US915/AU915 set to 2, for CN470 set to 1, otherwise leave on 0
|
||||||
|
const uint8_t subBand = 0;
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Below is to support the sketch - only make changes if the notes say so ...
|
// Below is to support the sketch - only make changes if the notes say so ...
|
||||||
|
|
|
@ -52,7 +52,7 @@ You are making your own device using a third party LoRaWAN stack so there will n
|
||||||
|
|
||||||
Choose the Frequency plan appropriate for your region. Consider that almost all countries have laws relating to what frequencies you use so don't get creative. For Europe please use the recommended option. For other regions use the entry marked 'used by TTN'.
|
Choose the Frequency plan appropriate for your region. Consider that almost all countries have laws relating to what frequencies you use so don't get creative. For Europe please use the recommended option. For other regions use the entry marked 'used by TTN'.
|
||||||
|
|
||||||
Choose LoRaWAN 1.1.0 - the last one in the list - the latest specfication. RadioLib uses RP001 Regional Parameters 1.1 revision A.
|
Choose LoRaWAN 1.1.0 - the last one in the list - the latest specfication. RadioLib uses RP001 Regional Parameters 1.1 revision B.
|
||||||
|
|
||||||
At this point you will be asked for your JoinEUI. As this is a DIY device and we are using RadioLib, you can use all zero's as recommended by The LoRa Alliance TR007 Technical Recommendations document. Once you've put in all zeros and clicked confirm you will be asked for a DevEUI, AppKey and NwkKey. It is preferable to have the console generate them so they are properly formatted.
|
At this point you will be asked for your JoinEUI. As this is a DIY device and we are using RadioLib, you can use all zero's as recommended by The LoRa Alliance TR007 Technical Recommendations document. Once you've put in all zeros and clicked confirm you will be asked for a DevEUI, AppKey and NwkKey. It is preferable to have the console generate them so they are properly formatted.
|
||||||
|
|
||||||
|
|
|
@ -6,17 +6,17 @@ RadioLib LoRaWAN examples.
|
||||||
* [LoRaWAN_ABP](https://github.com/jgromes/RadioLib/tree/master/examples/LoRaWAN/LoRaWAN_ABP): if you wish to use ABP instead of OTAA (but why?), this example shows how you can do this using RadioLib.
|
* [LoRaWAN_ABP](https://github.com/jgromes/RadioLib/tree/master/examples/LoRaWAN/LoRaWAN_ABP): if you wish to use ABP instead of OTAA (but why?), this example shows how you can do this using RadioLib.
|
||||||
|
|
||||||
## LoRaWAN versions & regional parameters
|
## LoRaWAN versions & regional parameters
|
||||||
RadioLib implements both LoRaWAN v1.1 and v1.0.4. Confusingly, v1.0.4 is newer than v1.1, but v1.1 includes more security checks and as such **LoRaWAN v1.1 is preferred**.
|
RadioLib implements both LoRaWAN Specification 1.1 and 1.0.4. Confusingly, 1.0.4 is newer than 1.1, but 1.1 includes more security checks and as such **LoRaWAN 1.1 is preferred**.
|
||||||
The catch is in the Regional Parameters: as v1.0.4 is newer, it is more up to date regarding local laws & regulations. Therefore, RadioLib implements 1.0.4 as baseline and 1.1 as fallback, but **Regional Parameters v1.0.4 is preferred**.
|
The catch is in the Regional Parameters: as RP002 1.0.4 is newer than RP001 1.1, it is more up to date regarding local laws & regulations. Therefore, RadioLib implements 1.0.4 as baseline and 1.1 (revision B) as fallback, and as such **RP002 Regional Parameters 1.0.4 is preferred**.
|
||||||
_Note: the CN500 band is implemented as specified in RP v1.1, as the RP v1.0.4 version is much too complex._
|
_Note: the CN470 band is implemented as specified in RP001 1.1 revision B, as the RP002 1.0.4 version is much too complex._
|
||||||
|
|
||||||
To activate a LoRaWAN v1.1 session, supply all the required keys:
|
To activate a LoRaWAN 1.1 session, supply all the required keys:
|
||||||
```cpp
|
```cpp
|
||||||
node.beginOTAA(joinEUI, devEUI, nwkKey, appKey);
|
node.beginOTAA(joinEUI, devEUI, nwkKey, appKey);
|
||||||
node.beginABP(devAddr, fNwkSIntKey, sNwkSIntKey, nwkSEncKey, appSKey);
|
node.beginABP(devAddr, fNwkSIntKey, sNwkSIntKey, nwkSEncKey, appSKey);
|
||||||
```
|
```
|
||||||
|
|
||||||
To activate a LoRaWAN v1.0.4 session, set the keys that are not available to `NULL`:
|
To activate a LoRaWAN 1.0.4 session, set the keys that are not available to `NULL`:
|
||||||
```cpp
|
```cpp
|
||||||
node.beginOTAA(joinEUI, devEUI, NULL, appKey);
|
node.beginOTAA(joinEUI, devEUI, NULL, appKey);
|
||||||
node.beginABP(devAddr, NULL, NULL, nwkSEncKey, appSKey);
|
node.beginABP(devAddr, NULL, NULL, nwkSEncKey, appSKey);
|
||||||
|
@ -26,9 +26,9 @@ The device doesn't need to know the Regional Parameters version - that is of imp
|
||||||
|
|
||||||
## LoRaWAN persistence
|
## LoRaWAN persistence
|
||||||
> [!WARNING]
|
> [!WARNING]
|
||||||
> These examples do not actually comply with LoRaWAN v1.0.4/v1.1: for that, persistent storage is necessary. As the implementation of persistent storage differs between different platforms, these are not given here, but in a separate repository, see below:
|
> These examples do not actually comply with LoRaWAN 1.0.4/1.1: for that, persistent storage is necessary. As the implementation of persistent storage differs between different platforms, these are not given here, but in a separate repository, see below:
|
||||||
|
|
||||||
In [this repository](https://github.com/radiolib-org/radiolib-persistence), examples are provided that do comply with the required persistence of certain parameters for LoRaWAN v1.1. Examples are (or will become) available for some of the most popular platforms. **These examples assume you have successfully used the Starter sketch and understood (most of) the accompanying notes!**
|
In [this repository](https://github.com/radiolib-org/radiolib-persistence), examples are provided that do comply with the required persistence of certain parameters for LoRaWAN 1.1. Examples are (or will become) available for some of the most popular platforms. **These examples assume you have successfully used the Starter sketch and understood (most of) the accompanying notes!**
|
||||||
Currently, examples are available for the following platforms:
|
Currently, examples are available for the following platforms:
|
||||||
|
|
||||||
* [LoRaWAN for ESP32](https://github.com/radiolib-org/radiolib-persistence/tree/main/examples/LoRaWAN_ESP32)
|
* [LoRaWAN for ESP32](https://github.com/radiolib-org/radiolib-persistence/tree/main/examples/LoRaWAN_ESP32)
|
||||||
|
|
|
@ -30,9 +30,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// pin 5 is connected to SX1278 DIO2
|
// pin 5 is connected to SX1278 DIO2
|
||||||
|
|
|
@ -30,9 +30,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// pin 5 is connected to SX1278 DIO2
|
// pin 5 is connected to SX1278 DIO2
|
||||||
|
|
|
@ -31,9 +31,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// this requires connection to the module direct
|
// this requires connection to the module direct
|
||||||
|
|
|
@ -33,9 +33,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create Morse client instance using the FSK module
|
// create Morse client instance using the FSK module
|
||||||
MorseClient morse(&radio);
|
MorseClient morse(&radio);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
// this example only works on ESP32 and is unlikely to work on ESP32S2/S3 etc.
|
// this example only works on ESP32 and is unlikely to work on ESP32S2/S3 etc.
|
||||||
// if you need high portability, you should probably use Arduino anyway ...
|
// if you need high portability, you should probably use Arduino anyway ...
|
||||||
#if CONFIG_IDF_TARGET_ESP32 == 0
|
#if CONFIG_IDF_TARGET_ESP32 == 0
|
||||||
#error Target is not ESP32!
|
#error This example HAL only supports ESP32 targets. Support for ESP32S2/S3 etc. can be added by adjusting this file to user needs.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// include all the dependencies
|
// include all the dependencies
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include <RadioLib.h>
|
#include <RadioLib.h>
|
||||||
|
|
||||||
// include the hardware abstraction layer
|
// include the hardware abstraction layer
|
||||||
#include "PicoHal.h"
|
#include "hal/RPiPico/PicoHal.h"
|
||||||
|
|
||||||
// create a new instance of the HAL class
|
// create a new instance of the HAL class
|
||||||
PicoHal* hal = new PicoHal(SPI_PORT, SPI_MISO, SPI_MOSI, SPI_SCK);
|
PicoHal* hal = new PicoHal(SPI_PORT, SPI_MISO, SPI_MOSI, SPI_SCK);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <RadioLib.h>
|
#include <RadioLib.h>
|
||||||
|
|
||||||
// include the hardware abstraction layer
|
// include the hardware abstraction layer
|
||||||
#include "PiHal.h"
|
#include "hal/RPi/PiHal.h"
|
||||||
|
|
||||||
// create a new instance of the HAL class
|
// create a new instance of the HAL class
|
||||||
// use SPI channel 1, because on Waveshare LoRaWAN Hat,
|
// use SPI channel 1, because on Waveshare LoRaWAN Hat,
|
||||||
|
|
|
@ -50,7 +50,21 @@ add_executable(${PROJECT_NAME} main.cpp)
|
||||||
# The build system for libtock-c is a bit odd and the version of libraries
|
# The build system for libtock-c is a bit odd and the version of libraries
|
||||||
# built changes based on compiler version.
|
# built changes based on compiler version.
|
||||||
if (RISCV_BUILD)
|
if (RISCV_BUILD)
|
||||||
if(EXISTS "$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-13.2.0")
|
if(EXISTS "$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-14.1.0")
|
||||||
|
target_link_libraries(${PROJECT_NAME} PUBLIC
|
||||||
|
RadioLib
|
||||||
|
$ENV{LIBTOCK_C_DIRECTORY}/libtock/build/rv32imc/libtock.a
|
||||||
|
$ENV{LIBTOCK_C_DIRECTORY}/libtock-sync/build/rv32imc/libtocksync.a
|
||||||
|
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-14.1.0/riscv/lib/gcc/riscv64-unknown-elf/14.1.0/rv32i/ilp32/libgcc.a
|
||||||
|
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-14.1.0/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libstdc++.a
|
||||||
|
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.4.0.20231231/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libc.a
|
||||||
|
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.4.0.20231231/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libm.a
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(RadioLib AFTER PUBLIC
|
||||||
|
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.3.0.20230120/riscv/riscv64-unknown-elf/include/
|
||||||
|
)
|
||||||
|
elseif(EXISTS "$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-13.2.0")
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC
|
target_link_libraries(${PROJECT_NAME} PUBLIC
|
||||||
RadioLib
|
RadioLib
|
||||||
$ENV{LIBTOCK_C_DIRECTORY}/libtock/build/rv32imc/libtock.a
|
$ENV{LIBTOCK_C_DIRECTORY}/libtock/build/rv32imc/libtock.a
|
||||||
|
@ -80,7 +94,17 @@ if (RISCV_BUILD)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
if(EXISTS "$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-13.2.0")
|
if (EXISTS "$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-14.1.0")
|
||||||
|
target_link_libraries(${PROJECT_NAME} PUBLIC
|
||||||
|
RadioLib
|
||||||
|
$ENV{LIBTOCK_C_DIRECTORY}/libtock/build/cortex-m4/libtock.a
|
||||||
|
$ENV{LIBTOCK_C_DIRECTORY}/libtock-sync/build/cortex-m4/libtocksync.a
|
||||||
|
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-14.1.0/arm/lib/gcc/arm-none-eabi/14.1.0/libgcc.a
|
||||||
|
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-14.1.0/arm/arm-none-eabi/lib/libstdc++.a
|
||||||
|
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.4.0.20231231/arm/arm-none-eabi/lib/libc.a
|
||||||
|
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.4.0.20231231/arm/arm-none-eabi/lib/libm.a
|
||||||
|
)
|
||||||
|
elseif(EXISTS "$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-13.2.0")
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC
|
target_link_libraries(${PROJECT_NAME} PUBLIC
|
||||||
RadioLib
|
RadioLib
|
||||||
$ENV{LIBTOCK_C_DIRECTORY}/libtock/build/cortex-m4/libtock.a
|
$ENV{LIBTOCK_C_DIRECTORY}/libtock/build/cortex-m4/libtock.a
|
||||||
|
|
|
@ -23,7 +23,7 @@ The RadioLib example can be built with:
|
||||||
$ git clone https://github.com/jgromes/RadioLib.git
|
$ git clone https://github.com/jgromes/RadioLib.git
|
||||||
$ cd RadioLib/examples/NonArduino/Tock/
|
$ cd RadioLib/examples/NonArduino/Tock/
|
||||||
$ git clone https://github.com/tock/libtock-c.git
|
$ git clone https://github.com/tock/libtock-c.git
|
||||||
$ cd libtock-c; git checkout dbee65a56d74b4bad166317f199e80b959f7c82c; cd ../
|
$ cd libtock-c; git checkout c0202f9ab78da4a6e95f136cf5250701e3778f63; cd ../
|
||||||
$ LIBTOCK_C_DIRECTORY="$(pwd)/libtock-c" ./build.sh
|
$ LIBTOCK_C_DIRECTORY="$(pwd)/libtock-c" ./build.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@ set -e
|
||||||
|
|
||||||
rm -rf ./build-*
|
rm -rf ./build-*
|
||||||
|
|
||||||
cd libtock-c/examples/cxx_hello
|
pushd ${LIBTOCK_C_DIRECTORY}/examples/cxx_hello
|
||||||
make -j4
|
make -j4
|
||||||
cd ../../../
|
popd
|
||||||
|
|
||||||
mkdir -p build-arm
|
mkdir -p build-arm
|
||||||
cd build-arm
|
cd build-arm
|
||||||
|
|
|
@ -1,225 +0,0 @@
|
||||||
/*
|
|
||||||
RadioLib Non-Arduino Tock Library helper functions
|
|
||||||
|
|
||||||
Licensed under the MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2023 Alistair Francis <alistair@alistair23.me>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef TOCK_HAL_H
|
|
||||||
#define TOCK_HAL_H
|
|
||||||
|
|
||||||
// include RadioLib
|
|
||||||
#include <RadioLib.h>
|
|
||||||
|
|
||||||
// include all the dependencies
|
|
||||||
#include "libtock/net/lora_phy.h"
|
|
||||||
#include "libtock/net/syscalls/lora_phy_syscalls.h"
|
|
||||||
#include "libtock-sync/net/lora_phy.h"
|
|
||||||
#include "libtock/peripherals/gpio.h"
|
|
||||||
#include "libtock-sync/services/alarm.h"
|
|
||||||
#include "libtock/kernel/read_only_state.h"
|
|
||||||
|
|
||||||
#define RADIO_BUSY 1
|
|
||||||
#define RADIO_DIO_1 2
|
|
||||||
#define RADIO_DIO_3 3
|
|
||||||
#define RADIO_RESET 4
|
|
||||||
// Skip the chips select as Tock handles this for us
|
|
||||||
#define RADIO_NSS RADIOLIB_NC
|
|
||||||
|
|
||||||
// define Arduino-style macros
|
|
||||||
#define PIN_LOW (0x0)
|
|
||||||
#define PIN_HIGH (0x1)
|
|
||||||
#define PIN_INPUT (0x01)
|
|
||||||
#define PIN_OUTPUT (0x03)
|
|
||||||
#define PIN_RISING (0x01)
|
|
||||||
#define PIN_FALLING (0x02)
|
|
||||||
|
|
||||||
typedef void (*gpioIrqFn)(void);
|
|
||||||
|
|
||||||
gpioIrqFn gpio_funcs[4] = { NULL, NULL, NULL, NULL};
|
|
||||||
uint32_t frequency = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the the timer frequency in Hz.
|
|
||||||
*/
|
|
||||||
int alarm_internal_frequency(uint32_t* frequency) {
|
|
||||||
syscall_return_t rval = command(0x0, 1, 0, 0);
|
|
||||||
return tock_command_return_u32_to_returncode(rval, frequency);
|
|
||||||
}
|
|
||||||
|
|
||||||
int alarm_internal_read(uint32_t* time) {
|
|
||||||
syscall_return_t rval = command(0x0, 2, 0, 0);
|
|
||||||
return tock_command_return_u32_to_returncode(rval, time);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void lora_phy_gpio_Callback (int gpioPin,
|
|
||||||
__attribute__ ((unused)) int arg2,
|
|
||||||
__attribute__ ((unused)) int arg3,
|
|
||||||
void* userdata)
|
|
||||||
{
|
|
||||||
gpioIrqFn fn = gpio_funcs[gpioPin - 1];
|
|
||||||
|
|
||||||
if (fn != NULL ) {
|
|
||||||
fn();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class TockHal : public RadioLibHal {
|
|
||||||
public:
|
|
||||||
// default constructor - initializes the base HAL and any needed private members
|
|
||||||
TockHal()
|
|
||||||
: RadioLibHal(PIN_INPUT, PIN_OUTPUT, PIN_LOW, PIN_HIGH, PIN_RISING, PIN_FALLING) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void init() override {
|
|
||||||
}
|
|
||||||
|
|
||||||
void term() override {
|
|
||||||
}
|
|
||||||
|
|
||||||
// GPIO-related methods (pinMode, digitalWrite etc.) should check
|
|
||||||
// RADIOLIB_NC as an alias for non-connected pins
|
|
||||||
void pinMode(uint32_t pin, uint32_t mode) override {
|
|
||||||
if(pin == RADIOLIB_NC) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mode == PIN_OUTPUT) {
|
|
||||||
libtock_lora_phy_gpio_enable_output(pin);
|
|
||||||
} else if (mode == PIN_INPUT) {
|
|
||||||
libtock_lora_phy_gpio_enable_input(pin, libtock_pull_down);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void digitalWrite(uint32_t pin, uint32_t value) override {
|
|
||||||
if(pin == RADIOLIB_NC) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value) {
|
|
||||||
libtock_lora_phy_gpio_set(pin);
|
|
||||||
} else {
|
|
||||||
libtock_lora_phy_gpio_clear(pin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t digitalRead(uint32_t pin) override {
|
|
||||||
int value;
|
|
||||||
|
|
||||||
if(pin == RADIOLIB_NC) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
libtock_lora_phy_gpio_read(pin, &value);
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void attachInterrupt(uint32_t interruptNum, gpioIrqFn interruptCb, uint32_t mode) override {
|
|
||||||
if(interruptNum == RADIOLIB_NC) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gpio_funcs[interruptNum - 1] = interruptCb;
|
|
||||||
libtock_lora_phy_gpio_command_interrupt_callback(lora_phy_gpio_Callback, NULL);
|
|
||||||
|
|
||||||
// set GPIO as input and enable interrupts on it
|
|
||||||
libtock_lora_phy_gpio_enable_input(interruptNum, libtock_pull_down);
|
|
||||||
libtock_lora_phy_gpio_enable_interrupt(interruptNum, libtock_change);
|
|
||||||
}
|
|
||||||
|
|
||||||
void detachInterrupt(uint32_t interruptNum) override {
|
|
||||||
if(interruptNum == RADIOLIB_NC) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gpio_funcs[interruptNum - 1] = NULL;
|
|
||||||
libtock_lora_phy_gpio_disable_interrupt(interruptNum);
|
|
||||||
}
|
|
||||||
|
|
||||||
void delay(unsigned long ms) override {
|
|
||||||
#if !defined(RADIOLIB_CLOCK_DRIFT_MS)
|
|
||||||
libtocksync_alarm_delay_ms(ms);
|
|
||||||
#else
|
|
||||||
libtocksync_alarm_delay_ms(ms * 1000 / (1000 + RADIOLIB_CLOCK_DRIFT_MS));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void delayMicroseconds(unsigned long us) override {
|
|
||||||
#if !defined(RADIOLIB_CLOCK_DRIFT_MS)
|
|
||||||
libtocksync_alarm_delay_ms(us / 1000);
|
|
||||||
#else
|
|
||||||
libtocksync_alarm_delay_ms((us * 1000 / (1000 + RADIOLIB_CLOCK_DRIFT_MS)) / 1000);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned long millis() override {
|
|
||||||
uint32_t now;
|
|
||||||
unsigned long ms;
|
|
||||||
|
|
||||||
if (frequency == 0) {
|
|
||||||
alarm_internal_frequency(&frequency);
|
|
||||||
}
|
|
||||||
|
|
||||||
alarm_internal_read(&now);
|
|
||||||
|
|
||||||
ms = now / (frequency / 1000);
|
|
||||||
|
|
||||||
#if !defined(RADIOLIB_CLOCK_DRIFT_MS)
|
|
||||||
return ms;
|
|
||||||
#else
|
|
||||||
return ms * 1000 / (1000 + RADIOLIB_CLOCK_DRIFT_MS);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned long micros() override {
|
|
||||||
return millis() / 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
long pulseIn(uint32_t pin, uint32_t state, unsigned long timeout) override {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void spiBegin() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void spiBeginTransaction() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void spiTransfer(uint8_t* out, size_t len, uint8_t* in) {
|
|
||||||
libtocksync_lora_phy_read_write(out, in, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
void spiEndTransaction() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void spiEnd() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void yield() {
|
|
||||||
::yield_no_wait();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -28,14 +28,14 @@
|
||||||
#include <RadioLib.h>
|
#include <RadioLib.h>
|
||||||
|
|
||||||
// include the hardware abstraction layer
|
// include the hardware abstraction layer
|
||||||
#include "libtockHal.h"
|
#include "RadioLib/libtockHal.h"
|
||||||
|
|
||||||
// the entry point for the program
|
// the entry point for the program
|
||||||
int main(void) {
|
int main(void) {
|
||||||
printf("[SX1261] Initialising Radio ... \r\n");
|
printf("[SX1261] Initialising Radio ... \r\n");
|
||||||
|
|
||||||
// create a new instance of the HAL class
|
// create a new instance of the HAL class
|
||||||
TockHal* hal = new TockHal();
|
TockRadioLibHal* hal = new TockRadioLibHal();
|
||||||
|
|
||||||
// now we can create the radio module
|
// now we can create the radio module
|
||||||
// pinout corresponds to the SparkFun LoRa Thing Plus - expLoRaBLE
|
// pinout corresponds to the SparkFun LoRa Thing Plus - expLoRaBLE
|
||||||
|
@ -43,7 +43,7 @@ int main(void) {
|
||||||
// DIO1 pin: 2
|
// DIO1 pin: 2
|
||||||
// NRST pin: 4
|
// NRST pin: 4
|
||||||
// BUSY pin: 1
|
// BUSY pin: 1
|
||||||
Module* tock_module = new Module(hal, RADIO_NSS, RADIO_DIO_1, RADIO_RESET, RADIO_BUSY);
|
Module* tock_module = new Module(hal, RADIOLIB_RADIO_NSS, RADIOLIB_RADIO_DIO_1, RADIOLIB_RADIO_RESET, RADIOLIB_RADIO_BUSY);
|
||||||
SX1262* radio = new SX1262(tock_module);
|
SX1262* radio = new SX1262(tock_module);
|
||||||
|
|
||||||
// Setup the radio
|
// Setup the radio
|
||||||
|
|
|
@ -45,9 +45,13 @@ const int pin = 5;
|
||||||
// create Pager client instance using the FSK module
|
// create Pager client instance using the FSK module
|
||||||
PagerClient pager(&radio);
|
PagerClient pager(&radio);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -31,9 +31,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create Pager client instance using the FSK module
|
// create Pager client instance using the FSK module
|
||||||
PagerClient pager(&radio);
|
PagerClient pager(&radio);
|
||||||
|
|
|
@ -23,6 +23,14 @@
|
||||||
// extra GPIO/interrupt pin: 3 (unused on some modules)
|
// extra GPIO/interrupt pin: 3 (unused on some modules)
|
||||||
RADIO_TYPE radio = new Module(10, 2, 9, 3);
|
RADIO_TYPE radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// get pointer to the common layer
|
// get pointer to the common layer
|
||||||
PhysicalLayer* phy = (PhysicalLayer*)&radio;
|
PhysicalLayer* phy = (PhysicalLayer*)&radio;
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,13 @@
|
||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
RF69 radio = new Module(10, 2, 3);
|
RF69 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//RF69 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -23,9 +23,13 @@
|
||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
RF69 radio = new Module(10, 2, 3);
|
RF69 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//RF69 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -30,9 +30,13 @@
|
||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
RF69 radio = new Module(10, 2, 3);
|
RF69 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//RF69 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -21,9 +21,28 @@
|
||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
RF69 radio = new Module(10, 2, 3);
|
RF69 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//RF69 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
|
// flag to indicate that a packet was received
|
||||||
|
volatile bool receivedFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a complete packet
|
||||||
|
// is received by the module
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlag(void) {
|
||||||
|
// we got a packet, set the flag
|
||||||
|
receivedFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
@ -64,21 +83,6 @@ void setup() {
|
||||||
// radio.readData();
|
// radio.readData();
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a packet was received
|
|
||||||
volatile bool receivedFlag = false;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
|
||||||
// is received by the module
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlag(void) {
|
|
||||||
// we got a packet, set the flag
|
|
||||||
receivedFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(receivedFlag) {
|
if(receivedFlag) {
|
||||||
|
|
|
@ -33,9 +33,13 @@ RF69 radio1 = new Module(10, 2, 3);
|
||||||
// RESET pin: 5
|
// RESET pin: 5
|
||||||
RF69 radio2 = new Module(9, 4, 5);
|
RF69 radio2 = new Module(9, 4, 5);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//RF69 radio3 = RadioShield.ModuleB;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio3 = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -21,9 +21,13 @@
|
||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
RF69 radio = new Module(10, 2, 3);
|
RF69 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//RF69 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -23,9 +23,13 @@
|
||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
RF69 radio = new Module(10, 2, 3);
|
RF69 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//RF69 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -27,9 +27,13 @@
|
||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
RF69 radio = new Module(10, 2, 3);
|
RF69 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//RF69 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -24,13 +24,32 @@
|
||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
RF69 radio = new Module(10, 2, 3);
|
RF69 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//RF69 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// save transmission state between loops
|
// save transmission state between loops
|
||||||
int transmissionState = RADIOLIB_ERR_NONE;
|
int transmissionState = RADIOLIB_ERR_NONE;
|
||||||
|
|
||||||
|
// flag to indicate that a packet was sent
|
||||||
|
volatile bool transmittedFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a complete packet
|
||||||
|
// is transmitted by the module
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlag(void) {
|
||||||
|
// we sent a packet, set the flag
|
||||||
|
transmittedFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
@ -81,21 +100,6 @@ void setup() {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a packet was sent
|
|
||||||
volatile bool transmittedFlag = false;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
|
||||||
// is transmitted by the module
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlag(void) {
|
|
||||||
// we sent a packet, set the flag
|
|
||||||
transmittedFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// counter to keep track of transmitted packets
|
// counter to keep track of transmitted packets
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create RTTY client instance using the FSK module
|
// create RTTY client instance using the FSK module
|
||||||
RTTYClient rtty(&radio);
|
RTTYClient rtty(&radio);
|
||||||
|
|
|
@ -29,9 +29,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// this requires connection to the module direct
|
// this requires connection to the module direct
|
||||||
|
|
|
@ -42,9 +42,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create SSTV client instance using the FSK module
|
// create SSTV client instance using the FSK module
|
||||||
SSTVClient sstv(&radio);
|
SSTVClient sstv(&radio);
|
||||||
|
|
|
@ -38,9 +38,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// this requires connection to the module direct
|
// this requires connection to the module direct
|
||||||
|
|
|
@ -33,6 +33,18 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
END_OF_MODE_TABLE,
|
END_OF_MODE_TABLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// flag to indicate that a packet was detected or CAD timed out
|
||||||
|
volatile bool scanFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a complete packet
|
||||||
|
// is received by the module
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
void setFlag(void) {
|
||||||
|
// something happened, set the flag
|
||||||
|
scanFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
@ -66,18 +78,6 @@ void setup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a packet was detected or CAD timed out
|
|
||||||
volatile bool scanFlag = false;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
|
||||||
// is received by the module
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
void setFlag(void) {
|
|
||||||
// something happened, set the flag
|
|
||||||
scanFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(scanFlag) {
|
if(scanFlag) {
|
||||||
|
|
|
@ -43,6 +43,18 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
END_OF_MODE_TABLE,
|
END_OF_MODE_TABLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// flag to indicate that a packet was received
|
||||||
|
volatile bool receivedFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a complete packet
|
||||||
|
// is received by the module
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
void setFlag(void) {
|
||||||
|
// we got a packet, set the flag
|
||||||
|
receivedFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
@ -97,18 +109,6 @@ void setup() {
|
||||||
// radio.scanChannel();
|
// radio.scanChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a packet was received
|
|
||||||
volatile bool receivedFlag = false;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
|
||||||
// is received by the module
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
void setFlag(void) {
|
|
||||||
// we got a packet, set the flag
|
|
||||||
receivedFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(receivedFlag) {
|
if(receivedFlag) {
|
||||||
|
@ -154,8 +154,5 @@ void loop() {
|
||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// put module back to listen mode
|
|
||||||
radio.startReceive();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,18 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
// save transmission state between loops
|
// save transmission state between loops
|
||||||
int transmissionState = RADIOLIB_ERR_NONE;
|
int transmissionState = RADIOLIB_ERR_NONE;
|
||||||
|
|
||||||
|
// flag to indicate that a packet was sent
|
||||||
|
volatile bool transmittedFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a complete packet
|
||||||
|
// is transmitted by the module
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
void setFlag(void) {
|
||||||
|
// we sent a packet, set the flag
|
||||||
|
transmittedFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
@ -85,18 +97,6 @@ void setup() {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a packet was sent
|
|
||||||
volatile bool transmittedFlag = false;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
|
||||||
// is transmitted by the module
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
void setFlag(void) {
|
|
||||||
// we sent a packet, set the flag
|
|
||||||
transmittedFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// counter to keep track of transmitted packets
|
// counter to keep track of transmitted packets
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,13 @@
|
||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
SX1231 radio = new Module(10, 2, 3);
|
SX1231 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1231 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -28,9 +28,13 @@
|
||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
SX1231 radio = new Module(10, 2, 3);
|
SX1231 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1231 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -30,12 +30,13 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1262 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
// or using CubeCell
|
#include <RadioBoards.h>
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -25,12 +25,28 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1262 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// or using CubeCell
|
// flag to indicate that a packet was detected or CAD timed out
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
volatile bool scanFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a complete packet
|
||||||
|
// is received by the module
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlag(void) {
|
||||||
|
// something happened, set the flag
|
||||||
|
scanFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
@ -61,21 +77,6 @@ void setup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a packet was detected or CAD timed out
|
|
||||||
volatile bool scanFlag = false;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
|
||||||
// is received by the module
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlag(void) {
|
|
||||||
// something happened, set the flag
|
|
||||||
scanFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(scanFlag) {
|
if(scanFlag) {
|
||||||
|
|
|
@ -27,12 +27,31 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1262 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// or using CubeCell
|
// whether we are receiving, or scanning
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
bool receiving = false;
|
||||||
|
|
||||||
|
// flag to indicate that a packet was detected or CAD timed out
|
||||||
|
volatile bool scanFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a complete packet
|
||||||
|
// is received by the module
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlag(void) {
|
||||||
|
// something happened, set the flag
|
||||||
|
scanFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
@ -63,23 +82,6 @@ void setup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a packet was detected or CAD timed out
|
|
||||||
volatile bool scanFlag = false;
|
|
||||||
|
|
||||||
bool receiving = false;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
|
||||||
// is received by the module
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlag(void) {
|
|
||||||
// something happened, set the flag
|
|
||||||
scanFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(scanFlag) {
|
if(scanFlag) {
|
||||||
|
|
|
@ -26,12 +26,13 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1262 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
// or using CubeCell
|
#include <RadioBoards.h>
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
@ -125,33 +126,4 @@ void loop() {
|
||||||
Serial.println(F("[SX1262] Failed to receive packet, code "));
|
Serial.println(F("[SX1262] Failed to receive packet, code "));
|
||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FSK modem has built-in address filtering system
|
|
||||||
// it can be enabled by setting node address, broadcast
|
|
||||||
// address, or both
|
|
||||||
//
|
|
||||||
// to transmit packet to a particular address,
|
|
||||||
// use the following methods:
|
|
||||||
//
|
|
||||||
// radio.transmit("Hello World!", address);
|
|
||||||
// radio.startTransmit("Hello World!", address);
|
|
||||||
|
|
||||||
// set node address to 0x02
|
|
||||||
state = radio.setNodeAddress(0x02);
|
|
||||||
// set broadcast address to 0xFF
|
|
||||||
state = radio.setBroadcastAddress(0xFF);
|
|
||||||
if (state != RADIOLIB_ERR_NONE) {
|
|
||||||
Serial.println(F("[SX1262] Unable to set address filter, code "));
|
|
||||||
Serial.println(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
// address filtering can also be disabled
|
|
||||||
// NOTE: calling this method will also erase previously set
|
|
||||||
// node and broadcast address
|
|
||||||
/*
|
|
||||||
state = radio.disableAddressFiltering();
|
|
||||||
if (state != RADIOLIB_ERR_NONE) {
|
|
||||||
Serial.println(F("Unable to remove address filter, code "));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,113 @@
|
||||||
|
/*
|
||||||
|
RadioLib SX126x LR-FHSS Modem Example
|
||||||
|
|
||||||
|
This example shows how to use LR-FHSS modem in SX126x chips.
|
||||||
|
This modem can only transmit data, and is not able to receive.
|
||||||
|
|
||||||
|
This example transmits packets using SX1262 LoRa radio module.
|
||||||
|
Each packet contains up to 256 bytes of data, in the form of:
|
||||||
|
- Arduino String
|
||||||
|
- null-terminated char array (C-string)
|
||||||
|
- arbitrary binary data (byte array)
|
||||||
|
|
||||||
|
Other modules from SX126x family can also be used.
|
||||||
|
|
||||||
|
Using blocking transmit is not recommended, as it will lead
|
||||||
|
to inefficient use of processor time!
|
||||||
|
Instead, interrupt transmit is recommended.
|
||||||
|
|
||||||
|
For default module settings, see the wiki page
|
||||||
|
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lr-fhss-modem
|
||||||
|
|
||||||
|
For full API reference, see the GitHub Pages
|
||||||
|
https://jgromes.github.io/RadioLib/
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library
|
||||||
|
#include <RadioLib.h>
|
||||||
|
|
||||||
|
// SX1262 has the following connections:
|
||||||
|
// NSS pin: 10
|
||||||
|
// IRQ pin: 2
|
||||||
|
// NRST pin: 3
|
||||||
|
// BUSY pin: 9
|
||||||
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
// initialize SX1262 with default settings
|
||||||
|
Serial.print(F("[SX1262] Initializing ... "));
|
||||||
|
int state = radio.beginLRFHSS();
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.println(F("success!"));
|
||||||
|
} else {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// some modules have an external RF switch
|
||||||
|
// controlled via two pins (RX enable, TX enable)
|
||||||
|
// to enable automatic control of the switch,
|
||||||
|
// call the following method
|
||||||
|
// RX enable: 4
|
||||||
|
// TX enable: 5
|
||||||
|
/*
|
||||||
|
radio.setRfSwitchPins(4, 5);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
// counter to keep track of transmitted packets
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// LR-FHSS modem can only transmit!
|
||||||
|
Serial.print(F("[SX1262] Transmitting packet ... "));
|
||||||
|
|
||||||
|
// you can transmit C-string or Arduino string up to
|
||||||
|
// 256 characters long
|
||||||
|
String str = "Hello World! #" + String(count++);
|
||||||
|
int state = radio.transmit(str);
|
||||||
|
|
||||||
|
// you can also transmit byte array up to 256 bytes long
|
||||||
|
/*
|
||||||
|
byte byteArr[] = {0x01, 0x23, 0x45, 0x56, 0x78, 0xAB, 0xCD, 0xEF};
|
||||||
|
int state = radio.transmit(byteArr, 8);
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
// the packet was successfully transmitted
|
||||||
|
Serial.println(F("success!"));
|
||||||
|
|
||||||
|
// print measured data rate
|
||||||
|
Serial.print(F("[SX1262] Datarate:\t"));
|
||||||
|
Serial.print(radio.getDataRate());
|
||||||
|
Serial.println(F(" bps"));
|
||||||
|
|
||||||
|
} else if (state == RADIOLIB_ERR_PACKET_TOO_LONG) {
|
||||||
|
// the supplied packet was longer than 256 bytes
|
||||||
|
Serial.println(F("too long!"));
|
||||||
|
|
||||||
|
} else if (state == RADIOLIB_ERR_TX_TIMEOUT) {
|
||||||
|
// timeout occurred while transmitting packet
|
||||||
|
Serial.println(F("timeout!"));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// some other error occurred
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait for a second before transmitting again
|
||||||
|
delay(1000);
|
||||||
|
}
|
|
@ -0,0 +1,151 @@
|
||||||
|
/*
|
||||||
|
RadioLib SX126x LR-FHSS Transmit with Interrupts Example
|
||||||
|
|
||||||
|
This example shows how to use LR-FHSS modem in SX126x chips.
|
||||||
|
This modem can only transmit data, and is not able to receive.
|
||||||
|
|
||||||
|
This example transmits packets using SX1262 LoRa radio module.
|
||||||
|
Each packet contains up to 256 bytes of data, in the form of:
|
||||||
|
- Arduino String
|
||||||
|
- null-terminated char array (C-string)
|
||||||
|
- arbitrary binary data (byte array)
|
||||||
|
|
||||||
|
Other modules from SX126x family can also be used.
|
||||||
|
|
||||||
|
For default module settings, see the wiki page
|
||||||
|
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lr-fhss-modem
|
||||||
|
|
||||||
|
For full API reference, see the GitHub Pages
|
||||||
|
https://jgromes.github.io/RadioLib/
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library
|
||||||
|
#include <RadioLib.h>
|
||||||
|
|
||||||
|
// SX1262 has the following connections:
|
||||||
|
// NSS pin: 10
|
||||||
|
// IRQ pin: 2
|
||||||
|
// NRST pin: 3
|
||||||
|
// BUSY pin: 9
|
||||||
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
|
// save transmission state between loops
|
||||||
|
int transmissionState = RADIOLIB_ERR_NONE;
|
||||||
|
|
||||||
|
// flag to indicate that a packet was sent
|
||||||
|
// or a frequency hop is needed
|
||||||
|
volatile bool flag = false;
|
||||||
|
|
||||||
|
// this function is called when a complete packet
|
||||||
|
// is transmitted by the module
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlag(void) {
|
||||||
|
// we sent a packet or need to hop, set the flag
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
// initialize SX1262 with default settings
|
||||||
|
Serial.print(F("[SX1262] Initializing ... "));
|
||||||
|
int state = radio.beginLRFHSS();
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.println(F("success!"));
|
||||||
|
} else {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the function that will be called
|
||||||
|
// when packet transmission is finished
|
||||||
|
radio.setPacketSentAction(setFlag);
|
||||||
|
|
||||||
|
// start transmitting the first packet
|
||||||
|
Serial.print(F("[SX1262] Sending first packet ... "));
|
||||||
|
|
||||||
|
// you can transmit C-string or Arduino string up to
|
||||||
|
// 256 characters long
|
||||||
|
transmissionState = radio.startTransmit("Hello World!");
|
||||||
|
|
||||||
|
// you can also transmit byte array up to 256 bytes long
|
||||||
|
/*
|
||||||
|
byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
|
||||||
|
0x89, 0xAB, 0xCD, 0xEF};
|
||||||
|
state = radio.startTransmit(byteArr, 8);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
// counter to keep track of transmitted packets
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// LR-FHSS modem can only transmit!
|
||||||
|
|
||||||
|
// check if the previous transmission finished
|
||||||
|
if(flag) {
|
||||||
|
// reset flag
|
||||||
|
flag = false;
|
||||||
|
|
||||||
|
// check if this was caused by hopping or transmission finished
|
||||||
|
if(radio.getIrqFlags() & RADIOLIB_SX126X_IRQ_LR_FHSS_HOP) {
|
||||||
|
radio.hopLRFHSS();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (transmissionState == RADIOLIB_ERR_NONE) {
|
||||||
|
// packet was successfully sent
|
||||||
|
Serial.println(F("transmission finished!"));
|
||||||
|
|
||||||
|
// NOTE: when using interrupt-driven transmit method,
|
||||||
|
// it is not possible to automatically measure
|
||||||
|
// transmission data rate using getDataRate()
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(transmissionState);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// clean up after transmission is finished
|
||||||
|
// this will ensure transmitter is disabled,
|
||||||
|
// RF switch is powered down etc.
|
||||||
|
radio.finishTransmit();
|
||||||
|
|
||||||
|
// wait a second before transmitting again
|
||||||
|
delay(1000);
|
||||||
|
|
||||||
|
// send another one
|
||||||
|
Serial.print(F("[SX1262] Sending another packet ... "));
|
||||||
|
|
||||||
|
// you can transmit C-string or Arduino string up to
|
||||||
|
// 256 characters long
|
||||||
|
String str = "Hello World! #" + String(count++);
|
||||||
|
transmissionState = radio.startTransmit(str);
|
||||||
|
|
||||||
|
// you can also transmit byte array up to 256 bytes long
|
||||||
|
/*
|
||||||
|
byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
|
||||||
|
0x89, 0xAB, 0xCD, 0xEF};
|
||||||
|
transmissionState = radio.startTransmit(byteArr, 8);
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
/*
|
/*
|
||||||
RadioLib SX126x Ping-Pong Example
|
RadioLib SX126x Ping-Pong Example
|
||||||
|
|
||||||
|
This example is intended to run on two SX126x radios,
|
||||||
|
and send packets between the two.
|
||||||
|
|
||||||
For default module settings, see the wiki page
|
For default module settings, see the wiki page
|
||||||
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
|
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
|
||||||
|
|
||||||
|
@ -22,12 +25,13 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1262 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
// or using CubeCell
|
#include <RadioBoards.h>
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// save transmission states between loops
|
// save transmission states between loops
|
||||||
int transmissionState = RADIOLIB_ERR_NONE;
|
int transmissionState = RADIOLIB_ERR_NONE;
|
||||||
|
|
|
@ -35,12 +35,13 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1262 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
// or using CubeCell
|
#include <RadioBoards.h>
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -31,12 +31,28 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1262 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// or using CubeCell
|
// flag to indicate that a packet was received
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
volatile bool receivedFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a complete packet
|
||||||
|
// is received by the module
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlag(void) {
|
||||||
|
// we got a packet, set the flag
|
||||||
|
receivedFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
@ -77,21 +93,6 @@ void setup() {
|
||||||
// radio.scanChannel();
|
// radio.scanChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a packet was received
|
|
||||||
volatile bool receivedFlag = false;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
|
||||||
// is received by the module
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlag(void) {
|
|
||||||
// we got a packet, set the flag
|
|
||||||
receivedFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the flag is set
|
// check if the flag is set
|
||||||
if(receivedFlag) {
|
if(receivedFlag) {
|
||||||
|
|
|
@ -41,12 +41,13 @@ SX1262 radio1 = new Module(10, 2, 3, 9);
|
||||||
// BUSY pin: 6
|
// BUSY pin: 6
|
||||||
SX1268 radio2 = new Module(8, 4, 5, 6);
|
SX1268 radio2 = new Module(8, 4, 5, 6);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1261 radio3 = RadioShield.ModuleB;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
// or using CubeCell
|
#include <RadioBoards.h>
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
Radio radio3 = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -34,6 +34,14 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,14 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// frequency range in MHz to scan
|
// frequency range in MHz to scan
|
||||||
const float freqStart = 431;
|
const float freqStart = 431;
|
||||||
const float freqEnd = 435;
|
const float freqEnd = 435;
|
||||||
|
|
|
@ -30,12 +30,13 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1262 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
// or using CubeCell
|
#include <RadioBoards.h>
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -27,16 +27,32 @@
|
||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1262 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
// or using CubeCell
|
#include <RadioBoards.h>
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// save transmission state between loops
|
// save transmission state between loops
|
||||||
int transmissionState = RADIOLIB_ERR_NONE;
|
int transmissionState = RADIOLIB_ERR_NONE;
|
||||||
|
|
||||||
|
// flag to indicate that a packet was sent
|
||||||
|
volatile bool transmittedFlag = false;
|
||||||
|
|
||||||
|
// this function is called when a complete packet
|
||||||
|
// is transmitted by the module
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlag(void) {
|
||||||
|
// we sent a packet, set the flag
|
||||||
|
transmittedFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
@ -70,21 +86,6 @@ void setup() {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a packet was sent
|
|
||||||
volatile bool transmittedFlag = false;
|
|
||||||
|
|
||||||
// this function is called when a complete packet
|
|
||||||
// is transmitted by the module
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlag(void) {
|
|
||||||
// we sent a packet, set the flag
|
|
||||||
transmittedFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// counter to keep track of transmitted packets
|
// counter to keep track of transmitted packets
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
|
@ -26,9 +26,43 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
|
// flag to indicate that a preamble was not detected
|
||||||
|
volatile bool timeoutFlag = false;
|
||||||
|
|
||||||
|
// flag to indicate that a preamble was detected
|
||||||
|
volatile bool detectedFlag = false;
|
||||||
|
|
||||||
|
// this function is called when no preamble
|
||||||
|
// is detected within timeout period
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlagTimeout(void) {
|
||||||
|
// we timed out, set the flag
|
||||||
|
timeoutFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// this function is called when LoRa preamble
|
||||||
|
// is detected within timeout period
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlagDetected(void) {
|
||||||
|
// we got a preamble, set the flag
|
||||||
|
detectedFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// Serial port speed must be high enough for this example
|
// Serial port speed must be high enough for this example
|
||||||
|
@ -64,36 +98,6 @@ void setup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a preamble was not detected
|
|
||||||
volatile bool timeoutFlag = false;
|
|
||||||
|
|
||||||
// flag to indicate that a preamble was detected
|
|
||||||
volatile bool detectedFlag = false;
|
|
||||||
|
|
||||||
// this function is called when no preamble
|
|
||||||
// is detected within timeout period
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlagTimeout(void) {
|
|
||||||
// we timed out, set the flag
|
|
||||||
timeoutFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// this function is called when LoRa preamble
|
|
||||||
// is detected within timeout period
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlagDetected(void) {
|
|
||||||
// we got a preamble, set the flag
|
|
||||||
detectedFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if we need to restart channel activity detection
|
// check if we need to restart channel activity detection
|
||||||
if(detectedFlag || timeoutFlag) {
|
if(detectedFlag || timeoutFlag) {
|
||||||
|
|
|
@ -31,9 +31,46 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
|
// flag to indicate that a preamble was not detected
|
||||||
|
volatile bool timeoutFlag = false;
|
||||||
|
|
||||||
|
// flag to indicate that a preamble was detected
|
||||||
|
volatile bool detectedFlag = false;
|
||||||
|
|
||||||
|
// flag to indicate if we are currently receiving
|
||||||
|
bool receiving = false;
|
||||||
|
|
||||||
|
// this function is called when no preamble
|
||||||
|
// is detected within timeout period
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlagTimeout(void) {
|
||||||
|
// we timed out, set the flag
|
||||||
|
timeoutFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// this function is called when LoRa preamble
|
||||||
|
// is detected within timeout period
|
||||||
|
// IMPORTANT: this function MUST be 'void' type
|
||||||
|
// and MUST NOT have any arguments!
|
||||||
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
ICACHE_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
void setFlagDetected(void) {
|
||||||
|
// we got a preamble, set the flag
|
||||||
|
detectedFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// Serial port speed must be high enough for this example
|
// Serial port speed must be high enough for this example
|
||||||
|
@ -70,39 +107,6 @@ void setup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag to indicate that a preamble was not detected
|
|
||||||
volatile bool timeoutFlag = false;
|
|
||||||
|
|
||||||
// flag to indicate that a preamble was detected
|
|
||||||
volatile bool detectedFlag = false;
|
|
||||||
|
|
||||||
// flag to indicate if we are currently receiving
|
|
||||||
bool receiving = false;
|
|
||||||
|
|
||||||
// this function is called when no preamble
|
|
||||||
// is detected within timeout period
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlagTimeout(void) {
|
|
||||||
// we timed out, set the flag
|
|
||||||
timeoutFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// this function is called when LoRa preamble
|
|
||||||
// is detected within timeout period
|
|
||||||
// IMPORTANT: this function MUST be 'void' type
|
|
||||||
// and MUST NOT have any arguments!
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
|
||||||
ICACHE_RAM_ATTR
|
|
||||||
#endif
|
|
||||||
void setFlagDetected(void) {
|
|
||||||
// we got a preamble, set the flag
|
|
||||||
detectedFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if we need to restart channel activity detection
|
// check if we need to restart channel activity detection
|
||||||
if(detectedFlag || timeoutFlag) {
|
if(detectedFlag || timeoutFlag) {
|
||||||
|
|
|
@ -26,9 +26,13 @@
|
||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue