Compare commits

..

405 commits

Author SHA1 Message Date
6ea0884898 Merge pull request '17.0.3' (#2) from 17.0.3 into master
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Cppcheck / Perform static code check (push) Has been cancelled
Doxygen / doxygen (push) Has been cancelled
CI / CubeCell:CubeCell:CubeCell-Board (push) Has been cancelled
CI / MegaCore:avr:1281 (push) Has been cancelled
CI / MegaCoreX:megaavr:4809 (push) Has been cancelled
CI / STMicroelectronics:stm32:GenF3 (push) Has been cancelled
CI / STMicroelectronics:stm32:Nucleo_64 (push) Has been cancelled
CI / SiliconLabs:silabs:xg24explorerkit (push) Has been cancelled
CI / adafruit:nrf52:feather52832 (push) Has been cancelled
CI / adafruit:samd:adafruit_feather_m0 (push) Has been cancelled
CI / arduino:avr:mega (push) Has been cancelled
CI / arduino:mbed:envie_m4 (push) Has been cancelled
CI / arduino:mbed:nano33ble (push) Has been cancelled
CI / arduino:mbed_rp2040:pico (push) Has been cancelled
CI / arduino:megaavr:uno2018 (push) Has been cancelled
CI / arduino:renesas_uno:minima (push) Has been cancelled
CI / arduino:sam:arduino_due_x (push) Has been cancelled
CI / arduino:samd:arduino_zero_native (push) Has been cancelled
CI / esp32:esp32:esp32 (push) Has been cancelled
CI / esp8266:esp8266:generic (push) Has been cancelled
CI / rp2040:rp2040:rpipico (push) Has been cancelled
CI / stm32duino:STM32F1:mapleMini (push) Has been cancelled
CI / teensy:avr:teensy41 (push) Has been cancelled
CI / metrics (push) Has been cancelled
CI / esp-build (push) Has been cancelled
CI / tock-build (push) Has been cancelled
CI / rpi-build (push) Has been cancelled
CI / rpi-test (push) Has been cancelled
CI / rpi-pico-build (push) Has been cancelled
Reviewed-on: #2
2025-04-02 00:56:25 +02:00
6488c1e20e 17.0.3
Some checks failed
CI / esp32:esp32:esp32 (pull_request) Has been cancelled
CI / esp8266:esp8266:generic (pull_request) Has been cancelled
CI / rp2040:rp2040:rpipico (pull_request) Has been cancelled
CI / stm32duino:STM32F1:mapleMini (pull_request) Has been cancelled
CI / teensy:avr:teensy41 (pull_request) Has been cancelled
Unit test / Build and run unit test (pull_request) Has been cancelled
CodeQL / Analyze (pull_request) Has been cancelled
Cppcheck / Perform static code check (pull_request) Has been cancelled
CI / CubeCell:CubeCell:CubeCell-Board (pull_request) Has been cancelled
CI / MegaCore:avr:1281 (pull_request) Has been cancelled
CI / MegaCoreX:megaavr:4809 (pull_request) Has been cancelled
CI / STMicroelectronics:stm32:GenF3:pnum=BLACKPILL_F303CC (pull_request) Has been cancelled
CI / STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_WL55JC1 (pull_request) Has been cancelled
CI / SiliconLabs:silabs:xg24explorerkit (pull_request) Has been cancelled
CI / adafruit:nrf52:feather52832 (pull_request) Has been cancelled
CI / adafruit:samd:adafruit_feather_m0 (pull_request) Has been cancelled
CI / arduino:avr:mega (pull_request) Has been cancelled
CI / arduino:mbed:envie_m4 (pull_request) Has been cancelled
CI / arduino:mbed:nano33ble (pull_request) Has been cancelled
CI / arduino:mbed_rp2040:pico (pull_request) Has been cancelled
CI / arduino:megaavr:uno2018 (pull_request) Has been cancelled
CI / arduino:renesas_uno:minima (pull_request) Has been cancelled
CI / arduino:sam:arduino_due_x (pull_request) Has been cancelled
CI / arduino:samd:arduino_zero_native (pull_request) Has been cancelled
CI / metrics (pull_request) Has been cancelled
CI / esp-build (pull_request) Has been cancelled
CI / tock-build (pull_request) Has been cancelled
CI / rpi-build (pull_request) Has been cancelled
CI / rpi-test (pull_request) Has been cancelled
CI / rpi-pico-build (pull_request) Has been cancelled
2025-04-02 00:55:54 +02:00
82bb7ac946 fix
Some checks failed
CI / adafruit:nrf52:feather52832 (pull_request) Has been cancelled
CI / adafruit:samd:adafruit_feather_m0 (pull_request) Has been cancelled
CI / arduino:avr:mega (pull_request) Has been cancelled
CI / arduino:mbed:envie_m4 (pull_request) Has been cancelled
CI / arduino:mbed:nano33ble (pull_request) Has been cancelled
CI / arduino:mbed_rp2040:pico (pull_request) Has been cancelled
CI / arduino:megaavr:uno2018 (pull_request) Has been cancelled
CI / arduino:renesas_uno:minima (pull_request) Has been cancelled
CI / arduino:sam:arduino_due_x (pull_request) Has been cancelled
CI / arduino:samd:arduino_zero_native (pull_request) Has been cancelled
CI / esp32:esp32:esp32 (pull_request) Has been cancelled
CI / esp8266:esp8266:generic (pull_request) Has been cancelled
CI / rp2040:rp2040:rpipico (pull_request) Has been cancelled
CI / stm32duino:STM32F1:mapleMini (pull_request) Has been cancelled
CI / teensy:avr:teensy41 (pull_request) Has been cancelled
CI / metrics (pull_request) Has been cancelled
CodeQL / Analyze (pull_request) Has been cancelled
Cppcheck / Perform static code check (pull_request) Has been cancelled
CI / CubeCell:CubeCell:CubeCell-Board (pull_request) Has been cancelled
CI / MegaCore:avr:1281 (pull_request) Has been cancelled
CI / MegaCoreX:megaavr:4809 (pull_request) Has been cancelled
CI / STMicroelectronics:stm32:GenF3:pnum=BLACKPILL_F303CC (pull_request) Has been cancelled
CI / STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_WL55JC1 (pull_request) Has been cancelled
CI / SiliconLabs:silabs:xg24explorerkit (pull_request) Has been cancelled
CI / esp-build (pull_request) Has been cancelled
CI / tock-build (pull_request) Has been cancelled
CI / rpi-build (pull_request) Has been cancelled
CI / rpi-test (pull_request) Has been cancelled
CI / rpi-pico-build (pull_request) Has been cancelled
Unit test / Build and run unit test (pull_request) Has been cancelled
2025-04-02 00:48:45 +02:00
4548b9ffc4 update 2025-04-02 00:46:28 +02:00
a6e737a055 adjusted radiolib.h 2025-04-02 00:41:20 +02:00
jgromes
ec785005aa [SX126x] Zero-initialize version string
Some checks failed
Cppcheck / Perform static code check (push) Waiting to run
Doxygen / doxygen (push) Waiting to run
CI / teensy:avr:teensy41 (push) Waiting to run
CI / rpi-pico-build (push) Waiting to run
CI / STMicroelectronics:stm32:GenF3 (push) Waiting to run
CI / STMicroelectronics:stm32:Nucleo_64 (push) Waiting to run
CI / SiliconLabs:silabs:xg24explorerkit (push) Waiting to run
CI / adafruit:nrf52:feather52832 (push) Waiting to run
CI / adafruit:samd:adafruit_feather_m0 (push) Waiting to run
CI / arduino:avr:mega (push) Waiting to run
CI / arduino:mbed:envie_m4 (push) Waiting to run
CI / arduino:mbed:nano33ble (push) Waiting to run
CI / arduino:mbed_rp2040:pico (push) Waiting to run
CI / arduino:megaavr:uno2018 (push) Waiting to run
CI / arduino:renesas_uno:minima (push) Waiting to run
CI / arduino:sam:arduino_due_x (push) Waiting to run
CI / arduino:samd:arduino_zero_native (push) Waiting to run
CI / esp32:esp32:esp32 (push) Waiting to run
CI / esp8266:esp8266:generic (push) Waiting to run
CI / rp2040:rp2040:rpipico (push) Waiting to run
CI / stm32duino:STM32F1:mapleMini (push) Waiting to run
CI / CubeCell:CubeCell:CubeCell-Board (push) Waiting to run
CI / MegaCore:avr:1281 (push) Waiting to run
CI / MegaCoreX:megaavr:4809 (push) Waiting to run
CI / metrics (push) Blocked by required conditions
CI / esp-build (push) Waiting to run
CI / tock-build (push) Waiting to run
CI / rpi-build (push) Waiting to run
CI / rpi-test (push) Blocked by required conditions
Unit test / Build and run unit test (push) Failing after 2s
2025-03-23 21:47:20 +01:00
jgromes
f0e686eaa9 [Si443x] Add CRC configuration (#1430) 2025-03-14 20:14:52 +01:00
jgromes
416f52d92a [Si443x] Fix CRC error IRQ (#1430) 2025-03-14 20:14:23 +01:00
jgromes
d526ac3091 [RF69] Remove redundant sync word length caching 2025-03-08 13:09:54 +01:00
Jan Gromeš
1b62bc3208
[RF69] Merge pull request #1452 from lyusupov/master
[RF69] further fix for sync word length
2025-03-08 13:09:09 +01:00
Linar Yusupov
77db225396
[RF69] further fix for sync word length 2025-03-08 13:02:05 +03:00
Jan Gromeš
15745bbd1d
[LoRaWAN] Merge pull request #1450 from jgromes/fix-cn470
Fix for CN470 (formerly CN500) (#1447)
2025-03-06 21:03:14 +01:00
StevenCellist
7577ae413f Fix for CN470 (formerly CN500) 2025-03-06 18:31:20 +01:00
Linar Yusupov
c88cf551cc
[SX128x] fix for improper GFSK syncword setting with length other than 5 bytes (#1446)
* [SX128x] fix for improper GFSK syncword setting with length other than 5 bytes

* [SX128x] misc. rework
2025-03-06 17:47:59 +01:00
Linar Yusupov
6bf0c3f735
[RF69] a fix for invalid sync word length setting (#1448)
* [RF69] a fix for invalid sync word length setting

* [RF69] fix maxErrBits width
2025-03-06 07:09:01 +01:00
jgromes
d605bc2058 [SX128x] Add missing const cast 2025-03-04 08:10:09 +01:00
jgromes
08e0c0e613 [SX128x] Simplify sync word configuration 2025-03-03 08:36:03 +01:00
Linar Yusupov
d142928e9f
[SX128x] fix for invalid GSFK sync words order (#1444) 2025-03-03 08:34:26 +01:00
Linar Yusupov
01d1bdae2c
[SX128x] Add support for GFSK fixed packet length mode (#1441)
* [SX1280] add support for GFSK fixed packet length mode

* [SX1280] meet cpp check

* [SX1280] cleanup
2025-03-02 20:26:16 +01:00
Jan Gromeš
56729041b3
[MOD] Add debug timestamps (#1440) 2025-03-02 09:37:55 +01:00
jgromes
b203323ff9 Merge branch 'master' of https://github.com/jgromes/RadioLib 2025-03-02 08:31:49 +01:00
jgromes
07792dc90f [MOD] Return debug information even after post-transfer GPIO timeout (#1434) 2025-03-02 08:31:47 +01:00
jgromes
c9690a7955 [EXT] Remove redundant null check (#1436) 2025-02-27 18:16:30 +01:00
Crsarmv7l
cf776230a4
Slightly increase timeout while waiting for MARC state to be ready for TX (#1429) 2025-02-19 19:44:01 +01:00
jgromes
648ecbed3b [SX127x] Fix typo in doxygen comment 2025-02-18 07:20:42 +01:00
jgromes
6a96d44b2b [SX127x] Fix automated RFO selection (#1412) 2025-02-17 21:19:18 +01:00
jgromes
ae65265268 [LR11x0] Fix rest of latitude/longitude conversion (#1379) 2025-02-17 18:36:36 +01:00
jgromes
9c82d1bdc2 [LR11x0] Fix latitude/longitude for negative values (#1379) 2025-02-17 17:42:20 +01:00
jgromes
4a557f5162 [PHY] Add missing member variable init 2025-02-15 14:57:36 +01:00
jgromes
5f1303aaba [SX128x] Use public frequency step and max packet length variables 2025-02-15 14:49:01 +01:00
jgromes
24c7166170 [SX127x] Use public frequency step and max packet length variables 2025-02-15 14:48:55 +01:00
jgromes
699f025581 [SX126x] Use public frequency step and max packet length variables 2025-02-15 14:48:51 +01:00
jgromes
c420d69193 [Si443x] Use public frequency step and max packet length variables 2025-02-15 14:48:45 +01:00
jgromes
558e60b18d [RF69] Use public frequency step and max packet length variables 2025-02-15 14:48:33 +01:00
jgromes
e4daea6251 [nRF24] Use public frequency step and max packet length variables 2025-02-15 14:48:23 +01:00
jgromes
78e2991459 [LR11x0] Use public frequency step and max packet length variables 2025-02-15 14:48:16 +01:00
jgromes
8286e2d770 [CC1101] Use public frequency step and max packet length variables 2025-02-15 14:48:08 +01:00
jgromes
2fd2926c9f [PHY] Make frequency step and max packet length public variables 2025-02-15 14:47:45 +01:00
jgromes
35059a86ff [SX126x] Remove node address methods from header (#1422) 2025-02-14 22:03:10 +01:00
jgromes
977b2c28c8 [nRF24] Add public LNA control method (#1392) 2025-02-13 18:57:44 +01:00
Crsarmv7l
b9c214db95
[CC1101] FIFO Refills to transmit packets up to 255 bytes (#1404)
* Update CC1101.h

Add Max packet size for FIFO Refills

* Define FIFO Size, Max packet Length for FIFO refills

* FIFO REFILL

- Go through FSTXON State
- Check MARCSTATE to ensure ready to tx
- Initial FIFO fill
- Check FIFO bytes twice in accordance with errata
- Refill FIFO
- Check MARCSTATE is idle before returning

* Fix typos

* Fix another typo

* min -> std::min per build check

* Revert std::min back to min

* Use RADIOLIB_MIN Macro instead of min

* Move MARC State check for Idle to finishTransmit function

Change allows startTransmit to stop blocking once the last bytes are added to the FIFO

* Add timeouts for both MARC state checks

* Fix typo

* No interrupt for packets bigger than 64 bytes

* Initialize state as RADIOLIB_ERR_NONE if avoiding ISR

* Update example with packet size and discussion link

* Update example with new packet size and discussion link

* Update example, clarify blocking on greater than 64 bytes link discussion

* Update doxygen comments for 255 byte limit, limitations and discussion link
2025-02-13 17:20:56 +01:00
jgromes
bcbf2a12e1 [CI] Allow code coverage report deploy only from master 2025-02-11 20:18:32 +01:00
jgromes
584f547954 Fix debug info macro (#1398) 2025-02-11 15:22:32 +01:00
jgromes
2e35481fc2 Fix script argument check 2025-02-11 15:21:30 +01:00
jgromes
e087449c0b Use configurable line feed for debug output (#1398) 2025-02-11 14:28:31 +01:00
Jan Gromeš
e86fb27649
[CI] Measure code coverage after unit test (#1417)
* [CI] Measure code coverage after unit test

* [CI] Update workflow

* [CI] Fix indentation

* [CI] Ignore geninfo errors

* [CI] Force gcov 11

* [CI] Install gcc 11

* [CI] Revert gcc-11

* Use ubuntu 22.04 as unit test runner

* Deploy coverage report to github pages

* Add coverage link

---------

Co-authored-by: jgromes <jan.gromes>
2025-02-10 08:35:52 +01:00
Jan Gromeš
8c2c7b6cb5
[LoRaWAN] Add methods to allow user-provided sleep function (#1410)
* [LoRaWAN] Add methods to allow user-provided sleep function

* Add example sleep function

* [LoRaWAN] Switch all delay calls to sleepDelay

* [LoRaWAN] Remove unused variable

---------

Co-authored-by: StevenCellist <steven@boonstoppel.nu>
2025-02-06 07:00:03 +01:00
Jan Gromeš
45de7978dc
Merge pull request #1416 from lyusupov/master
a fix for build with Arduino Core over Zephyr OS for Nano 33 BLE and Portenta H7 targets
2025-02-05 22:53:02 +01:00
Jan Gromeš
2550fae4cb
[PHY] Staged modes (#1414)
* [PHY] Add PHY support for staged modes

* [SX126x] Add support for staged Rx/Tx

* [PHY] Add missing virtual specifiers

* [SX126x] Add missing overrides

* [LoRaWAN] Use new stageMode and launchMode, reduce scanGuard

* [LoRaWAN] A-synchronize transmissions (#1410)

* [PHY] Pass mode config by reference

* [PHY] Add default implementation of start transmit/receive

* [SX126x] Implement staged modes

* [SX128x] Implement staged modes

* [SX127x] Implement staged modes

* [LR11x0] Implement staged modes

* [SX127x] Remove unused method from header

* [SX126x] Make array const

* Add new methods to keywords

---------

Co-authored-by: StevenCellist <steven@boonstoppel.nu>
2025-02-05 20:41:43 +01:00
Linar Yusupov
3563e7257a
a fix for build with Arduino Core for Zephyr OS for Nano 33 BLE and Portenta H7 targets 2025-02-05 13:23:36 +03:00
jgromes
9e832526a5 [SX127x] Fix lower power range of RFO (#1412) 2025-02-02 10:10:13 +01:00
jgromes
33fd649288 Ensure output dir of spectrum scan always exists 2025-02-02 09:33:16 +01:00
jgromes
f2461edaec [SX127x] Fix mistake in doxygen comment (#1411) 2025-02-01 21:05:58 +01:00
jgromes
4deec953e8 [LLCC68] Add missing override specifiers 2025-01-31 18:25:57 +01:00
jgromes
8ab989ab53 [CI] Add helper script to cppcheck single path 2025-01-31 18:25:38 +01:00
jgromes
b634c9c711 [SX126x] Add missing virtual specifier (#1405) 2025-01-31 18:09:52 +01:00
jgromes
8c304a89c1 [LLCC68] Add override begin FSK and LR-FHSS methods (#1405) 2025-01-31 17:59:47 +01:00
StevenCellist
27653e1cf7 [LoRaWAN] Allow support for misc MAC commands 2025-01-30 20:58:53 +01:00
jgromes
5eb90ea17a [SX126x] Add LR-FHSS interrupt transmit example 2025-01-29 21:14:36 +01:00
jgromes
779e0aa4dd [SX126x] Rename LR-FHSS modem example to transmit 2025-01-29 20:45:41 +01:00
jgromes
c187960cc1 [SX126x] Add public method to handle LR-FHSS hopping 2025-01-29 17:51:20 +00:00
jgromes
fc6ff698b9 [RF69] Fix sync word length not set correctly (#1400) 2025-01-27 18:44:49 +01:00
jgromes
c6096ad3b8 [CI] Fix steps order 2025-01-23 19:04:06 +01:00
jgromes
d0cfd5a461 [CI] Only push metrics from master 2025-01-23 18:41:16 +01:00
Jan Gromeš
73b6a7d5e9
[SX123x] Merge pull request #1397 from lyusupov/master
add chip revision number for Semtech SX123xH
2025-01-23 18:34:53 +01:00
Linar Yusupov
5979a2a7be add chip revision number for SX123xH 2025-01-23 15:35:09 +03:00
jgromes
bedab1a66d [CI] Add unit test for SPIsetRegValue 2025-01-19 21:48:39 +01:00
jgromes
c4ac0ac68b [CI] Add artificial delay to unit test emulated SPI 2025-01-19 21:46:00 +01:00
jgromes
3e146c891e [CI] Fix SPI log wipe 2025-01-19 21:45:32 +01:00
jgromes
4733fdd9d1 Fix debug prints 2025-01-19 18:30:02 +01:00
jgromes
8126e6f508 Suppress double promotion warning for debug 2025-01-19 18:29:56 +01:00
jgromes
650d00b3e3 Added no-tag debug macro to protocol level 2025-01-19 13:27:14 +00:00
jgromes
21a77a6389 [Morse] Fix debug output 2025-01-19 13:26:51 +00:00
jgromes
cbb8126442 [LoRaWAN] Fix possible integer overflow 2025-01-18 21:23:01 +01:00
jgromes
269eb2fe38 [LoRaWAN] Fix typecast 2025-01-18 21:22:17 +01:00
jgromes
0cd69b2e6f [CI] Use v4 artifact download 2025-01-18 18:34:33 +01:00
jgromes
64f0f5028b [LoRaWAN] Cppcheck fixes 2025-01-18 18:14:56 +01:00
jgromes
1324b53f7b [Print] Fix duplicate methods 2025-01-18 18:14:34 +01:00
jgromes
ff24e2b2ae [LoRaWAN] Cppcheck fixes 2025-01-18 17:51:57 +01:00
jgromes
aab3e05386 [Crypto] Cppcheck fixes 2025-01-18 17:51:30 +01:00
jgromes
cc9ce359b6 [OPT] Cppcheck fixes 2025-01-18 17:51:11 +01:00
jgromes
de33ce4d6a [PHY] Cppcheck fixes 2025-01-18 17:50:53 +01:00
jgromes
d685534154 [Print] Cppcheck fixes 2025-01-18 17:50:09 +01:00
jgromes
bf1933a0c4 [Pager] Cppcheck fixes 2025-01-18 17:49:51 +01:00
jgromes
208f4f8ad4 [Morse] Cppcheck fixes 2025-01-18 17:49:37 +01:00
jgromes
1357d672c7 [Hell] Cppcheck fixes 2025-01-18 17:49:24 +01:00
jgromes
9b8b9c2802 [FSK4] Cppcheck fixes 2025-01-18 17:49:10 +01:00
jgromes
dab2c3497c [AX.25] Cppcheck fixes 2025-01-18 17:48:57 +01:00
jgromes
d4d98d37ce [APRS] Cppcheck fixes 2025-01-18 17:48:41 +01:00
jgromes
80a44a3232 [SX128x] Cppcheck fixes 2025-01-18 17:48:25 +01:00
jgromes
06b3049e38 [SX127x] Cppcheck fixes 2025-01-18 17:48:19 +01:00
jgromes
ddd4b23e65 [SX126x] Cppcheck fixes 2025-01-18 17:48:09 +01:00
jgromes
aaa48ba4d8 [Si443x] Cppcheck fixes 2025-01-18 17:47:54 +01:00
jgromes
5e7be10364 [nRF24] Cppcheck fixes 2025-01-18 17:47:34 +01:00
jgromes
d23983bc1f [CI] Suppress missing includes in cppcheck 2025-01-18 16:39:17 +01:00
jgromes
d3d16433bf [SX126x] Cppcheck fixes 2025-01-18 15:43:14 +01:00
jgromes
beb6689287 [RF69] Cppcheck fixes 2025-01-18 15:25:48 +01:00
jgromes
77dad34c05 [LR11x0] Cppcheck fixes 2025-01-18 15:21:40 +01:00
jgromes
3354cd89df [SX126x] MAke LLCC68-shared methods virtual 2025-01-17 22:31:20 +01:00
jgromes
21b8e5a364 [LLCC68] Cppcheck fixes 2025-01-17 22:30:49 +01:00
jgromes
af34dd9691 [CC1101] Cppcheck fixes 2025-01-17 22:30:37 +01:00
jgromes
6733847186 [CI] Suppress unused variable warnings for unimplemented functions 2025-01-17 20:24:10 +01:00
jgromes
5efdfb342a [CI] Always test from clean 2025-01-17 20:00:59 +01:00
jgromes
4088db2cf2 [MOD] Fix issues reported by new cppcheck 2025-01-17 20:00:26 +01:00
jgromes
7c464a0632 Add double-promotion and pedantic warnings to CMake 2025-01-17 19:59:50 +01:00
jgromes
c538cac769 [Morse] Fix possible overflow 2025-01-17 19:59:25 +01:00
jgromes
10c38164f2 [LoRaWAN] Remove range expression in switch 2025-01-17 19:59:10 +01:00
Jan Gromeš
6fb3c0968a
Merge pull request #1387 from MatejFranceskin/pr-fix-warnings
fix implicit conversion from float to double warnings
2025-01-17 19:54:59 +01:00
jgromes
cad09196de [CI] Use v4 artifact action 2025-01-16 18:30:51 +01:00
jgromes
a5011914c5 [CI] Disable self hosted runner actions 2025-01-16 18:27:52 +01:00
Matej Frančeškin
f3276c2e66 fix implicit conversion from float to double warnings 2025-01-15 16:06:47 +01:00
Yegor Shytikov
4f1d367c93
[LR11x0] Skip frequency range verification (#1388)
* Update LR1120.cpp

LR1120 can set the frequency of the documented range. So, allowing another frequency was tested with the LR1121 Lyligo board, which works. Thanks!

* Update LR1120.h

* add RADIOLIB_CHECK_PARAMS

* remove  skipRfValidation parameter

* Fix formating
2025-01-14 20:56:03 +01:00
petrel
04b96873a3
[CC1101]Add sleep function (#1389) 2025-01-14 08:03:43 +01:00
jgromes
9a8affde8e Fix default debug port on non-Arduino platforms (#1380) 2025-01-11 09:32:12 +01:00
jgromes
2ca2ddf968 [CI] Fix passing STM32 part numbers 2025-01-06 18:03:18 +01:00
jgromes
d26b1ff38e Bump version to 7.1.2 2025-01-05 20:20:04 +01:00
jgromes
49f21cc707 [CI] Fix skipping for STM32 2025-01-05 18:28:40 +01:00
jgromes
06f416935f [SX128x] Added explicit typecast 2025-01-05 17:46:42 +01:00
jgromes
5ea881c595 [SX126x] Added explicit typecast 2025-01-05 17:46:36 +01:00
jgromes
92c08c1ebf [LR11x0] Added explicit typecast 2025-01-05 17:46:30 +01:00
Jan Gromeš
cbb8d419d1
[CI] Unit test (#1373)
* [CI] Add basic unit testing

* [CI] Add gitignore

* [CI] Install libfmt

---------

Co-authored-by: jgromes <jan.gromes>
2025-01-05 17:23:13 +01:00
jgromes
a63ca70558 [Pager] Fix debug parameter type 2025-01-05 09:59:55 +01:00
StevenCellist
33b65344c4 [LoRaWAN] Fix ADR backoff difference between 1.0.4 and 1.1 2025-01-04 23:27:18 +01:00
StevenCellist
f346dd3687 [LoRaWAN] Improve handling of invalid MAC commands 2025-01-04 23:18:37 +01:00
StevenCellist
a3782b432c [LoRaWAN] Accept MAC channel mask if ADR is disabled 2025-01-04 16:20:42 +01:00
StevenCellist
283bfb43fe [LoRaWAN] Revert change in dwell time arguments 2025-01-04 16:04:05 +01:00
StevenCellist
5952106e93
[LoRaWAN] Update reference example 2025-01-04 15:05:36 +01:00
StevenCellist
617d759ea5 [LoRaWAN] Fix some MAC commands not being resent 2025-01-04 14:48:25 +01:00
StevenCellist
6ab358c292 [LoRaWAN] Improve dwell time handling under ADR 2025-01-04 14:43:20 +01:00
StevenCellist
92d2dc0f09 [LoRaWAN] Remove unused space in session buffer 2025-01-04 14:27:10 +01:00
jgromes
01e7fa0731 [Pager] Fix sync words in long messages (#1112) 2025-01-04 11:23:07 +01:00
jgromes
b5d36f11e5 [Pager] Minor formatting fixes 2025-01-04 11:22:28 +01:00
Jan Gromeš
7141d261be
[CI] Use SSH deploy key for metrics push (#1371)
Co-authored-by: jgromes <jan.gromes>
2025-01-03 19:27:13 +01:00
CrispyAlice2
680e88c739
Fix frequency issue on SX127x (#1368) (#1369)
* Fix frequency issue on SX127x (#1368)

* Add force option to SPIsetRegValue

* Fix indent
2025-01-03 19:11:29 +01:00
Jan Gromeš
bd4ede2fb7
[CI] Add size metrics (#1367)
* [CI] Add CI scripts, save metrics on build

* Fix token name

* Fix path

* Pass size files via artifacts

* Fix path to artifacts

* Fix git hash in artifact filename

* Fix git hash

* Fix artifact name

* Fix artifact path

* Avoid filenames with colons

* Fix artifact paths

* Remove incorrect cd

* Add missing cd

* Fix paths in second repo

* More path fixing

* Fix artifacts repo name

* Remove path from example filename in output

* Add hash to commit message

* Fix typo

* Fix artifact commit message

* Move git hash

* Use GITHUB_SHA variable

* Drop markdown format

---------

Co-authored-by: jgromes <jan.gromes>
2025-01-01 14:14:08 +01:00
jgromes
92b687821f [MOD] Remove getCs method (#1364) 2024-12-29 10:03:42 +01:00
jgromes
60a093775a [CC1101] Use Module SPI transfer stream 2024-12-29 10:03:13 +01:00
jgromes
c7fb065310 [CC1101] Simplify reset sequence 2024-12-29 09:46:38 +01:00
jgromes
8e35b14fae [nRF24] Use Module SPI transfer stream 2024-12-29 09:33:53 +01:00
jgromes
422dc867e0 Merge branch 'master' of https://github.com/jgromes/RadioLib 2024-12-27 20:41:39 +01:00
jgromes
af6de6a0e0 [CI] Fix library name in release CI 2024-12-27 20:41:37 +01:00
jgromes
b2b4c9e0f7 [SX126x] Use dummy SPI transfer for wakeup (#1364) 2024-12-27 16:26:24 +00:00
jgromes
ff387e93ad [SX128x] Use dummy SPI transfer for wakeup 2024-12-27 16:25:59 +00:00
jgromes
9bff1582bd [LR11x0] Use dummy SPI transfer for wakeup 2024-12-27 16:25:52 +00:00
jgromes
c37015ef94 [CI] Fix typo 2024-12-20 13:53:26 +01:00
jgromes
afa5da7fd6 [CI] Add release workflow 2024-12-20 13:52:09 +01:00
jgromes
6622a0ac99 Bump version to 7.1.1 2024-12-19 14:18:20 +01:00
StevenCellist
c2b44d2552
Add FSK to supported LoRaWAN modulations 2024-12-18 22:48:03 +01:00
jgromes
02fe9f3119 Remove dev files 2024-12-18 08:28:06 +01:00
jgromes
89424a3025 [LoRaWAN] Remove unused parameter 2024-12-18 07:22:06 +00:00
jgromes
661b36cc4c [SX126x] Suppress unused variable warning 2024-12-17 21:05:50 +00:00
jgromes
8c0e8a6586 [SX126x] Remove address filtering from examples (#1268) 2024-12-17 20:27:17 +00:00
jgromes
6e3b870317 [SX126x] Drop support for FSK address filtering (#1268) 2024-12-17 20:12:19 +00:00
jgromes
67547615af [SX126x] Added notes about preamble detector to Doxygen (#1350) 2024-12-16 19:01:30 +00:00
jgromes
eeff547aa4 [SX126x] Fix preamble detector configuration (#1350) 2024-12-16 18:49:18 +00:00
jgromes
5a8ba0003b [SX126x] Fix broken FSK packet params calls (#1350) (#1338) 2024-12-16 08:19:15 +00:00
jgromes
75f087b5c2 [SX126x] Use length from startReceive in implicit header mode 2024-12-15 15:53:13 +01:00
jgromes
ded508cc25 [SX128x] Use length from startReceive in implicit header mode 2024-12-15 15:53:06 +01:00
jgromes
0cc72c8310 [SX127x] Use length from startReceive in implicit header mode (#1345) 2024-12-15 15:48:05 +01:00
jgromes
111de250ec [CC1101] Clarify maximum packet length (#1347) 2024-12-14 14:49:23 +01:00
jgromes
f2a8a894d9 [CI] Add Silicon Labs board to supported platforms 2024-12-14 14:30:56 +01:00
Jan Gromeš
933981e97d
Merge pull request #1343 from lyusupov/master
fix build with Arduino Core for Silicon Labs EFR32 Series 2
2024-12-14 14:27:12 +01:00
StevenCellist
957a533089 [LoRaWAN] Do not reject first JoinAccept for 1.0.4 on Chirpstack 2024-12-14 12:39:27 +01:00
Linar Yusupov
67e5c6ee7b
fix build with Arduino Core for Silicon Labs EFR32 Series 2 2024-12-11 13:57:59 +03:00
jgromes
577a0761ac [SX126x] Make Tx timeout at least 5 ms (#1338) 2024-12-08 10:15:22 +01:00
jgromes
116d60deb2 [SX128x] Make Tx timeout at least 5 ms 2024-12-08 10:14:26 +01:00
jgromes
a692b72347 Move ESP-IDF HAL back to examples (#1322) 2024-11-30 21:53:48 +01:00
StevenCellist
5d6ca6251f [LoRaWAN] Code style fixes 2024-11-26 23:03:09 +01:00
StevenCellist
5e063e7ad8 [LoRaWAN] Update revision naming / RP revision B 2024-11-26 22:27:18 +01:00
StevenCellist
3e634ffb88 [LoRaWAN] Simplify JoinRequest datarate handling 2024-11-26 22:26:12 +01:00
jgromes
855a64c053 [SX126x] Allow SX1261 version string for LLCC68 devices (#1329) 2024-11-26 19:46:43 +01:00
jgromes
24f1535088 [SX126x] Fix upper power range in doxygen 2024-11-24 10:38:35 +01:00
jgromes
0bd5bdc896 [SX126x] Allow 15 dBm on SX1261 (#1329) 2024-11-24 09:29:58 +01:00
jgromes
35f18b049b [LLCC68] Added note about different configuration 2024-11-22 17:16:27 +01:00
jgromes
53e7a309a0 [LLCC68] Added LLCC68 examples 2024-11-22 17:14:59 +01:00
jgromes
ef16e431af [LR11x0] Disable DIO11 for GNSS only (#1275) 2024-11-21 20:09:05 +01:00
jgromes
8d119fc242 [SX128x] Fixed order of ISR functions in examples 2024-11-19 18:52:27 +01:00
jgromes
17bcfcd0bb [SX127x] Fixed order of ISR functions in examples 2024-11-19 18:52:21 +01:00
jgromes
a579eed780 [SX126x] Fixed order of ISR functions in examples 2024-11-19 18:52:16 +01:00
jgromes
0a6d6a26e1 [STM32WLx] Fixed order of ISR functions in examples 2024-11-19 18:52:10 +01:00
jgromes
12d81e6d0f [Si443x] Fixed order of ISR functions in examples 2024-11-19 18:52:02 +01:00
jgromes
1fa7d479ad [RF69] Fixed order of ISR functions in examples 2024-11-19 18:51:57 +01:00
jgromes
f95de45be7 [nRF24] Fixed order of ISR functions in examples 2024-11-19 18:51:49 +01:00
jgromes
2dd69398e3 [LR11x0] Fixed order of ISR functions in examples 2024-11-19 18:51:42 +01:00
jgromes
b33647adc3 [CC1101] Fixed order of ISR functions in examples 2024-11-19 18:51:30 +01:00
Jan Gromeš
b3efc8445c
[STM32WLx] Merge pull request #1326 from radiohound/master
Change order of setFlag function
2024-11-19 18:03:29 +01:00
Walter Dunckel
8eb6f0cf24
Change order of setFlag function
The change allows the code to compile. The same issue exists with a few other examples too.
2024-11-19 06:30:10 -08:00
jgromes
c467b005c2 [SX127x] Add missing state initialization (#1321) 2024-11-18 18:24:12 +01:00
jgromes
c7d6ad3e95 Remove an outdated comment 2024-11-17 19:43:40 +01:00
Alistair Francis
9d9d480a48
hal: Tock: Namespace HAL, update timer implementation and update libtock-c (#1313)
* tock: use native time getter, remove globals

Tock has direct support for querying time. The prior `millis()`
method here replicated the same functionality, but missed some
corner case concerns around overflow/wrapping. Instead, just use
the native Tock time getter method. This also removes unneeded
global variables and methods.

* NonArduino/Tock: Update to latest libtock-c

Update to the latest libtock-c commit. libtock-c now includes a
libtockHal.h, so we can use that instead of the version here.

Signed-off-by: Alistair Francis <alistair@alistair23.me>

---------

Signed-off-by: Alistair Francis <alistair@alistair23.me>
Co-authored-by: Pat Pannuto <pat.pannuto@gmail.com>
2024-11-14 18:51:00 +01:00
jgromes
f3a8c6dc2d Add link to online debug decoder 2024-11-10 17:47:15 +01:00
jgromes
9ac8bb9a7e Drop debug decoder 2024-11-10 17:45:24 +01:00
jgromes
29ede2c354 [MOD] Optimize SPI register writing 2024-11-10 17:43:28 +01:00
jgromes
fe52311371 [SX127x] Added parameter doc and keyword 2024-11-03 18:27:51 +01:00
SzczepanLeon
cb45f4fe5e
[SX127x/RF69] Added setFifoThreshold (#1309)
* [SX127x] Added setFifoThreshold

* [SX127x] Added setFifoThreshold

* Add setFifoThreshold to RF69 class.

* Documentation update, about setFifoThreshold.
2024-11-03 18:25:44 +01:00
jgromes
49868938d6 Update links to status decoder 2024-11-03 12:57:19 +01:00
jgromes
f15de1e7dd Added missing links to doxygen mainpage 2024-11-03 11:16:26 +01:00
jgromes
72ecc275af Added links to status code decoder to issue templates 2024-11-02 17:38:41 +01:00
Alistair Francis
b1d8850d92
hal: Tock: Re-enable pin after detaching interrupt (#1308)
The Tock libtock_lora_phy_gpio_disable_interrupt() syscall will disable
interrupts for the pin, but also put the pin into a disabled low power
state. This isn't what RadioLib expects and casues subsequent LoRaWAN
transfers to fail [1].

So after we disable interrupts and send the pin to low power let's
re-enable inputs as RadioLib expects.

1: https://github.com/jgromes/RadioLib/discussions/1303

Signed-off-by: Alistair Francis <alistair@alistair23.me>
2024-11-02 12:38:43 +01:00
jgromes
e9dd3dc843 Added quick links to readme 2024-11-02 11:01:43 +01:00
Victor Barpp Gomes
a608075fc1
[LoRaWAN] Accept const uint8_t* on public API (#1302) 2024-11-01 17:47:02 +01:00
jgromes
4564d87721 [PHY] Use less generic modem names (#1294) 2024-10-29 17:14:04 +00:00
jgromes
0096c11f99 [CC1101] Added support for 4-FSK (#823) 2024-10-28 21:32:20 +01:00
jgromes
8f3a5c7430 [LR11x0] Use array as LR-FHSS sync word 2024-10-28 18:52:07 +00:00
jgromes
15a751a543 [SX126x] Fix LR-FHSS sync word 2024-10-28 18:51:43 +00:00
jgromes
7bbaf38651 Bump version to 7.1.0 2024-10-28 14:43:46 +01:00
StevenCellist
5cd5d714a8 [LoRaWAN] Fix LR-FHSS cr encoding 2024-10-28 14:32:35 +01:00
StevenCellist
05d5ef2947 [LoRaWAN] Fix LR-FHSS bw encoding 2024-10-28 14:27:04 +01:00
StevenCellist
6a5dcc6a6a [PHY] Revert LR-FHSS bw back to uint8_t 2024-10-28 14:26:48 +01:00
StevenCellist
19b09a0de1 Merge branch 'master' of https://github.com/jgromes/RadioLib 2024-10-28 14:21:28 +01:00
StevenCellist
ef0cfddd01 [LoRaWAN] Improve modem switching 2024-10-28 14:20:26 +01:00
StevenCellist
9f04da29af [PHY] Bump LR-FHSS bw member to float 2024-10-28 14:20:09 +01:00
jgromes
4bd05dee3d [SX126x] Fix member variable 2024-10-28 14:06:36 +01:00
jgromes
e2fd3f7532 [SX126x] Added setDatarate for LR-FHSS 2024-10-28 14:04:56 +01:00
jgromes
f8b66b1cb5 [LR11x0] Added setDatarate for LR-FHSS 2024-10-28 14:04:48 +01:00
jgromes
1c0019ad18 [SX126x] Fix signed comparison warning 2024-10-28 14:01:26 +01:00
StevenCellist
a953475b9a [ArduinoHal] Fix missing directory specifier in include 2024-10-28 13:08:37 +01:00
StevenCellist
412136845f [LoRaWAN] Fix persistence of channel mask (fixes #1293) 2024-10-28 13:02:58 +01:00
jgromes
0156c9004e [LR11x0] Fix RF switch call in examples (#1295) 2024-10-27 19:29:42 +00:00
jgromes
9f4d4ea15e [LR11x0] Fix RF swtich table handling (#1295) 2024-10-27 19:24:11 +00:00
jgromes
334b5fd499 [MOD] Added flag to distinguish DIO and GPIO pins 2024-10-27 19:23:35 +00:00
jgromes
88e11fa0a2 Added note about Arduino Uno and smaller 2024-10-27 08:17:56 +00:00
jgromes
b8b1afdae1 [SX126x] Calibrate image based on frequency change (#1292) 2024-10-27 07:40:10 +00:00
jgromes
28360f9b0f [LR11x0] Calibrate image based on frequency change 2024-10-27 07:39:46 +00:00
jgromes
9f4c15333c [LoRaWAN] Fix debug variable 2024-10-27 07:18:04 +00:00
jgromes
f23f798fe0 [SX126x] Configure preamble detector length based on preamble 2024-10-26 18:13:02 +01:00
jgromes
709fbdb13a [LR11x0] Prevent WiFi scanning attempts on LR1121 (#1290) 2024-10-26 17:07:37 +01:00
jgromes
b12f7052bf [CI] Drop Sparkfun Artemis from build matrix due to lonmg build time 2024-10-26 16:59:46 +01:00
jgromes
3952fe9139 Use pointer assert 2024-10-26 16:59:13 +01:00
jgromes
6b05e9fd23 Added pointer assert 2024-10-26 16:57:43 +01:00
Jan Gromeš
e44e9b4bce
[PHY] Get/Set modem (#1294)
* [PHY] Added set modem method

* Added new keyword

* [SX126x] Added setModem implementation

* [LoRaWAN] Use setModem

* [PHY] Added getModem

* [LoRaWAN] Use getModem instead of caching modulation

* [SX126x] Implement getModem

* Added new keywords

* [LR11x0] Added get/set modem

* [LLCC68] Added get/set modem

* [SX126x] Added missing default branch

* [SX127x] Added get/set modem

* [SX128x] Added get/set modem

* [CI] Drop Hellschreiber from AVR builds

* [CI] Drop Arduino Uno from CI
2024-10-26 17:49:35 +02:00
jgromes
64253f6e36 [HAL] Prevent reinit in PiHal 2024-10-25 17:54:55 +01:00
jgromes
fada24c1c4 [APRS] Added repeaters (#1285) 2024-10-23 18:06:35 +01:00
Linar Yusupov
434afa52f2
[LR11X0] FSK preamble detector length configuration (#1286)
* [LR11X0] pay more attention to selection of FSK preamble detector length
2024-10-23 18:04:29 +02:00
jgromes
8bc4b9a330 [CC1101] Fix direct reception (#1257) 2024-10-22 20:38:20 +02:00
StevenCellist
61494b8270 [LoRaWAN] Fix #1284 (max length) and channel struct for fixed bands 2024-10-22 20:21:52 +02:00
StevenCellist
33ab117c6d [LoRaWAN] Fix incorrect payload size values 2024-10-22 19:15:33 +02:00
StevenCellist
d407908269 [Utils] Fix missing include 2024-10-22 19:00:31 +02:00
Jan Gromeš
9e7c0129e6
[HAL] HALs in src (#1281)
* [HAL] Move HALs to src

* [CI] Temporarily drop unofficial STM32 (package down)

* [LR11x0] Fix ambiguous call

* [CI] Return Maple mini back to build matrix
2024-10-20 19:14:33 +02:00
jgromes
a525d457ef Move RadioShield and CubeCell pin definition to RadioBoards 2024-10-20 16:20:49 +01:00
jgromes
2aa8c6e82a Update all examples, add link to RadioBoards 2024-10-20 16:02:19 +01:00
jgromes
afdf3783c3 [Utils] Drop redundant include 2024-10-20 14:39:33 +01:00
jgromes
cc720a7a24 [SX127x] Added reset to home channel to FHSS examples (#1266) 2024-10-20 14:25:27 +01:00
jgromes
4a155b1922 [Utils] Move generally useful methods to utils 2024-10-20 14:22:23 +01:00
jgromes
0f2f5fdf4a [FEC] Fix some typos 2024-10-19 09:19:37 +02:00
Jan Gromeš
00699ce225
[LR11x0] GNSS support (#1275)
* [LR11x0] Added WIP GNSS control

* [LR11x0] Added almanac update

* [LR11x0] Added almanac update example

* [LR11x0] Add missing memory deallocation

* [LR11x0] Fix underflow in delay until subframe

* [LR11x0] Remove pin mapping from example

* [LR11x0] Finish rework of the GNSS API

* [LR11x0] Added position and satellite examples

* [LR11x0] Fix result member in example

* Added LR11x0 GNSS keywords

* [LR11x0] Fix typo in macro name

* [LR11x0] Print scan failed in example

* [LR11x0] Added GNSS abort
2024-10-18 16:50:36 +02:00
jgromes
710a1540b5 [STM32WLx] Update Rx interrupt example (#1272) 2024-10-14 16:38:57 +01:00
jgromes
56ae9ad76b [SX126x] Fix second call to startReceive breaking reception (#1272) 2024-10-14 16:37:19 +01:00
StevenCellist
94d5d59d80 Merge branch 'master' of https://github.com/jgromes/RadioLib 2024-10-14 12:29:50 +02:00
StevenCellist
3633391442 [LoRaWAN] Fix missing us-to-ms divisor 2024-10-14 12:29:42 +02:00
jgromes
16504803d1 [SX127x] Fix FSK address handling 2024-10-12 14:15:23 +01:00
jgromes
e9b6e27739 [SX126x] Fix FSK addresses on transmission (#1268) 2024-10-12 14:15:05 +01:00
StevenCellist
1ca12abc88
Merge pull request #1267 from PCo-IoT-2024/Feature_isFrmPending
[LoRaWAN] Add `frmPending` field in `LoRaWANEvent_t`
2024-10-11 22:15:41 +02:00
Volker Christian
d9ea40032f [LoRaWAN] Just for convenience: Add a frmPending field in 2024-10-11 21:07:07 +02:00
StevenCellist
aecef28380 [LoRaWAN] Move templates to .h to prevent linker errors 2024-10-10 15:33:19 +02:00
Volker Christian
a7feeee1e0
[SX1276, LoRaWAN] Fix confusing return value in LoRaWAN::processJoinAccept (#1262)
The error RADIOLIB_ERR_LORA_HEADER_DAMAGED board returned fromreadData(...)
and signaled from a SX1276 is in fact correctly ignored but the state
variable is not corrected.

This confuses the caller due to the wrongly returned state value
RADIOLIB_ERR_LORA_HEADER_DAMAGED.

Change: Clear state also.
2024-10-09 20:32:50 +02:00
StevenCellist
bce4d91715 [LoRaWAN] Fix type format 2024-10-07 23:29:14 +02:00
StevenCellist
9db98f2ab4 [LoRaWAN] Collection of fixes (also fixes #1254) 2024-10-07 23:17:41 +02:00
Jan Gromeš
dc77e6e662
[SX126x] LR-FHSS support (#1228)
* [FEC] Added Vitervi encoder

* [SX126x] Added initial LR-FHSS transmission support

* [CI] Use RPi build for CodeQL

* [SX126x] Fix signed comparison warning

* [FEC] Make input to Viterbi encoder const

* [CI] Drop SX126x examples from Arduino Uno builds

* [CI] Build SX123x for CodeQL scan

* [FEC] Fix comparison type

* [SX126x] Added configurable grid step

* [SX126x] Rename convolutional coding class

* [SX126x] Fix payload CRC

* [SX126x] ADded LR-FHSS example

* [SX126x] Make argument const
2024-10-07 20:00:19 +02:00
jgromes
1f11cd1dd5 [LR1110] Added configurable LR-FHSS grid spacing 2024-10-06 10:13:56 +02:00
jacobeva
6e66570241
[SX128x] Add setDataRate method for LoRa modem (#1251) 2024-10-02 20:05:21 +02:00
jacobeva
46a086cfa8
[SX128x] Save context before sleep to allow TX to work on wake (#1249) (#1250) 2024-10-02 17:59:25 +02:00
jgromes
406daee262 Bump version to 7.0.2 2024-09-30 18:11:11 +02:00
jgromes
fdb3ac46ca [SX128x] Fix preamble length calculation (#1243) 2024-09-30 18:10:18 +02:00
Thomas Göttgens
5a9ff5a491
[SX1227x] fix DIO register mapping (#1246) 2024-09-30 16:17:00 +02:00
jgromes
505c0f7910 [CI] Free up some runner disk space (CI_BUILD_ALL) 2024-09-29 16:54:22 +02:00
jgromes
8a83df6ad4 Bump version to 7.0.1 2024-09-29 15:22:40 +02:00
jgromes
38fc7a97a4 [SX127x] Handle multiple IRQ flags (#1190) 2024-09-28 13:29:41 +02:00
StevenCellist
5d076f616a [LoRaWAN] Fix channel mask persistence (#1238) 2024-09-28 12:17:41 +02:00
GUVWAF
98ad30eb10
[LR11x0] Fix CAD IRQ setting (#1240) 2024-09-27 20:30:42 +02:00
Ali Mosallaei
83e05701fe
[HAL] Add tones support for the RPi Pico (#1239)
* Add tones support for RPi Pico

* Add dependencies to CMakeLists

* Address review
2024-09-27 20:26:13 +02:00
Thomas Göttgens
42ae7c92ed
[LR112x] enabled higher bandwidth settings for 2.4G lora (#1235)
* enabled higher bandwidth settings for 2.4G lora

* document new parameters

* use the same cutoff as this->highFreq
2024-09-27 07:03:40 +02:00
GUVWAF
56bf7c87c3
[LR11x0] Implement automatic and forced LDRO (#1237) 2024-09-26 21:13:08 +02:00
GUVWAF
ce673b2939
[SX127x] Fix missing CRC mismatch error (#1236) 2024-09-26 20:57:26 +02:00
mixeysan
a68df0f515
[LR11x0] Fix temperature reading (#1234)
* Update LR11x0.cpp

According LR1121 datasheet

* Update LR11x0.cpp

Now OK

* Update LR11x0.cpp

Now OK
2024-09-26 12:55:55 +02:00
jgromes
af27e44a52 [SX126x] Fix instant RSSI reading 2024-09-25 17:02:37 +01:00
jgromes
da74aa26d2 [SX126x] Simplify rx gain configuration 2024-09-25 17:02:09 +01:00
jgromes
ec6de3795b Merge branch 'master' of https://github.com/jgromes/RadioLib 2024-09-24 20:02:29 +02:00
jgromes
a7a99a2097 [SX126x] Simplify Rx gain retention config 2024-09-24 20:02:27 +02:00
jgromes
07bcf386f5 [LR11x0] LR-FHSS reception is not supported 2024-09-22 18:31:58 +01:00
jgromes
0f6e7653c7 [SX128x] Fix shadowed variable 2024-09-22 18:17:58 +01:00
jgromes
b8cd1353b1 [SX126x] Fix shadowed variable 2024-09-22 18:17:45 +01:00
jgromes
adb5018b72 [LR11x0] Fix shadowed variable 2024-09-22 18:17:29 +01:00
jgromes
102d06a9f8 [SX126x] Added missing implementation 2024-09-22 17:28:51 +01:00
jgromes
0e7c723fb1 [SX126x] Move common setup code to common method 2024-09-22 17:24:59 +01:00
jgromes
f045ed10b5 [FEC] Fix missing parentheses in macro 2024-09-22 17:22:36 +01:00
Egor Shitikov
8068bcc356
[SX128x] getRssi(false) without packet (#1222)
* Update SX128x.h

* Update SX128x.cpp
2024-09-19 22:02:07 +02:00
jgromes
79b1b8c887 [LoRaWAN] Fixed size_t comparison (CI_BUILD_ALL) 2024-09-16 18:56:22 +02:00
jgromes
6aef0628b7 Bump version to 7.0.0 2024-09-16 18:49:18 +02:00
jgromes
9b4e4a86d2 [LoRaWAN] Fix EU868 data rate for WoR and ACK 2024-09-16 18:46:45 +02:00
StevenCellist
e9ed961c97 [LoRaWAN] Fix ADR backoff 2024-09-16 08:36:14 +02:00
StevenCellist
97579292de [LoRaWAN] Remove shadowed variable 2024-09-16 01:28:25 +02:00
StevenCellist
b76327c10f [LoRaWAN] Fix RekeyConf, change session buffer layout 2024-09-16 01:23:10 +02:00
StevenCellist
7f1488eabc [LoRaWAN] Exit beta 2024-09-16 00:39:40 +02:00
StevenCellist
740ee7e235 [LoRaWAN] Verification cleanup 2024-09-16 00:39:12 +02:00
jgromes
d371b50c5a Added type casts for Arduino megaAVR 2024-09-13 17:41:28 +02:00
jgromes
2d5de4bc0f [APRS] Fix debug print 2024-09-12 07:01:56 +02:00
jgromes
d9eb90e59b [APRS] Fix callsign in non-LoRa mode and buffer size (#1215) 2024-09-11 21:43:24 +02:00
jgromes
400382b1e7 [APRS] Fix string conversion in examples 2024-09-11 21:05:01 +02:00
jgromes
8aedf53272 [LoRaWAN] Fix narrow type comparison 2024-09-10 20:27:49 +01:00
jgromes
78a6897e1b [LoRaWAN] Silence class-memaccess warning 2024-09-10 20:24:00 +01:00
StevenCellist
f7f0b62e7f
[LoRaWAN] Major rework (#1204)
* [LoRaWAN] Major rework

* [LoRaWAN] Some CI fixes, add retransmission timeout

* [LoRaWAN] CI fixes

* [LoRaWAN] Add missing initializers

* [LoRaWAN] Return Rx window number, fix casing

* [LoRaWAN] Un-static functions to fix overriding

* [LoRaWAN] Integrate feedback, fix session save/restore

* [LoRaWAN] Add const

* [LoRaWAN] Do not accept invalid Rx2 datarate

* [LoRaWAN] Integrate feedback

* [LoRaWAN] Fix retransmission, ADR backoff, setDatarate; reject out-of-band frequencies

* Update keywords.txt

* [LoRaWAN] Fix initial datarate, misc cleanup

* [LoRaWAN] Update examples

* [LoRaWAN] Update README

* [LoRaWAN] Reject oversized downlinks

* [LoRaWAN] Remove VLAs

* [LoRaWAN] CI fixes

* [LoRaWAN] More CI

* [LoRaWAN] Fix getMaxPayloadLen

* [LoRaWAN] Rename some status codes

* [CI] Skip LoRaWAN on XMega48

* [CI] Skip FW update for LR11x0

---------

Co-authored-by: jgromes <jan.gromes@gmail.com>
2024-09-10 21:11:16 +02:00
Jan Gromeš
50996fa661
[CI] Arduino platform versions & ESP32 3.0.x workaround (#1213)
* [CI] Add configurable package version

* [CI] Fix package version passing

* [CI] Fix swapped logic

* [CI] Try esp32 arduino 2.0.17 to fix linker errors
2024-09-10 20:30:01 +02:00
jgromes
47b8df6874 [LR11x0] Added ping-pong example 2024-09-10 19:23:30 +02:00
jgromes
4263a572b1 [CI] Check for performance issues in cppcheck 2024-09-10 19:21:37 +02:00
jgromes
9fb427d041 [SX128x] Fix unspecified integer width in ranging calculation 2024-09-10 19:21:05 +02:00
jgromes
aadfd0c48c [PHY] Added LR-FHSS DataRate_t 2024-09-10 19:19:22 +02:00
jgromes
c4a129ed74 [PHY] Pass scan config by reference 2024-09-10 19:18:56 +02:00
jgromes
3696672f6f [LR11x0] Remove WIP GNSS functionality (moved to branch) 2024-09-10 18:58:46 +02:00
jgromes
44d2ba8487 [LR11x0] GNSS low level command fixes 2024-09-10 07:17:50 +02:00
Jan Gromeš
885a921ea3
[SX128x] Merge pull request #1206 from Jorropo/fix-signed-ranging-result
fix getRangingResult to properly account for signed numbers
2024-09-07 08:46:52 +02:00
Jorropo
951bfc0625 fix getRangingResult to properly account for signed numbers
I got numbers like this as I approached the slave (raw values before converting to meters):
```
Ranged: 8
Ranged: 6
Ranged: 3
Ranged: 3
Ranged: 5
Ranged: 5
Ranged: 5
Ranged: 6
Ranged: 1
Ranged: 1
Ranged: 800000
Ranged: 800003
Ranged: 800003
```

This is because the ToF becomes smaller than the correction factor resulting in a negative number.

This patch performs Sign Extension from 24bits to 32bits.
This result in returning a negative meter value which makes more sense than an impossibly big one.
2024-09-07 06:25:32 +02:00
jgromes
3115fc2d67 [LR11x0] Fix IRQ masking 2024-09-03 19:06:57 +02:00
jgromes
e0af297c76 [LR1110] Fix default startReceive flags 2024-09-03 18:22:43 +02:00
GUVWAF
eda4ec22ae
[SX126x][SX128x][LR11x0] Don't report CRC mismatch if valid header received (#1203)
* Enable `HEADER_VALID` IRQ flags by default for receiving

* [SX126x] Don't report CRC mismatch if valid header received

* [SX128x] Don't report CRC mismatch if valid header received

* [LR11x0] Don't report CRC mismatch if valid header received
2024-09-01 20:48:17 +02:00
Jan Gromeš
bc801c7004
[PHY] Channel scan configuration (#1190)
* [PHY] Added channel scan configuration

* [LR11x0] Added channel scan configuration

* [SX126x] Added channel scan configuration

* [SX128x] Added channel scan configuration

* Use microsecond timeout

* [PHY] Added generalized IRQ handling via PHY

* [LR11x0] Added generalized IRQ handling via PHY

* [SX126x] Added generalized IRQ handling via PHY

* [SX127x] Added generalized IRQ handling via PHY

* [SX128x] Added generalized IRQ handling via PHY

* Added missing typedef

* [PHY] Fix IRQ method argument type

* [SX128x] Fix non-trivial initializer usage

* [LR11x0] Added missing override specifiers

* [SX126x] Added missing override specifiers

* [SX127x] Added missing override specifiers

* [SX128x] Added missing override specifiers

* [PHY] Added missing IRQ map initializer

* [CI] Drop APRS builds on AVR

* [CI] Drop Morse builds for AVR

* [PHY] Rework generic IRQ to allow multiple flags

* [LR11x0] Rework generic IRQ to allow multiple flags

* [SX126x] Rework generic IRQ to allow multiple flags

* [SX127x] Rework generic IRQ to allow multiple flags

* [SX128x] Rework generic IRQ to allow multiple flags

* [LoRaWAN] Use generic IRQ

* Add missing typedef

* [SX127x] Make Rx mode implicit based on timeout

* [SX127x] Fixed shadowed variable

* [LR11x0] Fix missing initializers

* [SX127x] Added default startReceive arguments

* [LR11x0] Pass scan config by const reference

* [SX126x] Pass scan config by const reference

* [SX128x] Pass scan config by const reference

* [PHY] Pass scan config by const reference

* [SX127x] Add missing IRQ conversion

* [SX126x] Fixed default CAD scan config IRQ

* [LR11x0] Fixed default CAD scan config IRQ

* [LR11x0] Fix comments referencing DIO1
2024-09-01 18:19:07 +02:00
Jan Gromeš
d9c0c4ed44
Update bug_report.md 2024-09-01 08:35:37 +02:00
Jan Gromeš
a68f689a85
Update module-not-working.md 2024-09-01 08:34:00 +02:00
Jan Gromeš
d3f9eaf30b
Merge pull request #1199 from FrauBluher/pr-double-float-explicit
Reconcile implicit double / float promotion in math functions.
2024-08-29 17:41:57 +02:00
Pavlo Manovi
6847fcda5c Reconcile implicit double / float promotion with math functions and passed function value types. Also suppress incorrect unused variable warnings when variables are used in logging macros. 2024-08-29 09:30:31 -04:00
Jan Gromeš
0abb7512fc
Merge pull request #1188 from jgromes/irqFlags
[PHY, modules, LoRaWAN] Generalize IRQ checks
2024-08-18 09:57:40 +02:00
StevenCellist
647fa23ce9 [LoRaWAN] Remove redundant PHY check 2024-08-17 22:04:28 +02:00
StevenCellist
0bc0e3d9c8 [PHY, modules, LoRaWAN] Integrate feedback 2024-08-17 22:03:48 +02:00
jgromes
260534741d Added readme to ESP-IDF example 2024-08-17 21:19:14 +02:00
jgromes
2717ef5c21 Merge branch 'master' into irqFlags 2024-08-16 22:38:12 +02:00
jgromes
382bf19100 Remove more duplicates from manifest files 2024-08-16 22:33:43 +02:00
jgromes
c35f4044e7 Fixed duplicate tag in manifest files 2024-08-16 22:12:13 +02:00
jgromes
66799fca92 Update IDF manifest to new format 2024-08-16 22:07:42 +02:00
StevenCellist
32dc5babd4 [LoRaWAN] Move to generalized IRQ check (PHY) 2024-08-16 00:05:55 +02:00
StevenCellist
b401d11127 [SX128x] Implement generalized IRQ checks 2024-08-16 00:05:06 +02:00
StevenCellist
08f92cdd29 [SX127x] Generalize IRQ checks 2024-08-16 00:04:52 +02:00
StevenCellist
3a73ed8c1f [SX126x] Generalize IRQ checks 2024-08-16 00:04:42 +02:00
StevenCellist
0eb987a83c [LR11x0] Generalize IRQ checks 2024-08-16 00:04:34 +02:00
StevenCellist
19ec9da281 [PHY] Generalize IRQ checks 2024-08-16 00:03:55 +02:00
Jan Gromeš
56249713f3
Merge pull request #1185 from GUVWAF/rxBufferOffset
[SX126x/SX128x] Start reading from Rx buffer offset
2024-08-10 22:16:05 +02:00
GUVWAF
ddaf1ffd52 [SX128x] Remove unnecessary (void)update; 2024-08-10 18:40:19 +02:00
GUVWAF
8b5d705174 [SX126x] Remove unnecessary (void)update; 2024-08-10 18:40:09 +02:00
GUVWAF
5f6f6f9a3c [SX128x] Start reading from Rx buffer offset 2024-08-10 12:56:12 +02:00
GUVWAF
0620d8edda [SX126x] Start reading from Rx buffer offset
Remove setting RxBaseAddr to 0
2024-08-10 12:56:12 +02:00
jgromes
141bdd0998 [MOD] Make hexdump format match xxd 2024-08-09 21:25:39 +02:00
Jan Gromeš
a025b78f53
Merge pull request #1184 from mycosd/master
SX127x: Set FIFO read pointer to the start of the current packet
2024-08-09 21:24:42 +02:00
Maik Menz
701c6f8e46 SX127x: Set FIFO read pointer to the start of the current packet 2024-08-09 19:19:33 +02:00
jgromes
079874345b [FEC] Move generically useful macros 2024-08-05 21:08:35 +02:00
jgromes
d95e5e39e8 [MOD] Added missing Doxygen parameter 2024-08-05 21:06:35 +02:00
jgromes
908e297d60 [LR11x0] Added register to set LNA mode 2024-08-05 21:03:39 +02:00
jgromes
4e274fab07 Fix typo in comment 2024-08-04 21:41:10 +02:00
jgromes
39bfa51518 Added verbose assert 2024-08-04 16:33:23 +02:00
StevenCellist
6d0c226e65 Merge branch 'master' of https://www.github.com/jgromes/RadioLib 2024-07-22 21:30:09 +02:00
StevenCellist
6fdaef0953 Revert libtock being included 2024-07-22 21:29:54 +02:00
StevenCellist
9195dbabda
[LoRaWAN] Fix downlink user-MAC commands piling up 2024-07-21 22:39:28 +02:00
StevenCellist
907d9f9ef2 Merge branch 'master' of https://www.github.com/jgromes/RadioLib 2024-07-21 21:37:25 +02:00
StevenCellist
a6c9d0037a [LoRaWAN] Collection of fixes
- Fix v1.0.4 MAC-in-payload decryption
- Don't process 0MHz frequencies from CFList
- Fix downlink-event datarate not showing correctly after ADR request
- Convert getDevAddr to uint32_t
- Backend: improve MAC Queue<>Buffer processing
2024-07-21 21:37:01 +02:00
jgromes
7c3ed88c0d [SX126x] Clarify DIO3 for AFSK-based examples 2024-07-20 16:41:13 +02:00
jgromes
737e948efc [LR11x0] Fix printf types 2024-07-18 17:32:46 +02:00
jgromes
0a77cae0de [LR11x0] Remove debug hexdump 2024-07-18 17:25:53 +02:00
jgromes
15b8489f1d [LR11x0] Cleanup, mark GNSS methods as work-in-progress 2024-07-18 17:16:53 +02:00
Jan Gromeš
aa0c017134
Merge pull request #1167 from kb9nate/patch-2
Update SX1278.cpp Turn on LnaBoost even in AutoAGC mode
2024-07-18 16:46:52 +02:00
Jan Gromeš
111fb37d50
Merge pull request #1166 from kb9nate/patch-1
Update SX1278.cpp to fix errataFix typo
2024-07-18 16:28:41 +02:00
Nate Welch
3985c2edc4
Update SX1278.cpp Turn on LnaBoost even in AutoAGC mode
LnaBoost can still be enabled when the gain is not manually set.
The Receiver Sensitivity ratings in the SX1276/7/8 datasheet are specified with the LnaBoost enabled.

I tested this on a few boards here and on average get a 3dB increase in signal strength. This is comparable to the SX1262 "Boosted Gain" setting
2024-07-18 09:20:59 -05:00
Nate Welch
ceba2d9b3b
Update SX1278.cpp to fix errataFix typo
The binary representations that were being written to register 0x31 were not setting the correct bit. In particular for the 500kHz bandwidth setting. Changed from 0b1000000 to 0b10000000
2024-07-18 08:45:29 -05:00
jgromes
858bf6409e [LR11x0] Fix SNR calculation (#1161) 2024-07-16 21:10:47 +02:00
jgromes
fffb1fae9f [PHY] Make transmit data const (#1156) 2024-07-13 16:42:46 +01:00
Jan Gromeš
a93dd1af91
Merge pull request #1158 from alistair23/alistair/scan-guard
protocol: LoRaWAN: Allow configuring scanGuard
2024-07-13 17:10:01 +02:00
jgromes
fb049cc3af [SSTV] Added Robot36 and Robot72 modes (#1160) 2024-07-13 14:53:57 +01:00
Alistair Francis
5b9cad0c8c protocol: LoRaWAN: Allow configuring scanGuard
The current code uses scanGuard to increase the Rx window. Sometimes the
default 10ms scanGuard isn't enough. So allow uses of LoRaWAN to set a
larger scanGuard.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
2024-07-11 10:09:55 +10:00
StevenCellist
d1bfccd612 Merge branch 'master' of https://github.com/jgromes/RadioLib 2024-07-09 21:01:11 +02:00
StevenCellist
0eeb5fe0d9 [LoRaWAN] Fix #1154, finalize LW v1.0.4
Holiday parting gift - happy holidays!
2024-07-09 21:01:09 +02:00
Jan Gromeš
5185443d6e
Merge pull request #1155 from SebKuzminsky/fix-clear-fhss-interrupt-6.6.0
[SX127x] When clearing the FHSS interrupt, don't also clear all the others
2024-07-09 20:14:19 +02:00
Sebastian Kuzminsky
a9bd1bffe8 [SX127x] When clearing the FHSS interrupt, don't also clear all the others 2024-07-08 15:36:39 -06:00
Oliver
61a4cae935
Method SetBitrateTolerance added for CC1101, Updated error handling (#1152)
* Update TypeDef.h

* Update CC1101.h

* Update CC1101.cpp

* Update CC1101.cpp

Update of error handling
2024-07-08 22:37:09 +02:00
Alistair Francis
ace0997359
NonArduino: Tock: A collection of fixes for LoRaWAN support (#1145) 2024-07-03 18:23:00 +02:00
Jan Gromeš
71a7ebf86e
Merge pull request #1144 from lyusupov/master
[LR11x0] use the same irq mask for both DIO9 and DIO11
2024-07-02 06:48:41 +02:00
Linar Yusupov
edae29e1e9 [LR11x0] use the same irq mask for both DIO9 and DIO11 2024-07-01 21:29:12 +03:00
jgromes
7a0b5bae99 Merge branch 'master' of https://github.com/jgromes/RadioLib 2024-06-29 18:36:24 +02:00
jgromes
786dea5f56 [SX127x] Added delay to halting while loops 2024-06-29 18:34:41 +02:00
jgromes
3bf973d568 [SX126x] Added delay to halting while loops 2024-06-29 18:34:29 +02:00
jgromes
b34be58e1a [Stream] Added delay to halting while loops 2024-06-29 18:33:34 +02:00
jgromes
406197e667 [SX123x] Added delay to halting while loops 2024-06-29 18:33:25 +02:00
jgromes
87c1851dc4 [STM32WL] Added delay to halting while loops 2024-06-29 18:33:19 +02:00
jgromes
e942ac5ffc [SSTV] Added delay to halting while loops 2024-06-29 18:33:03 +02:00
jgromes
abbbda671b [Si443x] Added delay to halting while loops 2024-06-29 18:32:48 +02:00
jgromes
3ee37e4de5 [RTTY] Added delay to halting while loops 2024-06-29 18:32:38 +02:00
jgromes
d99dd952df [RF69] Added delay to halting while loops 2024-06-29 18:32:30 +02:00
jgromes
ff5b7117bf [PHY] Added delay to halting while loops 2024-06-29 18:32:19 +02:00
jgromes
1178f5e718 [Pager] Added delay to halting while loops 2024-06-29 18:32:05 +02:00
jgromes
d3a81e4fa4 [nRF24] Added delay to halting while loops 2024-06-29 18:31:54 +02:00
jgromes
0023a73069 [Morse] Added delay to halting while loops 2024-06-29 18:31:46 +02:00
jgromes
2b844ae816 [LR11x0] Added delay to halting while loops 2024-06-29 18:31:38 +02:00
jgromes
83bf003589 [Hell] Added delay to halting while loops 2024-06-29 18:31:27 +02:00
jgromes
5908841834 [FSK4] Added delay to halting while loops 2024-06-29 18:31:20 +02:00
jgromes
ab7ed60b2c [CC1101] Added delay to halting while loops 2024-06-29 18:31:13 +02:00
jgromes
74c5bb253c [Bell] Added delay to halting while loops 2024-06-29 18:31:07 +02:00
jgromes
6f1ec9f016 [AX25] Added delay to halting while loops 2024-06-29 18:31:01 +02:00
jgromes
3ebf371f6b [APRS] Added delay to halting while loops 2024-06-29 18:30:50 +02:00
jgromes
44ee248de9 [AFSK] Added delay to halting while loops 2024-06-29 18:29:11 +02:00
jgromes
798ba3efbe [SX128x] Added delay to halting while loops 2024-06-29 18:28:58 +02:00
StevenCellist
33480235d6 [LoRaWAN] Fix JoinRequest dwelltime calculation 2024-06-27 17:38:29 +02:00
jgromes
ce8e6fdfb0 [SX126x] Added missing PHY getRSSI (#1132) 2024-06-25 16:56:26 +01:00
jgromes
e406c550b8 [LR11x0] Fix output power configuration at S-band (#1128) 2024-06-21 17:53:11 +02:00
jgromes
87fac1797e [LR11x0] Do not read out GNSS and WiFi versions on LR1121 (#1128) 2024-06-21 17:04:46 +02:00
jgromes
ff7ac57aeb [CI] Remove lg archive after install 2024-06-19 21:19:23 +02:00
jgromes
cdefb0e614 Merge branch 'master' of https://github.com/jgromes/RadioLib 2024-06-19 21:08:13 +02:00
jgromes
d31d9968af [LoRaWAN] Remove pin maps from example config file (#1106) 2024-06-19 21:08:11 +02:00
jgromes
bc36c1e98a Use lgpio as the RPi HAL 2024-06-14 19:49:19 +01:00
jgromes
940eb07674 [HAL] Fix tone on ESP32 IDF > 5.0.0 (#1123) 2024-06-13 17:09:23 +02:00
268 changed files with 14852 additions and 9073 deletions

View file

@ -7,15 +7,35 @@ assignees: ''
---
**IMPORTANT: Check the wiki**
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.
**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/). 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**
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**.
<details><summary>Debug mode output</summary>
<p>
```
paste the debug output here
```
</p>
</details>
**To Reproduce**
Minimal Arduino sketch to reproduce the behavior. Please use Markdown to style the code to make it readable (see [Markdown Cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code)).
<details><summary>Sketch that is causing the module fail</summary>
<p>
```c++
paste the sketch here, even if it is an unmodified example code
```
</p>
</details>
**Expected behavior**
A clear and concise description of what you expected to happen.
@ -27,4 +47,4 @@ If applicable, add screenshots to help explain your problem.
- Link to Arduino core: [e.g. https://github.com/stm32duino/Arduino_Core_STM32 when using official STM32 core. See readme for links to all supported cores]
- Wireless module type [e.g. CC1101, SX1268, etc.]
- Arduino IDE version [e.g. 1.8.5]
- Library version [e.g. 3.0.0]
- Library version [e.g. 3.0.0 or git hash]

View file

@ -7,8 +7,8 @@ assignees: ''
---
**IMPORTANT: Check the wiki**
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.
**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/). 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.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

View file

@ -9,26 +9,40 @@ assignees: ''
**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.
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).
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).
**Sketch that is causing the module fail**
<details><summary>Sketch that is causing the module fail</summary>
<p>
```c++
paste the sketch here, even if it is an unmodified example code
```
</p>
</details>
**Hardware setup**
Wiring diagram, schematic, pictures etc.
**Debug mode output**
Enable the appropriate [debug levels](https://github.com/jgromes/RadioLib/wiki/Debug-mode) and paste the Serial monitor output here. For debugging protocols, enable `RADIOLIB_DEBUG_PROTOCOL`. For debugging issues with the radio module itself, enable `RADIOLIB_DEBUG_SPI`.
<details><summary>Debug mode output</summary>
<p>
```
paste the debug output here
```
</p>
</details>
**Additional info (please complete):**
- MCU: [e.g. Arduino Uno, ESP8266 etc.]
- Link to Arduino core: [e.g. https://github.com/stm32duino/Arduino_Core_STM32 when using official STM32 core. See readme for links to all supported cores]
- Wireless module type [e.g. CC1101, SX1268, etc.]
- Arduino IDE version [e.g. 1.8.5]
- Library version [e.g. 3.0.0]
- Library version [e.g. 3.0.0 or git hash]

View file

@ -9,7 +9,7 @@ assignees: ''
**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.
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).
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).

View file

@ -54,7 +54,7 @@ jobs:
- name: Build example
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
uses: github/codeql-action/analyze@v3

View file

@ -10,12 +10,11 @@ on:
id:
description: The ID of the platform on which the build is run
required: true
default: arduino:avr:uno
default: arduino:avr:mega
type: choice
options:
- all
- none
- arduino:avr:uno
- arduino:avr:mega
- arduino:mbed:nano33ble
- arduino:mbed:envie_m4
@ -27,7 +26,6 @@ on:
- esp32:esp32:esp32
- esp8266:esp8266:generic
- Intel:arc32:arduino_101
- SparkFun:apollo3:sfe_artemis
- STMicroelectronics:stm32:GenF3:pnum=BLACKPILL_F303CC
- STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_WL55JC1
- stm32duino:STM32F1:mapleMini
@ -38,6 +36,7 @@ on:
- MegaCore:avr:1281
- teensy:avr:teensy41
- arduino:renesas_uno:minima
- SiliconLabs:silabs:xg24explorerkit
jobs:
build:
@ -45,8 +44,6 @@ jobs:
matrix:
# platform-dependent settings - extra board options, board index URLs, skip patterns etc.
include:
- id: arduino:avr:uno
run: echo "skip-pattern=(STM32WL|SSTV|LoRaWAN|LR11x0_Firmware_Update|Pager)" >> $GITHUB_OUTPUT
- id: arduino:avr:mega
run: |
echo "options=':cpu=atmega2560'" >> $GITHUB_OUTPUT
@ -79,24 +76,23 @@ jobs:
- id: esp32:esp32:esp32
run: |
python -m pip install pyserial
echo "version=2.0.17" >> $GITHUB_OUTPUT
echo "index-url=--additional-urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" >> $GITHUB_OUTPUT
- id: esp8266:esp8266:generic
run: |
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 "index-url=--additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json" >> $GITHUB_OUTPUT
- id: SparkFun:apollo3:sfe_artemis
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
- id: STMicroelectronics:stm32:GenF3
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 "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
- id: STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_WL55JC1
- id: STMicroelectronics:stm32:Nucleo_64
run: |
echo "options=':pnum=NUCLEO_WL55JC1'" >> $GITHUB_OUTPUT
# 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
- id: stm32duino:STM32F1:mapleMini
run: |
@ -106,7 +102,7 @@ jobs:
- id: MegaCoreX:megaavr:4809
run: |
echo "index-url=--additional-urls https://mcudude.github.io/MegaCoreX/package_MCUdude_MegaCoreX_index.json" >> $GITHUB_OUTPUT
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update|LoRaWAN)" >> $GITHUB_OUTPUT
- id: arduino:mbed_rp2040:pico
- id: rp2040:rp2040:rpipico
run: echo "index-url=--additional-urls https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json" >> $GITHUB_OUTPUT
@ -125,13 +121,19 @@ jobs:
- id: arduino:renesas_uno:minima
run: |
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
name: ${{ matrix.id }}
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:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
- name: Install arduino-cli
if: ${{ env.run-build == 'true' }}
run:
@ -166,7 +168,11 @@ jobs:
run:
|
arduino-cli core update-index ${{ format('{0}', steps.prep.outputs.index-url) }}
arduino-cli core install ${{ format('{0}:{1} {2}', steps.split.outputs._0, steps.split.outputs._1, steps.prep.outputs.index-url) }}
if [ -z '${{ steps.prep.outputs.version }}' ]; then
arduino-cli core install ${{ format('{0}:{1} {2}', steps.split.outputs._0, steps.split.outputs._1, steps.prep.outputs.index-url) }}
else
arduino-cli core install ${{ format('{0}:{1}@{3} {2}', steps.split.outputs._0, steps.split.outputs._1, steps.prep.outputs.index-url, steps.prep.outputs.version) }}
fi
- name: Checkout repository
if: ${{ env.run-build == 'true' }}
@ -176,28 +182,64 @@ jobs:
if: ${{ env.run-build == 'true' }}
run:
|
for example in $(find $PWD/examples -name '*.ino' | sort); do
# check whether to skip this sketch
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
cd $PWD/extras/test/ci
./build_examples.sh ${{ matrix.id }} "${{ steps.prep.outputs.skip-pattern }}" ${{ steps.prep.outputs.options }}
- name: Extract short commit hash
id: short-hash
run: echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
- name: Parse sizes
if: ${{ env.run-build == 'true' }}
run:
|
cd $PWD/extras/test/ci
./parse_size.sh ${{ matrix.id }}
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
# build sketch
echo -e "\n\033[1;33mBuilding ${example##*/} ... \033[0m";
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 }}
if [ $? -ne 0 ]; then
echo -e "\033[1;31m${example##*/} build FAILED\033[0m\n";
exit 1;
else
echo -e "\033[1;32m${example##*/} build PASSED\033[0m\n";
fi
fi
done
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:
runs-on: ubuntu-latest
@ -247,10 +289,11 @@ jobs:
run: |
cd $PWD/examples/NonArduino/Tock
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
rpi-build:
if: false # self-hosted runner temporarily disabled
runs-on: [self-hosted, ARM64]
steps:
- name: Checkout repository
@ -259,7 +302,14 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y pigpio cmake
sudo apt-get install -y cmake wget swig python-dev python3-dev python-setuptools python3-setuptools
wget http://abyz.me.uk/lg/lg.zip
unzip lg.zip
cd lg
make
sudo make install
cd ..
sudo rm -rf lg
- name: Install the library
run: |
@ -275,6 +325,7 @@ jobs:
./build.sh
rpi-test:
if: false # self-hosted runner temporarily disabled
needs: rpi-build
runs-on: [self-hosted, ARM64]
steps:

37
.github/workflows/release.yml vendored Normal file
View 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
View 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
View file

@ -11,13 +11,6 @@
# Jetbrain IDEs
.idea
# Debug decoder
extras/decoder/log.txt
extras/decoder/out.txt
# Spectrum scan
extras/SX126x_Spectrum_Scan/out/*
# PlatformIO
.pio*

View file

@ -36,7 +36,7 @@ target_include_directories(RadioLib
set_property(TARGET RadioLib PROPERTY CXX_STANDARD 20)
# enable most warnings
target_compile_options(RadioLib PRIVATE -Wall -Wextra)
target_compile_options(RadioLib PRIVATE -Wall -Wextra -Wpedantic -Wdouble-promotion)
include(GNUInstallDirs)

View file

@ -4,8 +4,6 @@
## 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.
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!
### 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:
* __CC1101__ FSK radio module
* __LLCC68__ LoRa module
@ -43,13 +48,13 @@ SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x, LR11x0 and
SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x and SX128x
* [__POCSAG__](https://www.sigidwiki.com/wiki/POCSAG) using 2-FSK for modules:
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
* NOTE: LoRaWAN support is currently in beta, feedback via [Issues](https://github.com/jgromes/RadioLib/issues) and [Discussions](https://github.com/jgromes/RadioLib/discussions) is appreciated!
### Supported Arduino platforms:
* __Arduino__
* [__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
* [__megaAVR__](https://github.com/arduino/ArduinoCore-megaavr) - Arduino Uno WiFi Rev.2 and Nano Every
* [__SAM__](https://github.com/arduino/ArduinoCore-sam) - Arduino Due
@ -89,4 +94,7 @@ SX127x, RFM9x, SX126x, LR11x0 and SX128x
* __PJRC__
* [__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.

View file

@ -1,19 +1,19 @@
/*
RadioLib AFSK External Radio example
RadioLib AFSK External Radio example
This example shows how to use your Arduino
as modulator for an external analogue FM radio.
The example sends APRS position reports with
audio modulated as AFSK at 1200 baud using
Bell 202 tones. However, any other AFSK
protocol (RTTY, SSTV, etc.) may be used as well.
This example shows how to use your Arduino
as modulator for an external analogue FM radio.
The example sends APRS position reports with
audio modulated as AFSK at 1200 baud using
Bell 202 tones. However, any other AFSK
protocol (RTTY, SSTV, etc.) may be used as well.
DO NOT transmit in APRS bands unless
you have a ham radio license!
DO NOT transmit in APRS bands unless
you have a ham radio license!
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -46,7 +46,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize APRS client
@ -58,7 +58,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}
@ -66,15 +66,20 @@ void loop() {
Serial.print(F("[APRS] Sending position ... "));
// send a location without message or timestamp
int state = aprs.sendPosition("N0CALL", 0, "4911.67N", "01635.96E");
char destination[] = "N0CALL";
char latitude[] = "4911.67N";
char longitude[] = "01635.96E";
int state = aprs.sendPosition(destination, 0, latitude, longitude);
delay(500);
// send a location with message and without timestamp
state |= aprs.sendPosition("N0CALL", 0, "4911.67N", "01635.96E", "I'm here!");
char message[] = "I'm here!";
state |= aprs.sendPosition(destination, 0, latitude, longitude, message);
delay(500);
// send a location with message and timestamp
state |= aprs.sendPosition("N0CALL", 0, "4911.67N", "01635.96E", "I'm here!", "093045z");
char timestamp[] = "093045z";
state |= aprs.sendPosition(destination, 0, latitude, longitude, message, timestamp);
delay(500);
if(state == RADIOLIB_ERR_NONE) {

View file

@ -1,21 +1,21 @@
/*
RadioLib AFSK Imperial March Example
RadioLib AFSK Imperial March Example
This example shows how to EXECUTE ORDER 66
This example shows how to EXECUTE ORDER 66
Other modules that can be used for AFSK:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
- SX126x/LLCC68 (only devices without TCXO!)
Other modules that can be used for AFSK:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
- SX126x/LLCC68
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -58,7 +58,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize AFSK client
@ -69,7 +69,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}

View file

@ -1,7 +1,7 @@
/*
Note definitions, melody and melody-related functions
adapted from https://github.com/robsoncouto/arduino-songs
by Robson Couto, 2019
Note definitions, melody and melody-related functions
adapted from https://github.com/robsoncouto/arduino-songs
by Robson Couto, 2019
*/
#define NOTE_B0 31

View file

@ -1,22 +1,22 @@
/*
RadioLib AFSK Example
RadioLib AFSK Example
This example shows hot to send audio FSK tones
using SX1278's FSK modem.
This example shows hot to send audio FSK tones
using SX1278's FSK modem.
Other modules that can be used for AFSK:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
- SX126x/LLCC68 (only devices without TCXO!)
Other modules that can be used for AFSK:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
- SX126x/LLCC68
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -56,7 +56,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize AFSK client
@ -67,7 +67,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}

View file

@ -1,20 +1,20 @@
/*
RadioLib AM-modulated AFSK Example
RadioLib AM-modulated AFSK Example
This example shows hot to send AM-modulated
audio FSK tones using SX1278's OOK modem.
This example shows hot to send AM-modulated
audio FSK tones using SX1278's OOK modem.
Other modules that can be used for AFSK:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
Other modules that can be used for AFSK:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -51,7 +51,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize AFSK client
@ -62,7 +62,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// after that, set mode to OOK
@ -73,7 +73,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}

View file

@ -1,28 +1,28 @@
/*
RadioLib APRS Mic-E Example
RadioLib APRS Mic-E Example
This example sends APRS position reports
encoded in the Mic-E format using SX1278's
FSK modem. The data is modulated as AFSK
at 1200 baud using Bell 202 tones.
This example sends APRS position reports
encoded in the Mic-E format using SX1278's
FSK modem. The data is modulated as AFSK
at 1200 baud using Bell 202 tones.
DO NOT transmit in APRS bands unless
you have a ham radio license!
DO NOT transmit in APRS bands unless
you have a ham radio license!
Other modules that can be used for APRS:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- nRF24
- Si443x/RFM2x
- SX126x/LLCC68 (only devices without TCXO!)
Other modules that can be used for APRS:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- nRF24
- Si443x/RFM2x
- SX126x/LLCC68
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -35,9 +35,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module
// this requires connection to the module direct
@ -74,7 +78,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize AX.25 client
@ -88,7 +92,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize APRS client
@ -100,7 +104,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}

View file

@ -1,28 +1,28 @@
/*
RadioLib APRS Position Example
RadioLib APRS Position Example
This example sends APRS position reports
using SX1278's FSK modem. The data is
modulated as AFSK at 1200 baud using Bell
202 tones.
This example sends APRS position reports
using SX1278's FSK modem. The data is
modulated as AFSK at 1200 baud using Bell
202 tones.
DO NOT transmit in APRS bands unless
you have a ham radio license!
DO NOT transmit in APRS bands unless
you have a ham radio license!
Other modules that can be used for APRS:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- nRF24
- Si443x/RFM2x
- SX126x/LLCC68 (only devices without TCXO!)
Other modules that can be used for APRS:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- nRF24
- Si443x/RFM2x
- SX126x/LLCC68
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -35,9 +35,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module
// this requires connection to the module direct
@ -74,7 +78,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize AX.25 client
@ -88,7 +92,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize APRS client
@ -100,32 +104,54 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}
void loop() {
Serial.print(F("[APRS] Sending position ... "));
Serial.println(F("[APRS] Sending location reports"));
// send a location without message or timestamp
int state = aprs.sendPosition("N0CALL", 0, "4911.67N", "01635.96E");
char destination[] = "N0CALL";
char latitude[] = "4911.67N";
char longitude[] = "01635.96E";
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);
// send a location with message and without timestamp
state |= aprs.sendPosition("N0CALL", 0, "4911.67N", "01635.96E", "I'm here!");
delay(500);
// send a location with message and timestamp
state |= aprs.sendPosition("N0CALL", 0, "4911.67N", "01635.96E", "I'm here!", "093045z");
delay(500);
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
char message[] = "I'm here!";
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);
// 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
char timestamp[] = "093045z";
state = aprs.sendPosition(destination, 0, latitude, longitude, message, timestamp);
if(state != RADIOLIB_ERR_NONE) {
Serial.print(F("[APRS] Failed to send location, message and timestamp code "));
Serial.println(state);
}
delay(500);
// when repeaters are no longer needed, they can be dropped
aprs.dropRepeaters();
// wait one minute before transmitting again
Serial.println(F("[APRS] All done!"));
delay(60000);
}

View file

@ -1,20 +1,20 @@
/*
RadioLib APRS Position over LoRa Example
RadioLib APRS Position over LoRa Example
This example sends APRS position reports
using SX1278's LoRa modem.
This example sends APRS position reports
using SX1278's LoRa modem.
Other modules that can be used for APRS:
- SX127x/RFM9x
- SX126x/LLCC68
- SX128x
- LR11x0
Other modules that can be used for APRS:
- SX127x/RFM9x
- SX126x/LLCC68
- SX128x
- LR11x0
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -27,9 +27,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create APRS client instance using the LoRa radio
APRSClient aprs(&radio);
@ -54,7 +58,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize APRS client
@ -62,13 +66,14 @@ void setup() {
// symbol: '>' (car)
// callsign "N7LEM"
// SSID 1
state = aprs.begin('>', "N7LEM", 1);
char source[] = "N7LEM";
state = aprs.begin('>', source, 1);
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}
@ -77,7 +82,12 @@ void loop() {
// send a location with message and timestamp
// SSID is set to 1, as APRS over LoRa uses WIDE1-1 path by default
int state = aprs.sendPosition("GPS", 1, "4911.67N", "01635.96E", "I'm here!", "093045z");
char destination[] = "GPS";
char latitude[] = "4911.67N";
char longitude[] = "01635.96E";
char message[] = "I'm here!";
char timestamp[] = "093045z";
int state = aprs.sendPosition(destination, 1, latitude, longitude, message, timestamp);
delay(500);
// you can also send Mic-E encoded messages

View file

@ -1,31 +1,31 @@
/*
RadioLib AX.25 Frame Example
RadioLib AX.25 Frame Example
This example shows how to send various
AX.25 frames using SX1278's FSK modem.
This example shows how to send various
AX.25 frames using SX1278's FSK modem.
Other modules that can be used for AX.25:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- SX126x
- nRF24
- Si443x/RFM2x
- LR11x0
Other modules that can be used for AX.25:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- SX126x
- nRF24
- Si443x/RFM2x
- LR11x0
Using raw AX.25 frames requires some
knowledge of the protocol, refer to
AX25_Transmit for basic operation.
Frames shown in this example are not
exhaustive; all possible AX.25 frames
should be supported.
Using raw AX.25 frames requires some
knowledge of the protocol, refer to
AX25_Transmit for basic operation.
Frames shown in this example are not
exhaustive; all possible AX.25 frames
should be supported.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -38,9 +38,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AX.25 client instance using the FSK module
AX25Client ax25(&radio);
@ -64,7 +68,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize AX.25 client
@ -78,7 +82,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}

View file

@ -1,24 +1,24 @@
/*
RadioLib AX.25 Transmit Example
RadioLib AX.25 Transmit Example
This example sends AX.25 messages using
SX1278's FSK modem.
This example sends AX.25 messages using
SX1278's FSK modem.
Other modules that can be used for AX.25:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- SX126x
- nRF24
- Si443x/RFM2x
- LR11x0
Other modules that can be used for AX.25:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- SX126x
- nRF24
- Si443x/RFM2x
- LR11x0
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -31,9 +31,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AX.25 client instance using the FSK module
AX25Client ax25(&radio);
@ -56,7 +60,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize AX.25 client
@ -70,7 +74,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}

View file

@ -1,25 +1,25 @@
/*
RadioLib AX.25 Transmit AFSK Example
RadioLib AX.25 Transmit AFSK Example
This example sends AX.25 messages using
SX1278's FSK modem. The data is modulated
as AFSK at 1200 baud using Bell 202 tones.
This example sends AX.25 messages using
SX1278's FSK modem. The data is modulated
as AFSK at 1200 baud using Bell 202 tones.
Other modules that can be used for AX.25
with AFSK modulation:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- nRF24
- Si443x/RFM2x
- SX126x/LLCC68 (only devices without TCXO!)
Other modules that can be used for AX.25
with AFSK modulation:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- nRF24
- Si443x/RFM2x
- SX126x/LLCC68
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -32,9 +32,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module
// this requires connection to the module direct
@ -66,7 +70,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize AX.25 client
@ -80,7 +84,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// Sometimes, it may be required to adjust audio
@ -95,7 +99,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
*/
}

View file

@ -1,18 +1,18 @@
/*
RadioLib Bell Modem Transmit Example
RadioLib Bell Modem Transmit Example
This example shows how to transmit binary data
using audio Bell 202 tones.
This example shows how to transmit binary data
using audio Bell 202 tones.
Other implemented Bell modems
- Bell 101
- Bell 103
Other implemented Bell modems
- Bell 101
- Bell 103
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -33,7 +33,7 @@ SX1278 radio = new Module(10, 2, 9, 3);
// SX1231: DIO2
// CC1101: GDO2
// Si443x/RFM2x: GPIO
// SX126x/LLCC68: DIO2 (only devices without TCXO!)
// SX126x/LLCC68: DIO2
BellClient bell(&radio, 5);
void setup() {
@ -52,7 +52,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize Bell 202 modem
@ -63,7 +63,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}

View file

@ -1,17 +1,17 @@
/*
RadioLib CC1101 Receive with Address Example
RadioLib CC1101 Receive with Address Example
This example receives packets using CC1101 FSK radio
module. Packets can have 1-byte address of the
destination node. After setting node address, this node
will automatically filter out any packets that do not
contain either node address or broadcast addresses.
This example receives packets using CC1101 FSK radio
module. Packets can have 1-byte address of the
destination node. After setting node address, this node
will automatically filter out any packets that do not
contain either node address or broadcast addresses.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -24,9 +24,13 @@
// GDO2 pin: 3 (optional)
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//CC1101 radio = RadioShield.ModuleA;
// 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);
@ -39,7 +43,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set node address
@ -56,7 +60,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// address filtering can also be disabled
@ -70,7 +74,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
*/
}

View file

@ -31,9 +31,13 @@
// GDO2 pin: 3 (optional)
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//CC1101 radio = RadioShield.ModuleA;
// 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);
@ -46,7 +50,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
}

View file

@ -1,22 +1,22 @@
/*
RadioLib CC1101 Receive with Interrupts Example
RadioLib CC1101 Receive with Interrupts Example
This example listens for FSK transmissions and tries to
receive them. Once a packet is received, an interrupt is
triggered.
This example listens for FSK transmissions and tries to
receive them. Once a packet is received, an interrupt is
triggered.
To successfully receive data, the following settings have to be the same
on both transmitter and receiver:
- carrier frequency
- bit rate
- frequency deviation
- sync word
To successfully receive data, the following settings have to be the same
on both transmitter and receiver:
- carrier frequency
- bit rate
- frequency deviation
- sync word
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -29,48 +29,13 @@
// GDO2 pin: 3 (optional)
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//CC1101 radio = RadioShield.ModuleA;
void setup() {
Serial.begin(9600);
// initialize CC1101 with default settings
Serial.print(F("[CC1101] Initializing ... "));
int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
}
// set the function that will be called
// when new packet is received
radio.setPacketReceivedAction(setFlag);
// start listening for packets
Serial.print(F("[CC1101] Starting to listen ... "));
state = radio.startReceive();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
}
// if needed, 'listen' mode can be disabled by calling
// any of the following methods:
//
// radio.standby()
// radio.sleep()
// radio.transmit();
// radio.receive();
// radio.readData();
}
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// flag to indicate that a packet was received
volatile bool receivedFlag = false;
@ -87,6 +52,45 @@ void setFlag(void) {
receivedFlag = true;
}
void setup() {
Serial.begin(9600);
// initialize CC1101 with default settings
Serial.print(F("[CC1101] Initializing ... "));
int state = radio.begin();
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 new packet is received
radio.setPacketReceivedAction(setFlag);
// start listening for packets
Serial.print(F("[CC1101] Starting to listen ... "));
state = radio.startReceive();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// if needed, 'listen' mode can be disabled by calling
// any of the following methods:
//
// radio.standby()
// radio.sleep()
// radio.transmit();
// radio.receive();
// radio.readData();
}
void loop() {
// check if the flag is set
if(receivedFlag) {

View file

@ -1,21 +1,21 @@
/*
RadioLib CC1101 Settings Example
RadioLib CC1101 Settings Example
This example shows how to change all the properties of RF69 radio.
RadioLib currently supports the following settings:
- pins (SPI slave select, digital IO 0, digital IO 1)
- carrier frequency
- bit rate
- receiver bandwidth
- allowed frequency deviation
- output power during transmission
- sync word
This example shows how to change all the properties of RF69 radio.
RadioLib currently supports the following settings:
- pins (SPI slave select, digital IO 0, digital IO 1)
- carrier frequency
- bit rate
- receiver bandwidth
- allowed frequency deviation
- output power during transmission
- sync word
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -35,9 +35,13 @@ CC1101 radio1 = new Module(10, 2, RADIOLIB_NC, 3);
// GDO2 pin: 5 (optional)
CC1101 radio2 = new Module(9, 4, RADIOLIB_NC, 5);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//CC1101 radio3 = RadioShield.ModuleB;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio3 = new RadioModule();
*/
void setup() {
Serial.begin(9600);
@ -50,7 +54,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// initialize CC1101 with non-default settings
@ -67,7 +71,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// you can also change the settings at runtime
@ -76,42 +80,42 @@ void setup() {
// set carrier frequency to 433.5 MHz
if (radio1.setFrequency(433.5) == RADIOLIB_ERR_INVALID_FREQUENCY) {
Serial.println(F("[CC1101] Selected frequency is invalid for this module!"));
while (true);
while (true) { delay(10); }
}
// set bit rate to 100.0 kbps
state = radio1.setBitRate(100.0);
if (state == RADIOLIB_ERR_INVALID_BIT_RATE) {
Serial.println(F("[CC1101] Selected bit rate is invalid for this module!"));
while (true);
while (true) { delay(10); }
} else if (state == RADIOLIB_ERR_INVALID_BIT_RATE_BW_RATIO) {
Serial.println(F("[CC1101] Selected bit rate to bandwidth ratio is invalid!"));
Serial.println(F("[CC1101] Increase receiver bandwidth to set this bit rate."));
while (true);
while (true) { delay(10); }
}
// set receiver bandwidth to 250.0 kHz
if (radio1.setRxBandwidth(250.0) == RADIOLIB_ERR_INVALID_RX_BANDWIDTH) {
Serial.println(F("[CC1101] Selected receiver bandwidth is invalid for this module!"));
while (true);
while (true) { delay(10); }
}
// set allowed frequency deviation to 10.0 kHz
if (radio1.setFrequencyDeviation(10.0) == RADIOLIB_ERR_INVALID_FREQUENCY_DEVIATION) {
Serial.println(F("[CC1101] Selected frequency deviation is invalid for this module!"));
while (true);
while (true) { delay(10); }
}
// set output power to 5 dBm
if (radio1.setOutputPower(5) == RADIOLIB_ERR_INVALID_OUTPUT_POWER) {
Serial.println(F("[CC1101] Selected output power is invalid for this module!"));
while (true);
while (true) { delay(10); }
}
// 2 bytes can be set as sync word
if (radio1.setSyncWord(0x01, 0x23) == RADIOLIB_ERR_INVALID_SYNC_WORD) {
Serial.println(F("[CC1101] Selected sync word is invalid for this module!"));
while (true);
while (true) { delay(10); }
}
}

View file

@ -1,17 +1,17 @@
/*
RadioLib CC1101 Transmit to Address Example
RadioLib CC1101 Transmit to Address Example
This example transmits packets using CC1101 FSK radio
module. Packets can have 1-byte address of the
destination node. After setting node address, this node
will automatically filter out any packets that do not
contain either node address or broadcast addresses.
This example transmits packets using CC1101 FSK radio
module. Packets can have 1-byte address of the
destination node. After setting node address, this node
will automatically filter out any packets that do not
contain either node address or broadcast addresses.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -24,9 +24,13 @@
// GDO2 pin: 3 (optional)
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//CC1101 radio = RadioShield.ModuleA;
// 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);
@ -39,7 +43,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set node address
@ -56,7 +60,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// address filtering can also be disabled
@ -70,7 +74,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
*/
}
@ -78,10 +82,11 @@ void setup() {
void loop() {
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!");
// 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};
int state = radio.transmit(byteArr, 8);

View file

@ -2,7 +2,7 @@
RadioLib CC1101 Blocking Transmit Example
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
- null-terminated char array (C-string)
- arbitrary binary data (byte array)
@ -28,9 +28,13 @@
// GDO2 pin: 3
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//CC1101 radio = RadioShield.ModuleA;
// 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);
@ -43,7 +47,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
}
@ -53,11 +57,11 @@ int count = 0;
void loop() {
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++);
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};
int state = radio.transmit(byteArr, 8);
@ -68,7 +72,7 @@ void loop() {
Serial.println(F("success!"));
} 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!"));
} else {

View file

@ -1,18 +1,18 @@
/*
RadioLib CC1101 Transmit with Interrupts Example
RadioLib CC1101 Transmit with Interrupts Example
This example transmits packets using CC1101 FSK radio module.
Once a packet is transmitted, an interrupt is triggered.
Each packet contains up to 64 bytes of data, in the form of:
- Arduino String
- null-terminated char array (C-string)
- arbitrary binary data (byte array)
This example transmits packets using CC1101 FSK radio module.
Once a packet is transmitted, an interrupt is triggered.
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
- null-terminated char array (C-string)
- arbitrary binary data (byte array)
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -25,46 +25,17 @@
// GDO2 pin: 3
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//CC1101 radio = RadioShield.ModuleA;
// 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;
void setup() {
Serial.begin(9600);
// initialize CC1101 with default settings
Serial.print(F("[CC1101] Initializing ... "));
int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
}
// set the function that will be called
// when packet transmission is finished
radio.setPacketSentAction(setFlag);
// start transmitting the first packet
Serial.print(F("[CC1101] Sending first packet ... "));
// you can transmit C-string or Arduino string up to
// 64 characters long
transmissionState = radio.startTransmit("Hello World!");
// you can also transmit byte array up to 64 bytes long
/*
byte byteArr[] = {0x01, 0x23, 0x45, 0x56,
0x78, 0xAB, 0xCD, 0xEF};
state = radio.startTransmit(byteArr, 8);
*/
}
// flag to indicate that a packet was sent
volatile bool transmittedFlag = false;
@ -80,6 +51,41 @@ void setFlag(void) {
transmittedFlag = true;
}
void setup() {
Serial.begin(9600);
// initialize CC1101 with default settings
Serial.print(F("[CC1101] Initializing ... "));
int state = radio.begin();
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("[CC1101] Sending first packet ... "));
// you can transmit C-string or Arduino string up to
// 255 characters long
transmissionState = radio.startTransmit("Hello World!");
// 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,
0x78, 0xAB, 0xCD, 0xEF};
state = radio.startTransmit(byteArr, 8);
*/
}
// counter to keep track of transmitted packets
int count = 0;
@ -115,11 +121,11 @@ void loop() {
Serial.print(F("[CC1101] Sending another packet ... "));
// you can transmit C-string or Arduino string up to
// 256 characters long
// 255 characters long
String str = "Hello World! #" + String(count++);
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,
0x89, 0xAB, 0xCD, 0xEF};

View file

@ -1,27 +1,27 @@
/*
RadioLib FSK4 Transmit Example
RadioLib FSK4 Transmit Example
This example sends an example FSK-4 'Horus Binary' message
using SX1278's FSK modem.
This example sends an example FSK-4 'Horus Binary' message
using SX1278's FSK modem.
This signal can be demodulated using a SSB demodulator (SDR or otherwise),
and horusdemodlib: https://github.com/projecthorus/horusdemodlib/wiki
This signal can be demodulated using a SSB demodulator (SDR or otherwise),
and horusdemodlib: https://github.com/projecthorus/horusdemodlib/wiki
Other modules that can be used for FSK4:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- SX126x
- nRF24
- Si443x/RFM2x
- SX128x
Other modules that can be used for FSK4:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- SX126x
- nRF24
- Si443x/RFM2x
- SX128x
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -34,9 +34,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create FSK4 client instance using the FSK module
FSK4Client fsk4(&radio);
@ -73,7 +77,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize FSK4 client
@ -97,7 +101,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// sometimes, it may be needed to set some manual corrections
@ -113,7 +117,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
*/
}

View file

@ -1,25 +1,25 @@
/*
RadioLib FSK4 Transmit AFSK Example
RadioLib FSK4 Transmit AFSK Example
This example sends an example FSK-4 'Horus Binary' message
using SX1278's FSK modem. The data is modulated as AFSK.
This example sends an example FSK-4 'Horus Binary' message
using SX1278's FSK modem. The data is modulated as AFSK.
This signal can be demodulated using an FM demodulator (SDR or otherwise),
and horusdemodlib: https://github.com/projecthorus/horusdemodlib/wiki
This signal can be demodulated using an FM demodulator (SDR or otherwise),
and horusdemodlib: https://github.com/projecthorus/horusdemodlib/wiki
Other modules that can be used for FSK4:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
- SX126x/LLCC68 (only devices without TCXO!)
Other modules that can be used for FSK4:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
- SX126x/LLCC68
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -32,9 +32,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module
// this requires connection to the module direct
@ -82,7 +86,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize FSK4 client
@ -98,7 +102,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// sometimes, it may be needed to set some manual corrections
@ -114,7 +118,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
*/
}

View file

@ -1,25 +1,25 @@
/*
RadioLib Hellschreiber Transmit Example
RadioLib Hellschreiber Transmit Example
This example sends Hellschreiber message using
SX1278's FSK modem.
This example sends Hellschreiber message using
SX1278's FSK modem.
Other modules that can be used for Hellschreiber:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- SX126x
- nRF24
- Si443x/RFM2x
- SX128x
- LR11x0
Other modules that can be used for Hellschreiber:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- SX126x
- nRF24
- Si443x/RFM2x
- SX128x
- LR11x0
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -32,9 +32,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create Hellschreiber client instance using the FSK module
HellClient hell(&radio);
@ -55,7 +59,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize Hellschreiber client
@ -68,7 +72,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}

View file

@ -1,24 +1,24 @@
/*
RadioLib Hellschreiber Transmit AFSK Example
RadioLib Hellschreiber Transmit AFSK Example
This example sends Hellschreiber message using
SX1278's FSK modem. The data is modulated
as AFSK.
This example sends Hellschreiber message using
SX1278's FSK modem. The data is modulated
as AFSK.
Other modules that can be used for Hellschreiber
with AFSK modulation:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
- SX126x/LLCC68 (only devices without TCXO!)
Other modules that can be used for Hellschreiber
with AFSK modulation:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
- SX126x/LLCC68
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -31,9 +31,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module
// this requires connection to the module direct
@ -65,7 +69,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize Hellschreiber client
@ -78,7 +82,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}

View file

@ -34,6 +34,14 @@
// 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!
@ -57,10 +65,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
void setup() {
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
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
@ -69,8 +73,11 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
}
void loop() {

View file

@ -29,6 +29,14 @@
// 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!
@ -49,13 +57,24 @@ static const Module::RfSwitchMode_t rfswitch_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() {
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
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
@ -64,9 +83,12 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// set the function that will be called
// when LoRa packet or timeout is detected
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() {
// check if the flag is set
if(scanFlag) {

View file

@ -48,9 +48,13 @@
// BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//LR1110 radio = RadioShield.ModuleA;
// 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);
@ -63,7 +67,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// print the firmware versions before the update
@ -85,7 +89,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// print the firmware versions after the update
@ -121,7 +125,7 @@ void printVersions() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}

View file

@ -26,9 +26,13 @@
// BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//LR1110 radio = RadioShield.ModuleA;
// 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);
@ -41,7 +45,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// if needed, you can switch between any of the modems
@ -63,7 +67,7 @@ void setup() {
if (state != RADIOLIB_ERR_NONE) {
Serial.print(F("Unable to set configuration, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// GFSK modem on LR11x0 can handle the sync word setting in bits, not just

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -2,6 +2,7 @@
RadioLib LR11x0 LR-FHSS Modem Example
This example shows how to use LR-FHSS modem in LR11x0 chips.
This modem can only transmit data, and is not able to receive.
NOTE: The sketch below is just a guide on how to use
LR-FHSS modem, so this code should not be run directly!
@ -26,9 +27,13 @@
// BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//LR1110 radio = RadioShield.ModuleA;
// 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);
@ -41,7 +46,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// if needed, you can switch between any of the modems
@ -57,20 +62,19 @@ void setup() {
3, // header count
0x13A); // hopping sequence seed
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) {
Serial.print(F("Unable to set configuration, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
#warning "This sketch is just an API guide! Read the note at line 6."
}
void loop() {
// LR-FHSS modem can use the same transmit/receive methods
// as the LoRa modem, even their interrupt-driven versions
// LR-FHSS modem can only transmit!
// transmit LR-FHSS packet
int state = radio.transmit("Hello World!");
/*
@ -89,22 +93,4 @@ void loop() {
Serial.println(state);
}
// receive LR-FHSS packet
String str;
state = radio.receive(str);
/*
byte byteArr[8];
int state = radio.receive(byteArr, 8);
*/
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("[LR1110] Received packet!"));
Serial.print(F("[LR1110] Data:\t"));
Serial.println(str);
} else if (state == RADIOLIB_ERR_RX_TIMEOUT) {
Serial.println(F("[LR1110] Timed out while waiting for packet!"));
} else {
Serial.print(F("[LR1110] Failed to receive packet, code "));
Serial.println(state);
}
}

View file

@ -0,0 +1,173 @@
/*
RadioLib LR11x0 Ping-Pong Example
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// uncomment the following only on one
// of the nodes to initiate the pings
//#define INITIATING_NODE
// LR1110 has the following connections:
// NSS pin: 10
// IRQ 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,
};
// save transmission states between loops
int transmissionState = RADIOLIB_ERR_NONE;
// flag to indicate transmission or reception state
bool transmitFlag = false;
// flag to indicate that a packet was sent or received
volatile bool operationDone = false;
// this function is called when a complete packet
// is transmitted or 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 sent or received a packet, set the flag
operationDone = true;
}
void setup() {
Serial.begin(9600);
// initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
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);
// set the function that will be called
// when new packet is received
radio.setIrqAction(setFlag);
#if defined(INITIATING_NODE)
// send the first packet on this node
Serial.print(F("[LR1110] Sending first packet ... "));
transmissionState = radio.startTransmit("Hello World!");
transmitFlag = true;
#else
// start listening for LoRa packets on this node
Serial.print(F("[LR1110] Starting to listen ... "));
state = radio.startReceive();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
#endif
}
void loop() {
// check if the previous operation finished
if(operationDone) {
// reset flag
operationDone = false;
if(transmitFlag) {
// the previous operation was transmission, listen for response
// print the result
if (transmissionState == RADIOLIB_ERR_NONE) {
// packet was successfully sent
Serial.println(F("transmission finished!"));
} else {
Serial.print(F("failed, code "));
Serial.println(transmissionState);
}
// listen for response
radio.startReceive();
transmitFlag = false;
} else {
// the previous operation was reception
// print data and send another packet
String str;
int state = radio.readData(str);
if (state == RADIOLIB_ERR_NONE) {
// packet was successfully received
Serial.println(F("[LR1110] Received packet!"));
// print data of the packet
Serial.print(F("[LR1110] Data:\t\t"));
Serial.println(str);
// print RSSI (Received Signal Strength Indicator)
Serial.print(F("[LR1110] RSSI:\t\t"));
Serial.print(radio.getRSSI());
Serial.println(F(" dBm"));
// print SNR (Signal-to-Noise Ratio)
Serial.print(F("[LR1110] SNR:\t\t"));
Serial.print(radio.getSNR());
Serial.println(F(" dB"));
}
// wait a second before transmitting again
delay(1000);
// send another one
Serial.print(F("[LR1110] Sending another packet ... "));
transmissionState = radio.startTransmit("Hello World!");
transmitFlag = true;
}
}
}

View file

@ -39,6 +39,14 @@
// 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!
@ -62,10 +70,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
void setup() {
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
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
@ -74,8 +78,11 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
}
void loop() {

View file

@ -35,6 +35,14 @@
// 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!
@ -55,49 +63,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
END_OF_MODE_TABLE,
};
void setup() {
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
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
}
// set the function that will be called
// when new packet is received
radio.setPacketReceivedAction(setFlag);
// start listening for LoRa packets
Serial.print(F("[LR1110] Starting to listen ... "));
state = radio.startReceive();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
}
// if needed, 'listen' mode can be disabled by calling
// any of the following methods:
//
// radio.standby()
// radio.sleep()
// radio.transmit();
// radio.receive();
// radio.scanChannel();
}
// flag to indicate that a packet was received
volatile bool receivedFlag = false;
@ -113,6 +78,48 @@ void setFlag(void) {
receivedFlag = true;
}
void setup() {
Serial.begin(9600);
// initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
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);
// set the function that will be called
// when new packet is received
radio.setPacketReceivedAction(setFlag);
// start listening for LoRa packets
Serial.print(F("[LR1110] Starting to listen ... "));
state = radio.startReceive();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// if needed, 'listen' mode can be disabled by calling
// any of the following methods:
//
// radio.standby()
// radio.sleep()
// radio.transmit();
// radio.receive();
// radio.scanChannel();
}
void loop() {
// check if the flag is set
if(receivedFlag) {

View file

@ -30,6 +30,14 @@
// 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!
@ -53,10 +61,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
void setup() {
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
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
@ -66,8 +70,11 @@ void setup() {
Serial.print(F("failed, code "));
Serial.println(state);
delay(1000);
while (true);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
}
// counter to keep track of transmitted packets

View file

@ -31,6 +31,14 @@
// 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!
@ -54,13 +62,24 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
// save transmission state between loops
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() {
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
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
@ -69,9 +88,12 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// set the function that will be called
// when packet transmission is finished
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
int count = 0;

View file

@ -32,6 +32,14 @@
// 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!
@ -55,10 +63,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
void setup() {
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
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
@ -67,8 +71,11 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
}
void loop() {

View file

@ -32,6 +32,14 @@
// 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!
@ -52,13 +60,23 @@ static const Module::RfSwitchMode_t rfswitch_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() {
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
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
@ -67,9 +85,12 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// set the function that will be called
// when WiFi scan is complete
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() {
// check if the flag is set
if(scanFlag) {

View file

@ -10,12 +10,12 @@
After your device is registered, you can run this example.
The device will join the network and start uploading data.
LoRaWAN v1.1 requires the use of persistent storage.
LoRaWAN v1.0.4/v1.1 requires the use of persistent storage.
As this example does not use persistent storage, running this
examples REQUIRES you to check "Resets frame counters"
on your LoRaWAN dashboard. Refer to the notes or the
network's documentation on how to do this.
To comply with LoRaWAN v1.1's persistent storage, refer to
To comply with LoRaWAN's persistent storage, refer to
https://github.com/radiolib-org/radiolib-persistence
For default module settings, see the wiki page
@ -66,8 +66,20 @@ void loop() {
// Perform an uplink
int state = node.sendReceive(uplinkPayload, sizeof(uplinkPayload));
debug((state != RADIOLIB_LORAWAN_NO_DOWNLINK) && (state != RADIOLIB_ERR_NONE), F("Error in sendReceive"), state, false);
debug(state < RADIOLIB_ERR_NONE, F("Error in sendReceive"), state, false);
// Check if a downlink was received
// (state 0 = no downlink, state 1/2 = downlink in window Rx1/Rx2)
if(state > 0) {
Serial.println(F("Received a downlink"));
} else {
Serial.println(F("No downlink received"));
}
Serial.print(F("Next uplink in "));
Serial.print(uplinkIntervalSeconds);
Serial.println(F(" seconds\n"));
// Wait until next uplink - observing legal & TTN FUP constraints
delay(uplinkIntervalSeconds * 1000UL);
delay(uplinkIntervalSeconds * 1000UL); // delay needs milli-seconds
}

View file

@ -1,8 +1,21 @@
#ifndef _CONFIG_H
#define _CONFIG_H
#ifndef _RADIOLIB_EX_LORAWAN_CONFIG_H
#define _RADIOLIB_EX_LORAWAN_CONFIG_H
#include <RadioLib.h>
// first you have to set your radio model and pin configuration
// this is provided just as a default example
SX1278 radio = new Module(10, 2, 9, 3);
// if you have RadioBoards (https://github.com/radiolib-org/RadioBoards)
// and are using one of the supported boards, you can do the following:
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// how often to send an uplink - consider legal & FUP constraints - see notes
const uint32_t uplinkIntervalSeconds = 5UL * 60UL; // minutes x seconds
@ -28,102 +41,15 @@ const uint32_t uplinkIntervalSeconds = 5UL * 60UL; // minutes x seconds
// 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
// 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 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 ...
// Auto select MCU <-> radio connections
// If you get an error message when compiling, it may be that the
// pinmap could not be determined - see the notes for more info
// Adafruit
#if defined(ARDUINO_SAMD_FEATHER_M0)
#pragma message ("Adafruit Feather M0 with RFM95")
#pragma message ("Link required on board")
SX1276 radio = new Module(8, 3, 4, 6);
// LilyGo
#elif defined(ARDUINO_TTGO_LORA32_V1)
#pragma message ("Using TTGO LoRa32 v1 - no Display")
SX1276 radio = new Module(18, 26, 14, 33);
#elif defined(ARDUINO_TTGO_LORA32_V2)
#pragma message ("Using TTGO LoRa32 v2 + Display")
SX1276 radio = new Module(18, 26, 12, RADIOLIB_NC);
#elif defined(ARDUINO_TTGO_LoRa32_v21new) // T3_V1.6.1
#pragma message ("Using TTGO LoRa32 v2.1 marked T3_V1.6.1 + Display")
SX1276 radio = new Module(18, 26, 14, 33);
#elif defined(ARDUINO_TBEAM_USE_RADIO_SX1262)
#pragma error ("ARDUINO_TBEAM_USE_RADIO_SX1262 awaiting pin map")
#elif defined(ARDUINO_TBEAM_USE_RADIO_SX1276)
#pragma message ("Using TTGO T-Beam")
SX1276 radio = new Module(18, 26, 23, 33);
// HelTec: https://github.com/espressif/arduino-esp32/blob/master/variants/heltec_*/pins_arduino.h
#elif defined(ARDUINO_HELTEC_WIFI_LORA_32)
#pragma message ("Using Heltec WiFi LoRa32")
SX1276 radio = new Module(18, 26, 14, 33);
#elif defined(ARDUINO_heltec_wifi_lora_32_V2)
#pragma message ("Using Heltec WiFi LoRa32 v2")
SX1278 radio = new Module(14, 4, 12, 16);
// Pending verfication of which radio is shipped
// #elif defined(ARDUINO_heltec_wifi_lora_32_V2)
// #pragma message ("ARDUINO_heltec_wifi_kit_32_V2 awaiting pin map")
// SX1276 radio = new Module(18, 26, 14, 35);
#elif defined(ARDUINO_heltec_wifi_lora_32_V3)
#pragma message ("Using Heltec WiFi LoRa32 v3 - Display + USB-C")
SX1262 radio = new Module(8, 14, 12, 13);
// Following not verified
#elif defined (ARDUINO_heltec_wireless_stick)
#pragma message ("Using Heltec Wireless Stick")
SX1278 radio = new Module(14, 4, 12, 16);
#elif defined (ARDUINO_HELTEC_WIRELESS_STICK)
#pragma message ("Using Heltec Wireless Stick")
SX1276 radio = new Module(18, 26, 14, 35);
#elif defined (ARDUINO_HELTEC_WIRELESS_STICK_V3)
#pragma message ("Using Heltec Wireless Stick v3")
SX1262 radio = new Module(8, 14, 12, 13);
#elif defined (ARDUINO_HELTEC_WIRELESS_STICK_LITE)
#pragma message ("Using Heltec Wireless Stick Lite")
SX1276 radio = new Module(18, 26, 14, 35);
#elif defined (ARDUINO_HELTEC_WIRELESS_STICK_LITE_V3)
#pragma message ("Using Heltec Wireless Stick Lite v3")
SX1262 radio = new Module(34, 14, 12, 13);
// If we don't recognise the board
#else
#pragma message ("Unknown board - no automagic pinmap available")
// SX1262 pin order: Module(NSS/CS, DIO1, RESET, BUSY);
// SX1262 radio = new Module(8, 14, 12, 13);
// SX1278 pin order: Module(NSS/CS, DIO0, RESET, DIO1);
// SX1278 radio = new Module(10, 2, 9, 3);
// For Pi Pico + Waveshare HAT - work in progress
// SX1262 radio = new Module(3, 20, 15, 2, SPI1, RADIOLIB_DEFAULT_SPI_SETTINGS);
#endif
// copy over the keys in to the something that will not compile if incorrectly formatted
uint32_t devAddr = RADIOLIB_LORAWAN_DEV_ADDR;
uint8_t fNwkSIntKey[] = { RADIOLIB_LORAWAN_FNWKSINT_KEY };
@ -134,8 +60,8 @@ uint8_t appSKey[] = { RADIOLIB_LORAWAN_APPS_KEY };
// create the LoRaWAN node
LoRaWANNode node(&radio, &Region, subBand);
// result code to text ...
// result code to text - these are error codes that can be raised when using LoRaWAN
// however, RadioLib has many more - see https://jgromes.github.io/RadioLib/group__status__codes.html for a complete list
String stateDecode(const int16_t result) {
switch (result) {
case RADIOLIB_ERR_NONE:
@ -160,7 +86,6 @@ String stateDecode(const int16_t result) {
return "ERR_INVALID_OUTPUT_POWER";
case RADIOLIB_ERR_NETWORK_NOT_JOINED:
return "RADIOLIB_ERR_NETWORK_NOT_JOINED";
case RADIOLIB_ERR_DOWNLINK_MALFORMED:
return "RADIOLIB_ERR_DOWNLINK_MALFORMED";
case RADIOLIB_ERR_INVALID_REVISION:
@ -187,34 +112,33 @@ String stateDecode(const int16_t result) {
return "RADIOLIB_ERR_DWELL_TIME_EXCEEDED";
case RADIOLIB_ERR_CHECKSUM_MISMATCH:
return "RADIOLIB_ERR_CHECKSUM_MISMATCH";
case RADIOLIB_LORAWAN_NO_DOWNLINK:
return "RADIOLIB_LORAWAN_NO_DOWNLINK";
case RADIOLIB_ERR_NO_JOIN_ACCEPT:
return "RADIOLIB_ERR_NO_JOIN_ACCEPT";
case RADIOLIB_LORAWAN_SESSION_RESTORED:
return "RADIOLIB_LORAWAN_SESSION_RESTORED";
case RADIOLIB_LORAWAN_NEW_SESSION:
return "RADIOLIB_LORAWAN_NEW_SESSION";
case RADIOLIB_LORAWAN_NONCES_DISCARDED:
return "RADIOLIB_LORAWAN_NONCES_DISCARDED";
case RADIOLIB_LORAWAN_SESSION_DISCARDED:
return "RADIOLIB_LORAWAN_SESSION_DISCARDED";
case RADIOLIB_ERR_NONCES_DISCARDED:
return "RADIOLIB_ERR_NONCES_DISCARDED";
case RADIOLIB_ERR_SESSION_DISCARDED:
return "RADIOLIB_ERR_SESSION_DISCARDED";
}
return "See TypeDef.h";
return "See https://jgromes.github.io/RadioLib/group__status__codes.html";
}
// helper function to display any issues
void debug(bool isFail, const __FlashStringHelper* message, int state, bool Freeze) {
if (isFail) {
void debug(bool failed, const __FlashStringHelper* message, int state, bool halt) {
if(failed) {
Serial.print(message);
Serial.print(" - ");
Serial.print(stateDecode(state));
Serial.print(" (");
Serial.print(state);
Serial.println(")");
while (Freeze);
while(halt) { delay(1); }
}
}
// helper function to display a byte array
void arrayDump(uint8_t *buffer, uint16_t len) {
for(uint16_t c = 0; c < len; c++) {

View file

@ -10,11 +10,11 @@
Also, most of the possible and available functions are
shown here for reference.
LoRaWAN v1.1 requires the use of EEPROM (persistent storage).
LoRaWAN v1.0.4/v1.1 requires the use of EEPROM (persistent storage).
Running this examples REQUIRES you to check "Resets DevNonces"
on your LoRaWAN dashboard. Refer to the notes or the
network's documentation on how to do this.
To comply with LoRaWAN v1.1's persistent storage, refer to
To comply with LoRaWAN's persistent storage, refer to
https://github.com/radiolib-org/radiolib-persistence
For default module settings, see the wiki page
@ -48,6 +48,9 @@ void setup() {
// Override the default join rate
uint8_t joinDR = 4;
// Optionally provide a custom sleep function - see config.h
//node.setSleepFunction(customDelay);
// Setup the OTAA session information
node.beginOTAA(joinEUI, devEUI, nwkKey, appKey);
@ -59,16 +62,16 @@ void setup() {
Serial.print("[LoRaWAN] DevAddr: ");
Serial.println((unsigned long)node.getDevAddr(), HEX);
// Disable the ADR algorithm (on by default which is preferable)
node.setADR(false);
// Enable the ADR algorithm (on by default which is preferable)
node.setADR(true);
// Set a fixed datarate
node.setDatarate(4);
// Set a datarate to start off with
node.setDatarate(5);
// Manages uplink intervals to the TTN Fair Use Policy
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);
Serial.println(F("Ready!\n"));
@ -105,25 +108,28 @@ void loop() {
LoRaWANEvent_t uplinkDetails;
LoRaWANEvent_t downlinkDetails;
uint8_t Port = 10;
uint8_t fPort = 10;
// Retrieve the last uplink frame counter
uint32_t fcntUp = node.getFCntUp();
uint32_t fCntUp = node.getFCntUp();
// Send a confirmed uplink every 64th frame
// Send a confirmed uplink on the second uplink
// and also request the LinkCheck and DeviceTime MAC commands
if(fcntUp % 64 == 0) {
Serial.println(F("[LoRaWAN] Requesting LinkCheck and DeviceTime"));
Serial.println(F("Sending uplink"));
if(fCntUp == 1) {
Serial.println(F("and requesting LinkCheck and DeviceTime"));
node.sendMacCommandReq(RADIOLIB_LORAWAN_MAC_LINK_CHECK);
node.sendMacCommandReq(RADIOLIB_LORAWAN_MAC_DEVICE_TIME);
state = node.sendReceive(uplinkPayload, sizeof(uplinkPayload), Port, downlinkPayload, &downlinkSize, true, &uplinkDetails, &downlinkDetails);
state = node.sendReceive(uplinkPayload, sizeof(uplinkPayload), fPort, downlinkPayload, &downlinkSize, true, &uplinkDetails, &downlinkDetails);
} else {
state = node.sendReceive(uplinkPayload, sizeof(uplinkPayload), Port, downlinkPayload, &downlinkSize);
state = node.sendReceive(uplinkPayload, sizeof(uplinkPayload), fPort, downlinkPayload, &downlinkSize, false, &uplinkDetails, &downlinkDetails);
}
debug((state != RADIOLIB_LORAWAN_NO_DOWNLINK) && (state != RADIOLIB_ERR_NONE), F("Error in sendReceive"), state, false);
debug(state < RADIOLIB_ERR_NONE, F("Error in sendReceive"), state, false);
// Check if downlink was received
if(state != RADIOLIB_LORAWAN_NO_DOWNLINK) {
// Check if a downlink was received
// (state 0 = no downlink, state 1/2 = downlink in window Rx1/Rx2)
if(state > 0) {
Serial.println(F("Received a downlink"));
// Did we get a downlink with data for us
if(downlinkSize > 0) {
Serial.println(F("Downlink data: "));
@ -142,11 +148,6 @@ void loop() {
Serial.print(radio.getSNR());
Serial.println(F(" dB"));
// print frequency error
Serial.print(F("[LoRaWAN] Frequency error:\t"));
Serial.print(radio.getFrequencyError());
Serial.println(F(" Hz"));
// print extra information about the event
Serial.println(F("[LoRaWAN] Event information:"));
Serial.print(F("[LoRaWAN] Confirmed:\t"));
@ -158,13 +159,15 @@ void loop() {
Serial.print(F("[LoRaWAN] Frequency:\t"));
Serial.print(downlinkDetails.freq, 3);
Serial.println(F(" MHz"));
Serial.print(F("[LoRaWAN] Output power:\t"));
Serial.print(downlinkDetails.power);
Serial.println(F(" dBm"));
Serial.print(F("[LoRaWAN] Frame count:\t"));
Serial.println(downlinkDetails.fCnt);
Serial.print(F("[LoRaWAN] Port:\t\t"));
Serial.println(downlinkDetails.fPort);
Serial.print(F("[LoRaWAN] Time-on-air: \t"));
Serial.print(node.getLastToA());
Serial.println(F(" ms"));
Serial.print(F("[LoRaWAN] Rx window: \t"));
Serial.println(state);
uint8_t margin = 0;
uint8_t gwCnt = 0;
@ -184,6 +187,8 @@ void loop() {
Serial.println(fracSecond);
}
} else {
Serial.println(F("[LoRaWAN] No downlink received"));
}
// wait before sending another packet
@ -193,7 +198,7 @@ void loop() {
Serial.print(F("[LoRaWAN] Next uplink in "));
Serial.print(delayMs/1000);
Serial.println(F("s"));
Serial.println(F(" seconds\n"));
delay(delayMs);
}

View file

@ -1,8 +1,21 @@
#ifndef _CONFIG_H
#define _CONFIG_H
#ifndef _RADIOLIB_EX_LORAWAN_CONFIG_H
#define _RADIOLIB_EX_LORAWAN_CONFIG_H
#include <RadioLib.h>
// first you have to set your radio model and pin configuration
// this is provided just as a default example
SX1278 radio = new Module(10, 2, 9, 3);
// if you have RadioBoards (https://github.com/radiolib-org/RadioBoards)
// and are using one of the supported boards, you can do the following:
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// how often to send an uplink - consider legal & FUP constraints - see notes
const uint32_t uplinkIntervalSeconds = 5UL * 60UL; // minutes x seconds
@ -24,101 +37,15 @@ const uint32_t uplinkIntervalSeconds = 5UL * 60UL; // minutes x seconds
// 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
// 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 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 ...
// Auto select MCU <-> radio connections
// If you get an error message when compiling, it may be that the
// pinmap could not be determined - see the notes for more info
// Adafruit
#if defined(ARDUINO_SAMD_FEATHER_M0)
#pragma message ("Adafruit Feather M0 with RFM95")
#pragma message ("Link required on board")
SX1276 radio = new Module(8, 3, 4, 6);
// LilyGo
#elif defined(ARDUINO_TTGO_LORA32_V1)
#pragma message ("Using TTGO LoRa32 v1 - no Display")
SX1276 radio = new Module(18, 26, 14, 33);
#elif defined(ARDUINO_TTGO_LORA32_V2)
#pragma message ("Using TTGO LoRa32 v2 + Display")
SX1276 radio = new Module(18, 26, 12, RADIOLIB_NC);
#elif defined(ARDUINO_TTGO_LoRa32_v21new) // T3_V1.6.1
#pragma message ("Using TTGO LoRa32 v2.1 marked T3_V1.6.1 + Display")
SX1276 radio = new Module(18, 26, 14, 33);
#elif defined(ARDUINO_TBEAM_USE_RADIO_SX1262)
#pragma error ("ARDUINO_TBEAM_USE_RADIO_SX1262 awaiting pin map")
#elif defined(ARDUINO_TBEAM_USE_RADIO_SX1276)
#pragma message ("Using TTGO T-Beam")
SX1276 radio = new Module(18, 26, 23, 33);
// HelTec: https://github.com/espressif/arduino-esp32/blob/master/variants/heltec_*/pins_arduino.h
#elif defined(ARDUINO_HELTEC_WIFI_LORA_32)
#pragma message ("Using Heltec WiFi LoRa32")
SX1276 radio = new Module(18, 26, 14, 33);
#elif defined(ARDUINO_heltec_wifi_lora_32_V2)
#pragma message ("Using Heltec WiFi LoRa32 v2")
SX1278 radio = new Module(14, 4, 12, 16);
// Pending verfication of which radio is shipped
// #elif defined(ARDUINO_heltec_wifi_lora_32_V2)
// #pragma message ("ARDUINO_heltec_wifi_kit_32_V2 awaiting pin map")
// SX1276 radio = new Module(18, 26, 14, 35);
#elif defined(ARDUINO_heltec_wifi_lora_32_V3)
#pragma message ("Using Heltec WiFi LoRa32 v3 - Display + USB-C")
SX1262 radio = new Module(8, 14, 12, 13);
// Following not verified
#elif defined (ARDUINO_heltec_wireless_stick)
#pragma message ("Using Heltec Wireless Stick")
SX1278 radio = new Module(14, 4, 12, 16);
#elif defined (ARDUINO_HELTEC_WIRELESS_STICK)
#pragma message ("Using Heltec Wireless Stick")
SX1276 radio = new Module(18, 26, 14, 35);
#elif defined (ARDUINO_HELTEC_WIRELESS_STICK_V3)
#pragma message ("Using Heltec Wireless Stick v3")
SX1262 radio = new Module(8, 14, 12, 13);
#elif defined (ARDUINO_HELTEC_WIRELESS_STICK_LITE)
#pragma message ("Using Heltec Wireless Stick Lite")
SX1276 radio = new Module(18, 26, 14, 35);
#elif defined (ARDUINO_HELTEC_WIRELESS_STICK_LITE_V3)
#pragma message ("Using Heltec Wireless Stick Lite v3")
SX1262 radio = new Module(34, 14, 12, 13);
// If we don't recognise the board
#else
#pragma message ("Unknown board - no automagic pinmap available")
// SX1262 pin order: Module(NSS/CS, DIO1, RESET, BUSY);
// SX1262 radio = new Module(8, 14, 12, 13);
// SX1278 pin order: Module(NSS/CS, DIO0, RESET, DIO1);
// SX1278 radio = new Module(10, 2, 9, 3);
// For Pi Pico + Waveshare HAT - work in progress
// SX1262 radio = new Module(3, 20, 15, 2, SPI1, RADIOLIB_DEFAULT_SPI_SETTINGS);
#endif
// copy over the EUI's & keys in to the something that will not compile if incorrectly formatted
uint64_t joinEUI = RADIOLIB_LORAWAN_JOIN_EUI;
uint64_t devEUI = RADIOLIB_LORAWAN_DEV_EUI;
@ -128,8 +55,8 @@ uint8_t nwkKey[] = { RADIOLIB_LORAWAN_NWK_KEY };
// create the LoRaWAN node
LoRaWANNode node(&radio, &Region, subBand);
// result code to text ...
// result code to text - these are error codes that can be raised when using LoRaWAN
// however, RadioLib has many more - see https://jgromes.github.io/RadioLib/group__status__codes.html for a complete list
String stateDecode(const int16_t result) {
switch (result) {
case RADIOLIB_ERR_NONE:
@ -154,7 +81,6 @@ String stateDecode(const int16_t result) {
return "ERR_INVALID_OUTPUT_POWER";
case RADIOLIB_ERR_NETWORK_NOT_JOINED:
return "RADIOLIB_ERR_NETWORK_NOT_JOINED";
case RADIOLIB_ERR_DOWNLINK_MALFORMED:
return "RADIOLIB_ERR_DOWNLINK_MALFORMED";
case RADIOLIB_ERR_INVALID_REVISION:
@ -181,34 +107,33 @@ String stateDecode(const int16_t result) {
return "RADIOLIB_ERR_DWELL_TIME_EXCEEDED";
case RADIOLIB_ERR_CHECKSUM_MISMATCH:
return "RADIOLIB_ERR_CHECKSUM_MISMATCH";
case RADIOLIB_LORAWAN_NO_DOWNLINK:
return "RADIOLIB_LORAWAN_NO_DOWNLINK";
case RADIOLIB_ERR_NO_JOIN_ACCEPT:
return "RADIOLIB_ERR_NO_JOIN_ACCEPT";
case RADIOLIB_LORAWAN_SESSION_RESTORED:
return "RADIOLIB_LORAWAN_SESSION_RESTORED";
case RADIOLIB_LORAWAN_NEW_SESSION:
return "RADIOLIB_LORAWAN_NEW_SESSION";
case RADIOLIB_LORAWAN_NONCES_DISCARDED:
return "RADIOLIB_LORAWAN_NONCES_DISCARDED";
case RADIOLIB_LORAWAN_SESSION_DISCARDED:
return "RADIOLIB_LORAWAN_SESSION_DISCARDED";
case RADIOLIB_ERR_NONCES_DISCARDED:
return "RADIOLIB_ERR_NONCES_DISCARDED";
case RADIOLIB_ERR_SESSION_DISCARDED:
return "RADIOLIB_ERR_SESSION_DISCARDED";
}
return "See TypeDef.h";
return "See https://jgromes.github.io/RadioLib/group__status__codes.html";
}
// helper function to display any issues
void debug(bool isFail, const __FlashStringHelper* message, int state, bool Freeze) {
if (isFail) {
void debug(bool failed, const __FlashStringHelper* message, int state, bool halt) {
if(failed) {
Serial.print(message);
Serial.print(" - ");
Serial.print(stateDecode(state));
Serial.print(" (");
Serial.print(state);
Serial.println(")");
while (Freeze);
while(halt) { delay(1); }
}
}
// helper function to display a byte array
void arrayDump(uint8_t *buffer, uint16_t len) {
for(uint16_t c = 0; c < len; c++) {
@ -219,5 +144,19 @@ void arrayDump(uint8_t *buffer, uint16_t len) {
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

View file

@ -1,6 +1,8 @@
/*
RadioLib LoRaWAN Starter Example
! Please refer to the included notes to get started !
This example joins a LoRaWAN network and will send
uplink packets. Before you start, you will have to
register your device at https://www.thethingsnetwork.org/
@ -35,7 +37,8 @@ void setup() {
debug(state != RADIOLIB_ERR_NONE, F("Initialise radio failed"), state, true);
// Setup the OTAA session information
node.beginOTAA(joinEUI, devEUI, nwkKey, appKey);
state = node.beginOTAA(joinEUI, devEUI, nwkKey, appKey);
debug(state != RADIOLIB_ERR_NONE, F("Initialise node failed"), state, true);
Serial.println(F("Join ('login') the LoRaWAN Network"));
state = node.activateOTAA();
@ -60,11 +63,19 @@ void loop() {
// Perform an uplink
int16_t state = node.sendReceive(uplinkPayload, sizeof(uplinkPayload));
debug((state != RADIOLIB_LORAWAN_NO_DOWNLINK) && (state != RADIOLIB_ERR_NONE), F("Error in sendReceive"), state, false);
debug(state < RADIOLIB_ERR_NONE, F("Error in sendReceive"), state, false);
Serial.print(F("Uplink complete, next in "));
// Check if a downlink was received
// (state 0 = no downlink, state 1/2 = downlink in window Rx1/Rx2)
if(state > 0) {
Serial.println(F("Received a downlink"));
} else {
Serial.println(F("No downlink received"));
}
Serial.print(F("Next uplink in "));
Serial.print(uplinkIntervalSeconds);
Serial.println(F(" seconds"));
Serial.println(F(" seconds\n"));
// Wait until next uplink - observing legal & TTN FUP constraints
delay(uplinkIntervalSeconds * 1000UL); // delay needs milli-seconds

View file

@ -1,8 +1,21 @@
#ifndef _CONFIG_H
#define _CONFIG_H
#ifndef _RADIOLIB_EX_LORAWAN_CONFIG_H
#define _RADIOLIB_EX_LORAWAN_CONFIG_H
#include <RadioLib.h>
// first you have to set your radio model and pin configuration
// this is provided just as a default example
SX1278 radio = new Module(10, 2, 9, 3);
// if you have RadioBoards (https://github.com/radiolib-org/RadioBoards)
// and are using one of the supported boards, you can do the following:
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// how often to send an uplink - consider legal & FUP constraints - see notes
const uint32_t uplinkIntervalSeconds = 5UL * 60UL; // minutes x seconds
@ -24,101 +37,15 @@ const uint32_t uplinkIntervalSeconds = 5UL * 60UL; // minutes x seconds
// 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
// 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 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 ...
// Auto select MCU <-> radio connections
// If you get an error message when compiling, it may be that the
// pinmap could not be determined - see the notes for more info
// Adafruit
#if defined(ARDUINO_SAMD_FEATHER_M0)
#pragma message ("Adafruit Feather M0 with RFM95")
#pragma message ("Link required on board")
SX1276 radio = new Module(8, 3, 4, 6);
// LilyGo
#elif defined(ARDUINO_TTGO_LORA32_V1)
#pragma message ("Using TTGO LoRa32 v1 - no Display")
SX1276 radio = new Module(18, 26, 14, 33);
#elif defined(ARDUINO_TTGO_LORA32_V2)
#pragma message ("Using TTGO LoRa32 v2 + Display")
SX1276 radio = new Module(18, 26, 12, RADIOLIB_NC);
#elif defined(ARDUINO_TTGO_LoRa32_v21new) // T3_V1.6.1
#pragma message ("Using TTGO LoRa32 v2.1 marked T3_V1.6.1 + Display")
SX1276 radio = new Module(18, 26, 14, 33);
#elif defined(ARDUINO_TBEAM_USE_RADIO_SX1262)
#pragma error ("ARDUINO_TBEAM_USE_RADIO_SX1262 awaiting pin map")
#elif defined(ARDUINO_TBEAM_USE_RADIO_SX1276)
#pragma message ("Using TTGO T-Beam")
SX1276 radio = new Module(18, 26, 23, 33);
// HelTec: https://github.com/espressif/arduino-esp32/blob/master/variants/heltec_*/pins_arduino.h
#elif defined(ARDUINO_HELTEC_WIFI_LORA_32)
#pragma message ("Using Heltec WiFi LoRa32")
SX1276 radio = new Module(18, 26, 14, 33);
#elif defined(ARDUINO_heltec_wifi_lora_32_V2)
#pragma message ("Using Heltec WiFi LoRa32 v2")
SX1278 radio = new Module(14, 4, 12, 16);
// Pending verfication of which radio is shipped
// #elif defined(ARDUINO_heltec_wifi_lora_32_V2)
// #pragma message ("ARDUINO_heltec_wifi_kit_32_V2 awaiting pin map")
// SX1276 radio = new Module(18, 26, 14, 35);
#elif defined(ARDUINO_heltec_wifi_lora_32_V3)
#pragma message ("Using Heltec WiFi LoRa32 v3 - Display + USB-C")
SX1262 radio = new Module(8, 14, 12, 13);
// Following not verified
#elif defined (ARDUINO_heltec_wireless_stick)
#pragma message ("Using Heltec Wireless Stick")
SX1278 radio = new Module(14, 4, 12, 16);
#elif defined (ARDUINO_HELTEC_WIRELESS_STICK)
#pragma message ("Using Heltec Wireless Stick")
SX1276 radio = new Module(18, 26, 14, 35);
#elif defined (ARDUINO_HELTEC_WIRELESS_STICK_V3)
#pragma message ("Using Heltec Wireless Stick v3")
SX1262 radio = new Module(8, 14, 12, 13);
#elif defined (ARDUINO_HELTEC_WIRELESS_STICK_LITE)
#pragma message ("Using Heltec Wireless Stick Lite")
SX1276 radio = new Module(18, 26, 14, 35);
#elif defined (ARDUINO_HELTEC_WIRELESS_STICK_LITE_V3)
#pragma message ("Using Heltec Wireless Stick Lite v3")
SX1262 radio = new Module(34, 14, 12, 13);
// If we don't recognise the board
#else
#pragma message ("Unknown board - no automagic pinmap available")
// SX1262 pin order: Module(NSS/CS, DIO1, RESET, BUSY);
// SX1262 radio = new Module(8, 14, 12, 13);
// SX1278 pin order: Module(NSS/CS, DIO0, RESET, DIO1);
// SX1278 radio = new Module(10, 2, 9, 3);
// For Pi Pico + Waveshare HAT - work in progress
// SX1262 radio = new Module(3, 20, 15, 2, SPI1, RADIOLIB_DEFAULT_SPI_SETTINGS);
#endif
// copy over the EUI's & keys in to the something that will not compile if incorrectly formatted
uint64_t joinEUI = RADIOLIB_LORAWAN_JOIN_EUI;
uint64_t devEUI = RADIOLIB_LORAWAN_DEV_EUI;
@ -128,8 +55,8 @@ uint8_t nwkKey[] = { RADIOLIB_LORAWAN_NWK_KEY };
// create the LoRaWAN node
LoRaWANNode node(&radio, &Region, subBand);
// result code to text ...
// result code to text - these are error codes that can be raised when using LoRaWAN
// however, RadioLib has many more - see https://jgromes.github.io/RadioLib/group__status__codes.html for a complete list
String stateDecode(const int16_t result) {
switch (result) {
case RADIOLIB_ERR_NONE:
@ -154,7 +81,6 @@ String stateDecode(const int16_t result) {
return "ERR_INVALID_OUTPUT_POWER";
case RADIOLIB_ERR_NETWORK_NOT_JOINED:
return "RADIOLIB_ERR_NETWORK_NOT_JOINED";
case RADIOLIB_ERR_DOWNLINK_MALFORMED:
return "RADIOLIB_ERR_DOWNLINK_MALFORMED";
case RADIOLIB_ERR_INVALID_REVISION:
@ -181,34 +107,33 @@ String stateDecode(const int16_t result) {
return "RADIOLIB_ERR_DWELL_TIME_EXCEEDED";
case RADIOLIB_ERR_CHECKSUM_MISMATCH:
return "RADIOLIB_ERR_CHECKSUM_MISMATCH";
case RADIOLIB_LORAWAN_NO_DOWNLINK:
return "RADIOLIB_LORAWAN_NO_DOWNLINK";
case RADIOLIB_ERR_NO_JOIN_ACCEPT:
return "RADIOLIB_ERR_NO_JOIN_ACCEPT";
case RADIOLIB_LORAWAN_SESSION_RESTORED:
return "RADIOLIB_LORAWAN_SESSION_RESTORED";
case RADIOLIB_LORAWAN_NEW_SESSION:
return "RADIOLIB_LORAWAN_NEW_SESSION";
case RADIOLIB_LORAWAN_NONCES_DISCARDED:
return "RADIOLIB_LORAWAN_NONCES_DISCARDED";
case RADIOLIB_LORAWAN_SESSION_DISCARDED:
return "RADIOLIB_LORAWAN_SESSION_DISCARDED";
case RADIOLIB_ERR_NONCES_DISCARDED:
return "RADIOLIB_ERR_NONCES_DISCARDED";
case RADIOLIB_ERR_SESSION_DISCARDED:
return "RADIOLIB_ERR_SESSION_DISCARDED";
}
return "See TypeDef.h";
return "See https://jgromes.github.io/RadioLib/group__status__codes.html";
}
// helper function to display any issues
void debug(bool isFail, const __FlashStringHelper* message, int state, bool Freeze) {
if (isFail) {
void debug(bool failed, const __FlashStringHelper* message, int state, bool halt) {
if(failed) {
Serial.print(message);
Serial.print(" - ");
Serial.print(stateDecode(state));
Serial.print(" (");
Serial.print(state);
Serial.println(")");
while (Freeze);
while(halt) { delay(1); }
}
}
// helper function to display a byte array
void arrayDump(uint8_t *buffer, uint16_t len) {
for(uint16_t c = 0; c < len; c++) {
@ -219,5 +144,4 @@ void arrayDump(uint8_t *buffer, uint16_t len) {
Serial.println();
}
#endif

View file

@ -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 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.
@ -141,31 +141,12 @@ If you are using US915 or AU915 then you should change the subBand const to 2.
### The pinmap
This is the connection between the MCU (ESP32/ATmega/SAMD) and the LoRa radio (SX1276/SX1262).
This is the connection between your microcontroller (ESP32, ATmega, SAMD etc.) and the radio (SX1276, SX1262, LR1110 etc.).
You have to select the correct module and set the correct pins.
Prebuilt modules are easy - we can detect the board and setup the pinmap for you. These boards are:
* TTGO_LoRa32
* TTGO_LoRa32_V1
* TTGO_LORA32_V2
* TTGO_LORA32_v21NEW
* HELTEC_WIFI_LORA_32
* HELTEC_WIFI_LORA_32_V2
* HELTEC_WIFI_LORA_32_V3
* HELTEC_WIRELESS_STICK
* HELTEC_WIRELESS_STICK_V3
* HELTEC_WIRELESS_STICK_LITE
* HELTEC_WIRELESS_STICK_LITE_V3
If you have a TTGO T-Beam, you must choose the correct radio from the Board Revision sub-menu found under the main Tools menu.
* TBEAM_USE_RADIO_SX1262
* TBEAM_USE_RADIO_SX1276
Auto-setup for the Adafruit Feather M0 with RFM95 is included but you must solder a wire or use a jumper to link from pin 6 to io1: https://learn.adafruit.com/the-things-network-for-feather/arduino-wiring
If you have a module that's not on this list, please go to the "Pinmap How-To" below.
Pin maps for commonly used radio modules are kept in a separate library, called RadioBoards: https://github.com/radiolib-org/RadioBoards
It can automatically detect your microcontroller platform and radio, and configure things for you. If you have a board that is not supported by RadioBoards, feel free to suggest it in the RadioBoards issues, or better yet - open a pull request there!
## Observations on the main sketch
@ -197,8 +178,3 @@ Coming soon
### Device testing
The LoRaWAN code base works to a specification and once you are happy your device is able to join & send a few dozen uplinks, continuing to sit around waiting for an uplink to test your sensor code & payload format is a waste of your time. The solution is to write everything else in a different sketch, output the array to the serial console and then you can copy & paste the hex array in to the TTN console Payload Formatters section to test the decoding.
## Pinmap How-To
Coming soon

View file

@ -1,17 +1,34 @@
# LoRaWAN examples
RadioLib LoRaWAN v1.1 examples.
RadioLib LoRaWAN examples.
* [LoRaWAN_Starter](https://github.com/jgromes/RadioLib/tree/master/examples/LoRaWAN/LoRaWAN_Starter): this is the recommended entry point for new users. Please read the [`notes`](https://github.com/jgromes/RadioLib/blob/master/examples/LoRaWAN/LoRaWAN_Starter/notes.md) that come with this example to learn more about LoRaWAN and how to use it in RadioLib!
* [LoRaWAN_Reference](https://github.com/jgromes/RadioLib/tree/master/examples/LoRaWAN/LoRaWAN_Reference): this sketch showcases most of the available API for LoRaWAN in RadioLib. Be frightened by the possibilities! It is recommended you have read all the [`notes`](https://github.com/jgromes/RadioLib/blob/master/examples/LoRaWAN/LoRaWAN_Starter/notes.md) for the Starter sketch first, as well as the [Learn section on The Things Network](https://www.thethingsnetwork.org/docs/lorawan/)!
* [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
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 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 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 1.1 session, supply all the required keys:
```cpp
node.beginOTAA(joinEUI, devEUI, nwkKey, appKey);
node.beginABP(devAddr, fNwkSIntKey, sNwkSIntKey, nwkSEncKey, appSKey);
```
To activate a LoRaWAN 1.0.4 session, set the keys that are not available to `NULL`:
```cpp
node.beginOTAA(joinEUI, devEUI, NULL, appKey);
node.beginABP(devAddr, NULL, NULL, nwkSEncKey, appSKey);
```
The device doesn't need to know the Regional Parameters version - that is of importance on the console.
## LoRaWAN persistence
> [!WARNING]
> These examples do not fully comply with LoRaWAN 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:
## RadioLib persistence
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:
* [LoRaWAN for ESP32](https://github.com/radiolib-org/radiolib-persistence/tree/main/examples/LoRaWAN_ESP32)

View file

@ -1,23 +1,23 @@
/*
RadioLib SX127x Morse Receive AM Example
RadioLib SX127x Morse Receive AM Example
This example receives Morse code message using
SX1278's FSK modem. The signal is expected to be
modulated as OOK, to be demodulated in AM mode.
This example receives Morse code message using
SX1278's FSK modem. The signal is expected to be
modulated as OOK, to be demodulated in AM mode.
Other modules that can be used for Morse Code
with AFSK modulation:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
Other modules that can be used for Morse Code
with AFSK modulation:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -30,9 +30,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module
// pin 5 is connected to SX1278 DIO2
@ -52,7 +56,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// when using one of the non-LoRa modules for Morse code
@ -69,7 +73,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// after that, set mode to OOK to emulate AM modulation
@ -80,7 +84,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// start direct mode reception

View file

@ -1,23 +1,23 @@
/*
RadioLib Morse Transmit AM Example
RadioLib Morse Transmit AM Example
This example sends Morse code message using
SX1278's FSK modem. The signal is modulated
as OOK, and may be demodulated in AM mode.
This example sends Morse code message using
SX1278's FSK modem. The signal is modulated
as OOK, and may be demodulated in AM mode.
Other modules that can be used for Morse Code
with AM modulation:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
Other modules that can be used for Morse Code
with AM modulation:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -30,9 +30,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module
// pin 5 is connected to SX1278 DIO2
@ -57,7 +61,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize Morse client
@ -70,7 +74,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// after that, set mode to OOK to emulate AM modulation
@ -81,7 +85,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}

View file

@ -1,24 +1,24 @@
/*
RadioLib Morse Transmit AFSK Example
RadioLib Morse Transmit AFSK Example
This example sends Morse code message using
SX1278's FSK modem. The signal is modulated
as AFSK, and may be demodulated in FM mode.
This example sends Morse code message using
SX1278's FSK modem. The signal is modulated
as AFSK, and may be demodulated in FM mode.
Other modules that can be used for Morse Code
with AFSK modulation:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
- SX126x/LLCC68 (only devices without TCXO!)
Other modules that can be used for Morse Code
with AFSK modulation:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
- SX126x/LLCC68
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -31,9 +31,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module
// this requires connection to the module direct
@ -65,7 +69,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize Morse client
@ -78,7 +82,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}

View file

@ -1,26 +1,26 @@
/*
RadioLib Morse Transmit SSB Example
RadioLib Morse Transmit SSB Example
This example sends Morse code message using
SX1278's FSK modem. The signal is an unmodulated
carrier wave, and may be demodulated in SSB mode.
This example sends Morse code message using
SX1278's FSK modem. The signal is an unmodulated
carrier wave, and may be demodulated in SSB mode.
Other modules that can be used for Morse Code:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- SX126x
- nRF24
- Si443x/RFM2x
- SX128x
- LR11x0
Other modules that can be used for Morse Code:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- SX126x
- nRF24
- Si443x/RFM2x
- SX128x
- LR11x0
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -33,9 +33,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create Morse client instance using the FSK module
MorseClient morse(&radio);
@ -56,7 +60,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize Morse client
@ -69,7 +73,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}

View file

@ -0,0 +1,10 @@
# RadioLib ESP-IDF example
This example shows how to use RadioLib as ESP-IDF component, without the Arduino framework. To run in ESP-IDF (or on any other platform), RadioLib includes an internal hardware abstraction layer (HAL). This software layer takes care of basic interaction with the hardware, such as performing SPI transaction or GPIO operations. To run on your chosen ESP microcontroller, you will likely have to customize the example HAL for your specific ESP type.
## Structure of the example
* `main/CMakeLists.txt` - IDF component CMake file
* `main/EspHal.h` - RadioLib HAL example implementation
* `main/idf_component.yml` - declaration of the RadioLib dependency for this example
* `main/main.cpp` - the example source code

View file

@ -7,7 +7,7 @@
// 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 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
// include all the dependencies

View file

@ -1,7 +1,7 @@
dependencies:
RadioLib:
# referenced locally because the example is a part of the repository itself
# under normal circumstances, it's preferrable to reference the repository instead
# under normal circumstances, it's preferable to reference the repository instead
# for other options, see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-component-manager.html
path: ../../../../../RadioLib
#git: https://github.com/jgromes/RadioLib.git

View file

@ -23,11 +23,11 @@ add_executable(${PROJECT_NAME}
)
# Pull in common dependencies
target_link_libraries(${PROJECT_NAME} pico_stdlib hardware_spi hardware_gpio hardware_timer RadioLib)
target_link_libraries(${PROJECT_NAME} pico_stdlib hardware_spi hardware_gpio hardware_timer pico_multicore hardware_pwm RadioLib)
pico_enable_stdio_usb(${PROJECT_NAME} 1)
pico_enable_stdio_uart(${PROJECT_NAME} 0)
# Create map/bin/hex file etc.
pico_add_extra_outputs(${PROJECT_NAME})
pico_add_extra_outputs(${PROJECT_NAME})

View file

@ -41,7 +41,7 @@
#include <RadioLib.h>
// include the hardware abstraction layer
#include "PicoHal.h"
#include "hal/RPiPico/PicoHal.h"
// create a new instance of the HAL class
PicoHal* hal = new PicoHal(SPI_PORT, SPI_MISO, SPI_MOSI, SPI_SCK);

View file

@ -15,7 +15,7 @@ add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../../../../RadioLib" "${CMAKE_CUR
add_executable(${PROJECT_NAME} main.cpp)
# link both libraries
target_link_libraries(${PROJECT_NAME} RadioLib pigpio)
target_link_libraries(${PROJECT_NAME} RadioLib lgpio)
# you can also specify RadioLib compile-time flags here
#target_compile_definitions(RadioLib PUBLIC RADIOLIB_DEBUG_BASIC RADIOLIB_DEBUG_SPI)

View file

@ -1,194 +0,0 @@
#ifndef PI_HAL_H
#define PI_HAL_H
// include RadioLib
#include <RadioLib.h>
// include the library for Raspberry GPIO pins
#include "pigpio.h"
// these should really be swapped, but for some reason,
// it seems like the change directions are inverted in gpioSetAlert functions
#define PI_RISING (FALLING_EDGE)
#define PI_FALLING (RISING_EDGE)
// forward declaration of alert handler that will be used to emulate interrupts
static void pigpioAlertHandler(int event, int level, uint32_t tick, void *userdata);
// create a new Raspberry Pi hardware abstraction layer
// using the pigpio library
// the HAL must inherit from the base RadioLibHal class
// and implement all of its virtual methods
class PiHal : public RadioLibHal {
public:
// default constructor - initializes the base HAL and any needed private members
PiHal(uint8_t spiChannel, uint32_t spiSpeed = 2000000)
: RadioLibHal(PI_INPUT, PI_OUTPUT, PI_LOW, PI_HIGH, PI_RISING, PI_FALLING),
_spiChannel(spiChannel),
_spiSpeed(spiSpeed) {
}
void init() override {
// first initialise pigpio library
gpioInitialise();
// now the SPI
spiBegin();
// Waveshare LoRaWAN Hat also needs pin 18 to be pulled high to enable the radio
gpioSetMode(18, PI_OUTPUT);
gpioWrite(18, PI_HIGH);
}
void term() override {
// stop the SPI
spiEnd();
// pull the enable pin low
gpioSetMode(18, PI_OUTPUT);
gpioWrite(18, PI_LOW);
// finally, stop the pigpio library
gpioTerminate();
}
// 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;
}
gpioSetMode(pin, mode);
}
void digitalWrite(uint32_t pin, uint32_t value) override {
if(pin == RADIOLIB_NC) {
return;
}
gpioWrite(pin, value);
}
uint32_t digitalRead(uint32_t pin) override {
if(pin == RADIOLIB_NC) {
return(0);
}
return(gpioRead(pin));
}
void attachInterrupt(uint32_t interruptNum, void (*interruptCb)(void), uint32_t mode) override {
if((interruptNum == RADIOLIB_NC) || (interruptNum > PI_MAX_USER_GPIO)) {
return;
}
// enable emulated interrupt
interruptEnabled[interruptNum] = true;
interruptModes[interruptNum] = mode;
interruptCallbacks[interruptNum] = interruptCb;
// set pigpio alert callback
gpioSetAlertFuncEx(interruptNum, pigpioAlertHandler, (void*)this);
}
void detachInterrupt(uint32_t interruptNum) override {
if((interruptNum == RADIOLIB_NC) || (interruptNum > PI_MAX_USER_GPIO)) {
return;
}
// clear emulated interrupt
interruptEnabled[interruptNum] = false;
interruptModes[interruptNum] = 0;
interruptCallbacks[interruptNum] = NULL;
// disable pigpio alert callback
gpioSetAlertFuncEx(interruptNum, NULL, NULL);
}
void delay(RadioLibTime_t ms) override {
gpioDelay(ms * 1000);
}
void delayMicroseconds(RadioLibTime_t us) override {
gpioDelay(us);
}
RadioLibTime_t millis() override {
return(gpioTick() / 1000);
}
RadioLibTime_t micros() override {
return(gpioTick());
}
long pulseIn(uint32_t pin, uint32_t state, RadioLibTime_t timeout) override {
if(pin == RADIOLIB_NC) {
return(0);
}
this->pinMode(pin, PI_INPUT);
uint32_t start = this->micros();
uint32_t curtick = this->micros();
while(this->digitalRead(pin) == state) {
if((this->micros() - curtick) > timeout) {
return(0);
}
}
return(this->micros() - start);
}
void spiBegin() {
if(_spiHandle < 0) {
_spiHandle = spiOpen(_spiChannel, _spiSpeed, 0);
}
}
void spiBeginTransaction() {}
void spiTransfer(uint8_t* out, size_t len, uint8_t* in) {
spiXfer(_spiHandle, (char*)out, (char*)in, len);
}
void spiEndTransaction() {}
void spiEnd() {
if(_spiHandle >= 0) {
spiClose(_spiHandle);
_spiHandle = -1;
}
}
// interrupt emulation
bool interruptEnabled[PI_MAX_USER_GPIO + 1];
uint32_t interruptModes[PI_MAX_USER_GPIO + 1];
typedef void (*RadioLibISR)(void);
RadioLibISR interruptCallbacks[PI_MAX_USER_GPIO + 1];
private:
// the HAL can contain any additional private members
const unsigned int _spiSpeed;
const uint8_t _spiChannel;
int _spiHandle = -1;
};
// this handler emulates interrupts
static void pigpioAlertHandler(int event, int level, uint32_t tick, void *userdata) {
if((event > PI_MAX_USER_GPIO) || (!userdata)) {
return;
}
// PiHal isntance is passed via the user data
PiHal* hal = (PiHal*)userdata;
// check the interrupt is enabled, the level matches and a callback exists
if((hal->interruptEnabled[event]) &&
(hal->interruptModes[event] == level) &&
(hal->interruptCallbacks[event])) {
hal->interruptCallbacks[event]();
}
}
#endif

View file

@ -3,7 +3,8 @@
This example shows how to use RadioLib without Arduino.
In this case, a Raspberry Pi with WaveShare SX1302 LoRaWAN Hat
using the pigpio library.
using the lgpio library
https://abyz.me.uk/lg/lgpio.html
Can be used as a starting point to port RadioLib to any platform!
See this API reference page for details on the RadioLib hardware abstraction
@ -17,7 +18,7 @@
#include <RadioLib.h>
// include the hardware abstraction layer
#include "PiHal.h"
#include "hal/RPi/PiHal.h"
// create a new instance of the HAL class
// use SPI channel 1, because on Waveshare LoRaWAN Hat,
@ -44,10 +45,13 @@ int main(int argc, char** argv) {
printf("success!\n");
// loop forever
int count = 0;
for(;;) {
// send a packet
printf("[SX1261] Transmitting packet ... ");
state = radio.transmit("Hello World!");
char str[64];
sprintf(str, "Hello World! #%d", count++);
state = radio.transmit(str);
if(state == RADIOLIB_ERR_NONE) {
// the packet was successfully transmitted
printf("success!\n");

View file

@ -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
# built changes based on compiler version.
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
RadioLib
$ENV{LIBTOCK_C_DIRECTORY}/libtock/build/rv32imc/libtock.a
@ -80,7 +94,17 @@ if (RISCV_BUILD)
)
endif()
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
RadioLib
$ENV{LIBTOCK_C_DIRECTORY}/libtock/build/cortex-m4/libtock.a

View file

@ -23,7 +23,7 @@ The RadioLib example can be built with:
$ git clone https://github.com/jgromes/RadioLib.git
$ cd RadioLib/examples/NonArduino/Tock/
$ 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
```

View file

@ -3,9 +3,9 @@ set -e
rm -rf ./build-*
cd libtock-c/examples/cxx_hello
pushd ${LIBTOCK_C_DIRECTORY}/examples/cxx_hello
make -j4
cd ../../../
popd
mkdir -p build-arm
cd build-arm

View file

@ -1,202 +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);
/*
* 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 = *(gpioIrqFn*)(&userdata);
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;
}
libtock_lora_phy_gpio_command_interrupt_callback(lora_phy_gpio_Callback, &interruptCb);
// 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;
}
libtock_lora_phy_gpio_disable_interrupt(interruptNum);
}
void delay(unsigned long ms) override {
libtocksync_alarm_delay_ms( ms );
}
void delayMicroseconds(unsigned long us) override {
libtocksync_alarm_delay_ms( us / 1000 );
}
unsigned long millis() override {
uint32_t frequency, now;
alarm_internal_frequency(&frequency);
alarm_internal_read(&now);
return (now / frequency) / 1000;
}
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

View file

@ -28,14 +28,14 @@
#include <RadioLib.h>
// include the hardware abstraction layer
#include "libtockHal.h"
#include "RadioLib/libtockHal.h"
// the entry point for the program
int main(void) {
printf("[SX1261] Initialising Radio ... \r\n");
// create a new instance of the HAL class
TockHal* hal = new TockHal();
TockRadioLibHal* hal = new TockRadioLibHal();
// now we can create the radio module
// pinout corresponds to the SparkFun LoRa Thing Plus - expLoRaBLE
@ -43,7 +43,7 @@ int main(void) {
// DIO1 pin: 2
// NRST pin: 4
// 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);
// Setup the radio

View file

@ -1,24 +1,24 @@
/*
RadioLib Pager (POCSAG) Receive Example
RadioLib Pager (POCSAG) Receive Example
This example shows how to receive FSK packets without using
SX127x packet engine.
This example shows how to receive FSK packets without using
SX127x packet engine.
This example receives POCSAG messages using SX1278's
FSK modem in direct mode.
This example receives POCSAG messages using SX1278's
FSK modem in direct mode.
Other modules that can be used to receive POCSAG:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
Other modules that can be used to receive POCSAG:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx127xrfm9x---lora-modem
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx127xrfm9x---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -45,9 +45,13 @@ const int pin = 5;
// create Pager client instance using the FSK module
PagerClient pager(&radio);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// 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);
@ -65,7 +69,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// initialize Pager client
@ -78,7 +82,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// start receiving POCSAG messages
@ -90,7 +94,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
}

View file

@ -1,24 +1,24 @@
/*
RadioLib Pager (POCSAG) Transmit Example
RadioLib Pager (POCSAG) Transmit Example
This example sends POCSAG messages using SX1278's
FSK modem.
This example sends POCSAG messages using SX1278's
FSK modem.
Other modules that can be used to send POCSAG:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- SX126x
- nRF24
- Si443x/RFM2x
- SX128x
Other modules that can be used to send POCSAG:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- SX126x
- nRF24
- Si443x/RFM2x
- SX128x
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -31,9 +31,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create Pager client instance using the FSK module
PagerClient pager(&radio);
@ -54,7 +58,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize Pager client
@ -67,7 +71,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}

View file

@ -1,12 +1,12 @@
/*
RadioLib PhysicalLayer Interface Example
RadioLib PhysicalLayer Interface Example
This example shows how to use the common PhysicalLayer
to interface with different radio modules using the same
methods.
This example shows how to use the common PhysicalLayer
to interface with different radio modules using the same
methods.
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -23,6 +23,14 @@
// extra GPIO/interrupt pin: 3 (unused on some modules)
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
PhysicalLayer* phy = (PhysicalLayer*)&radio;
@ -42,7 +50,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// or we can use the "phy" pointer to access the common layer
@ -54,7 +62,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// PhysicalLayer also contains basic functionality
@ -66,7 +74,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// try to receive now - this will almost certainly timeout
@ -82,7 +90,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// interrupt-driven versions of Rx/Tx are supported as well
@ -105,7 +113,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// ... or standby
@ -116,7 +124,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// there are also common SNR/RSSI measurement functions

View file

@ -1,15 +1,15 @@
/*
RadioLib RF69 Receive with AES Example
RadioLib RF69 Receive with AES Example
This example receives packets using RF69 FSK radio module.
Packets are decrypted using hardware AES.
NOTE: When using address filtering, the address byte is NOT encrypted!
This example receives packets using RF69 FSK radio module.
Packets are decrypted using hardware AES.
NOTE: When using address filtering, the address byte is NOT encrypted!
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -21,9 +21,13 @@
// RESET pin: 3
RF69 radio = new Module(10, 2, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//RF69 radio = RadioShield.ModuleA;
// 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);
@ -36,7 +40,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set AES key that will be used to decrypt the packet

View file

@ -1,17 +1,17 @@
/*
RadioLib RF69 Receive with Address Example
RadioLib RF69 Receive with Address Example
This example receives packets using RF69 FSK radio module.
Packets can have 1-byte address of the destination node.
After setting node (or broadcast) address, this node will
automatically filter out any packets that do not contain
either node address or broadcast address.
This example receives packets using RF69 FSK radio module.
Packets can have 1-byte address of the destination node.
After setting node (or broadcast) address, this node will
automatically filter out any packets that do not contain
either node address or broadcast address.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -23,9 +23,13 @@
// RESET pin: 3
RF69 radio = new Module(10, 2, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//RF69 radio = RadioShield.ModuleA;
// 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);
@ -38,7 +42,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set node address
@ -51,7 +55,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set broadcast address
@ -64,7 +68,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// address filtering can also be disabled
@ -78,7 +82,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
*/
}

View file

@ -30,9 +30,13 @@
// RESET pin: 3
RF69 radio = new Module(10, 2, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//RF69 radio = RadioShield.ModuleA;
// 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);
@ -45,7 +49,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
}

View file

@ -1,15 +1,15 @@
/*
RadioLib RF69 Receive with Interrupts Example
RadioLib RF69 Receive with Interrupts Example
This example listens for FSK transmissions and tries to
receive them. Once a packet is received, an interrupt is
triggered.
This example listens for FSK transmissions and tries to
receive them. Once a packet is received, an interrupt is
triggered.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -21,48 +21,13 @@
// RESET pin: 3
RF69 radio = new Module(10, 2, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//RF69 radio = RadioShield.ModuleA;
void setup() {
Serial.begin(9600);
// initialize RF69 with default settings
Serial.print(F("[RF69] Initializing ... "));
int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
}
// set the function that will be called
// when new packet is received
radio.setPacketReceivedAction(setFlag);
// start listening for packets
Serial.print(F("[RF69] Starting to listen ... "));
state = radio.startReceive();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
}
// if needed, 'listen' mode can be disabled by calling
// any of the following methods:
//
// radio.standby()
// radio.sleep()
// radio.transmit();
// radio.receive();
// radio.readData();
}
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// flag to indicate that a packet was received
volatile bool receivedFlag = false;
@ -79,6 +44,45 @@ void setFlag(void) {
receivedFlag = true;
}
void setup() {
Serial.begin(9600);
// initialize RF69 with default settings
Serial.print(F("[RF69] Initializing ... "));
int state = radio.begin();
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 new packet is received
radio.setPacketReceivedAction(setFlag);
// start listening for packets
Serial.print(F("[RF69] Starting to listen ... "));
state = radio.startReceive();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// if needed, 'listen' mode can be disabled by calling
// any of the following methods:
//
// radio.standby()
// radio.sleep()
// radio.transmit();
// radio.receive();
// radio.readData();
}
void loop() {
// check if the flag is set
if(receivedFlag) {

View file

@ -1,21 +1,21 @@
/*
RadioLib RF69 Settings Example
RadioLib RF69 Settings Example
This example shows how to change all the properties of RF69 radio.
RadioLib currently supports the following settings:
- pins (SPI slave select, digital IO 0, digital IO 1)
- carrier frequency
- bit rate
- receiver bandwidth
- allowed frequency deviation
- output power during transmission
- sync word
This example shows how to change all the properties of RF69 radio.
RadioLib currently supports the following settings:
- pins (SPI slave select, digital IO 0, digital IO 1)
- carrier frequency
- bit rate
- receiver bandwidth
- allowed frequency deviation
- output power during transmission
- sync word
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -33,9 +33,13 @@ RF69 radio1 = new Module(10, 2, 3);
// RESET pin: 5
RF69 radio2 = new Module(9, 4, 5);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//RF69 radio3 = RadioShield.ModuleB;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio3 = new RadioModule();
*/
void setup() {
Serial.begin(9600);
@ -48,7 +52,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// initialize RF69 with non-default settings
@ -65,7 +69,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// you can also change the settings at runtime
@ -74,41 +78,41 @@ void setup() {
// set carrier frequency to 433.5 MHz
if (radio1.setFrequency(433.5) == RADIOLIB_ERR_INVALID_FREQUENCY) {
Serial.println(F("[RF69] Selected frequency is invalid for this module!"));
while (true);
while (true) { delay(10); }
}
// set bit rate to 100.0 kbps
state = radio1.setBitRate(100.0);
if (state == RADIOLIB_ERR_INVALID_BIT_RATE) {
Serial.println(F("[RF69] Selected bit rate is invalid for this module!"));
while (true);
while (true) { delay(10); }
} else if (state == RADIOLIB_ERR_INVALID_BIT_RATE_BW_RATIO) {
Serial.println(F("[RF69] Selected bit rate to bandwidth ratio is invalid!"));
Serial.println(F("[RF69] Increase receiver bandwidth to set this bit rate."));
while (true);
while (true) { delay(10); }
}
// set receiver bandwidth to 250.0 kHz
state = radio1.setRxBandwidth(250.0);
if (state == RADIOLIB_ERR_INVALID_RX_BANDWIDTH) {
Serial.println(F("[RF69] Selected receiver bandwidth is invalid for this module!"));
while (true);
while (true) { delay(10); }
} else if (state == RADIOLIB_ERR_INVALID_BIT_RATE_BW_RATIO) {
Serial.println(F("[RF69] Selected bit rate to bandwidth ratio is invalid!"));
Serial.println(F("[RF69] Decrease bit rate to set this receiver bandwidth."));
while (true);
while (true) { delay(10); }
}
// set allowed frequency deviation to 10.0 kHz
if (radio1.setFrequencyDeviation(10.0) == RADIOLIB_ERR_INVALID_FREQUENCY_DEVIATION) {
Serial.println(F("[RF69] Selected frequency deviation is invalid for this module!"));
while (true);
while (true) { delay(10); }
}
// set output power to 2 dBm
if (radio1.setOutputPower(2) == RADIOLIB_ERR_INVALID_OUTPUT_POWER) {
Serial.println(F("[RF69] Selected output power is invalid for this module!"));
while (true);
while (true) { delay(10); }
}
// up to 8 bytes can be set as sync word
@ -117,7 +121,7 @@ void setup() {
uint8_t syncWord[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
if (radio1.setSyncWord(syncWord, 8) == RADIOLIB_ERR_INVALID_SYNC_WORD) {
Serial.println(F("[RF69] Selected sync word is invalid for this module!"));
while (true);
while (true) { delay(10); }
}
Serial.println(F("[RF69] All settings changed successfully!"));

View file

@ -1,15 +1,15 @@
/*
RadioLib RF69 Transmit with AES Example
RadioLib RF69 Transmit with AES Example
This example transmits packets using RF69 FSK radio module.
Packets are encrypted using hardware AES.
NOTE: When using address filtering, the address byte is NOT encrypted!
This example transmits packets using RF69 FSK radio module.
Packets are encrypted using hardware AES.
NOTE: When using address filtering, the address byte is NOT encrypted!
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -21,9 +21,13 @@
// RESET pin: 3
RF69 radio = new Module(10, 2, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//RF69 radio = RadioShield.ModuleA;
// 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);
@ -36,7 +40,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set AES key to encrypt the packet

View file

@ -1,17 +1,17 @@
/*
RadioLib RF69 Transmit to Address Example
RadioLib RF69 Transmit to Address Example
This example transmits packets using RF69 FSK radio module.
Packets can have 1-byte address of the destination node.
After setting node (or broadcast) address, this node will
automatically filter out any packets that do not contain
either node address or broadcast address.
This example transmits packets using RF69 FSK radio module.
Packets can have 1-byte address of the destination node.
After setting node (or broadcast) address, this node will
automatically filter out any packets that do not contain
either node address or broadcast address.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -23,9 +23,13 @@
// RESET pin: 3
RF69 radio = new Module(10, 2, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//RF69 radio = RadioShield.ModuleA;
// 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);
@ -38,7 +42,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set node address
@ -51,7 +55,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set broadcast address
@ -64,7 +68,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// address filtering can also be disabled
@ -78,7 +82,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
*/
}

View file

@ -27,9 +27,13 @@
// RESET pin: 3
RF69 radio = new Module(10, 2, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//RF69 radio = RadioShield.ModuleA;
// 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);
@ -42,7 +46,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// NOTE: some RF69 modules use high power output,
@ -58,7 +62,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
*/
}

View file

@ -1,18 +1,18 @@
/*
RadioLib RF69 Transmit with Interrupts Example
RadioLib RF69 Transmit with Interrupts Example
This example transmits FSK packets with one second delays
between them. Each packet contains up to 64 bytes
of data, in the form of:
- Arduino String
- null-terminated char array (C-string)
- arbitrary binary data (byte array)
This example transmits FSK packets with one second delays
between them. Each packet contains up to 64 bytes
of data, in the form of:
- Arduino String
- null-terminated char array (C-string)
- arbitrary binary data (byte array)
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -24,13 +24,32 @@
// RESET pin: 3
RF69 radio = new Module(10, 2, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//RF69 radio = RadioShield.ModuleA;
// 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
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() {
Serial.begin(9600);
@ -42,7 +61,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set the function that will be called
@ -62,7 +81,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
*/
@ -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
int count = 0;

View file

@ -1,25 +1,25 @@
/*
RadioLib RTTY Transmit Example
RadioLib RTTY Transmit Example
This example sends RTTY message using SX1278's
FSK modem.
This example sends RTTY message using SX1278's
FSK modem.
Other modules that can be used for RTTY:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- SX126x
- nRF24
- Si443x/RFM2x
- SX128x
- LR11x0
Other modules that can be used for RTTY:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- SX126x
- nRF24
- Si443x/RFM2x
- SX128x
- LR11x0
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -32,9 +32,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create RTTY client instance using the FSK module
RTTYClient rtty(&radio);
@ -55,7 +59,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize RTTY client
@ -81,7 +85,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
/*

View file

@ -1,22 +1,22 @@
/*
RadioLib RTTY Transmit AFSK Example
RadioLib RTTY Transmit AFSK Example
This example sends RTTY message using SX1278's
FSK modem. The data is modulated as AFSK.
This example sends RTTY message using SX1278's
FSK modem. The data is modulated as AFSK.
Other modules that can be used for RTTY:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
- SX126x/LLCC68 (only devices without TCXO!)
Other modules that can be used for RTTY:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
- SX126x/LLCC68
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -29,9 +29,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module
// this requires connection to the module direct
@ -63,7 +67,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize RTTY client
@ -81,7 +85,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
/*

View file

@ -1,35 +1,35 @@
/*
RadioLib SSTV Transmit Example
RadioLib SSTV Transmit Example
The following example sends SSTV picture using
SX1278's FSK modem.
The following example sends SSTV picture using
SX1278's FSK modem.
Other modules that can be used for SSTV:
- SX127x/RFM9x
- RF69
- SX1231
- SX126x
Other modules that can be used for SSTV:
- SX127x/RFM9x
- RF69
- SX1231
- SX126x
NOTE: SSTV is an analog modulation, and
requires precise frequency control.
Some of the above modules can only
set their frequency in rough steps,
so the result can be distorted.
Using high-precision radio with TCXO
(like SX126x) is recommended.
NOTE: SSTV is an analog modulation, and
requires precise frequency control.
Some of the above modules can only
set their frequency in rough steps,
so the result can be distorted.
Using high-precision radio with TCXO
(like SX126x) is recommended.
NOTE: Some platforms (such as Arduino Uno)
might not be fast enough to correctly
send pictures via high-speed modes
like Scottie2 or Martin2. For those,
lower speed modes such as Wrasse,
Scottie1 or Martin1 are recommended.
NOTE: Some platforms (such as Arduino Uno)
might not be fast enough to correctly
send pictures via high-speed modes
like Scottie2 or Martin2. For those,
lower speed modes such as Wrasse,
Scottie1 or Martin1 are recommended.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -42,9 +42,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create SSTV client instance using the FSK module
SSTVClient sstv(&radio);
@ -96,7 +100,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// when using one of the non-LoRa modules for SSTV
@ -113,7 +117,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// set correction factor
@ -132,7 +136,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// to help tune the receiver, SSTVClient can send
@ -141,7 +145,7 @@ void setup() {
// (SSTV header "leader tone")
/*
sstv.idle();
while(true);
while (true) { delay(10); }
*/
}

View file

@ -1,31 +1,31 @@
/*
RadioLib SSTV Transmit AFSK Example
RadioLib SSTV Transmit AFSK Example
The following example sends SSTV picture using
SX1278's FSK modem. The data is modulated
as AFSK.
The following example sends SSTV picture using
SX1278's FSK modem. The data is modulated
as AFSK.
Other modules that can be used for SSTV:
with AFSK modulation:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
- SX126x/LLCC68 (only devices without TCXO!)
Other modules that can be used for SSTV:
with AFSK modulation:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
- SX126x/LLCC68
NOTE: Some platforms (such as Arduino Uno)
might not be fast enough to correctly
send pictures via high-speed modes
like Scottie2 or Martin2. For those,
lower speed modes such as Wrasse,
Scottie1 or Martin1 are recommended.
NOTE: Some platforms (such as Arduino Uno)
might not be fast enough to correctly
send pictures via high-speed modes
like Scottie2 or Martin2. For those,
lower speed modes such as Wrasse,
Scottie1 or Martin1 are recommended.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -38,9 +38,13 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module
// this requires connection to the module direct
@ -103,7 +107,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// when using one of the non-LoRa modules for SSTV
@ -119,7 +123,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// set correction factor
@ -138,14 +142,14 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// to help tune the receiver, SSTVClient can send
// continuous 1900 Hz beep
/*
sstv.idle();
while(true);
while (true) { delay(10); }
*/
}

View file

@ -1,16 +1,16 @@
/*
RadioLib STM32WLx Channel Activity Detection Example
RadioLib STM32WLx Channel Activity Detection Example
This example uses STM32WLx to scan the current LoRa
channel and detect ongoing LoRa transmissions.
Unlike SX127x CAD, SX126x/STM32WLx can detect any part
of LoRa transmission, not just the preamble.
This example uses STM32WLx to scan the current LoRa
channel and detect ongoing LoRa transmissions.
Unlike SX127x CAD, SX126x/STM32WLx can detect any part
of LoRa transmission, not just the preamble.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -48,7 +48,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
}

View file

@ -1,16 +1,16 @@
/*
RadioLib STM32WLx Channel Activity Detection Example
RadioLib STM32WLx Channel Activity Detection Example
This example uses STM32WLx to scan the current LoRa
channel and detect ongoing LoRa transmissions.
Unlike SX127x CAD, SX126x/STM32WLx can detect any part
of LoRa transmission, not just the preamble.
This example uses STM32WLx to scan the current LoRa
channel and detect ongoing LoRa transmissions.
Unlike SX127x CAD, SX126x/STM32WLx can detect any part
of LoRa transmission, not just the preamble.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -33,6 +33,18 @@ static const Module::RfSwitchMode_t rfswitch_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() {
Serial.begin(9600);
@ -48,7 +60,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set the function that will be called
@ -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() {
// check if the flag is set
if(scanFlag) {

View file

@ -64,7 +64,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set appropriate TCXO voltage for Nucleo WL55JC1
@ -74,7 +74,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
}

View file

@ -1,26 +1,26 @@
/*
RadioLib STM32WLx Receive with Interrupts Example
RadioLib STM32WLx Receive with Interrupts Example
This example listens for LoRa transmissions and tries to
receive them. Once a packet is received, an interrupt is
triggered. To successfully receive data, the following
settings have to be the same on both transmitter
and receiver:
- carrier frequency
- bandwidth
- spreading factor
- coding rate
- sync word
This example assumes Nucleo WL55JC1 is used. For other Nucleo boards
or standalone STM32WL, some configuration such as TCXO voltage and
RF switch control may have to be adjusted.
This example listens for LoRa transmissions and tries to
receive them. Once a packet is received, an interrupt is
triggered. To successfully receive data, the following
settings have to be the same on both transmitter
and receiver:
- carrier frequency
- bandwidth
- spreading factor
- coding rate
- sync word
This example assumes Nucleo WL55JC1 is used. For other Nucleo boards
or standalone STM32WL, some configuration such as TCXO voltage and
RF switch control may have to be adjusted.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -43,6 +43,18 @@ static const Module::RfSwitchMode_t rfswitch_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() {
Serial.begin(9600);
@ -58,7 +70,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set appropriate TCXO voltage for Nucleo WL55JC1
@ -68,7 +80,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set the function that will be called
@ -83,7 +95,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// if needed, 'listen' mode can be disabled by calling
@ -97,18 +109,6 @@ void setup() {
// 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() {
// check if the flag is set
if(receivedFlag) {
@ -154,8 +154,5 @@ void loop() {
Serial.println(state);
}
// put module back to listen mode
radio.startReceive();
}
}

View file

@ -59,7 +59,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set appropriate TCXO voltage for Nucleo WL55JC1
@ -69,7 +69,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
}

View file

@ -38,6 +38,18 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
// save transmission state between loops
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() {
Serial.begin(9600);
@ -53,7 +65,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set appropriate TCXO voltage for Nucleo WL55JC1
@ -63,7 +75,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set the function that will be called
@ -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
int count = 0;

View file

@ -29,9 +29,13 @@
// RESET pin: 3
SX1231 radio = new Module(10, 2, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1231 radio = RadioShield.ModuleA;
// 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);
@ -44,7 +48,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
}

View file

@ -28,9 +28,13 @@
// RESET pin: 3
SX1231 radio = new Module(10, 2, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1231 radio = RadioShield.ModuleA;
// 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);
@ -43,7 +47,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
}

View file

@ -30,12 +30,13 @@
// BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1262 radio = RadioShield.ModuleA;
// or using CubeCell
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
// 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);
@ -48,7 +49,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
}

View file

@ -1,18 +1,18 @@
/*
RadioLib SX126x Channel Activity Detection Example
RadioLib SX126x Channel Activity Detection Example
This example uses SX1262 to scan the current LoRa
channel and detect ongoing LoRa transmissions.
Unlike SX127x CAD, SX126x can detect any part
of LoRa transmission, not just the preamble.
This example uses SX1262 to scan the current LoRa
channel and detect ongoing LoRa transmissions.
Unlike SX127x CAD, SX126x can detect any part
of LoRa transmission, not just the preamble.
Other modules from SX126x family can also be used.
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---lora-modem
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -25,12 +25,28 @@
// BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1262 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// or using CubeCell
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
// 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() {
Serial.begin(9600);
@ -43,7 +59,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set the function that will be called
@ -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() {
// check if the flag is set
if(scanFlag) {

Some files were not shown because too many files have changed in this diff Show more