Compare commits

..

262 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
257 changed files with 8711 additions and 4602 deletions

View file

@ -7,8 +7,8 @@ assignees: ''
--- ---
**IMPORTANT: Check the wiki** **IMPORTANT: Check the docs**
Before submitting new issue, please check the [Troubleshooting Guide](https://github.com/jgromes/RadioLib/wiki/Troubleshooting-Guide) Wiki page and the [API documentation](https://jgromes.github.io/RadioLib/). You might find a solution to your issue there. Before submitting new issue, please check the [Troubleshooting Guide](https://github.com/jgromes/RadioLib/wiki/Troubleshooting-Guide) Wiki page and the [API documentation](https://jgromes.github.io/RadioLib/). If you are seeing an error code, we have [online status code decoder](https://radiolib-org.github.io/status_decoder/decode.html).
**Describe the bug** **Describe the bug**
A clear and concise description of what the bug is. When applicable, please include [debug mode output](https://github.com/jgromes/RadioLib/wiki/Debug-mode) **using the appropriate debug mode**. A clear and concise description of what the bug is. When applicable, please include [debug mode output](https://github.com/jgromes/RadioLib/wiki/Debug-mode) **using the appropriate debug mode**.

View file

@ -7,8 +7,8 @@ assignees: ''
--- ---
**IMPORTANT: Check the wiki** **IMPORTANT: Check the docs**
Before submitting new issue, please check the [Troubleshooting Guide](https://github.com/jgromes/RadioLib/wiki/Troubleshooting-Guide) Wiki page and the [API documentation](https://jgromes.github.io/RadioLib/). You might find a solution to your issue there. Before submitting new issue, please check the [Troubleshooting Guide](https://github.com/jgromes/RadioLib/wiki/Troubleshooting-Guide) Wiki page and the [API documentation](https://jgromes.github.io/RadioLib/). If you are seeing an error code, we have [online status code decoder](https://radiolib-org.github.io/status_decoder/decode.html).
**Is your feature request related to a problem? Please describe.** **Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

View file

@ -9,7 +9,7 @@ assignees: ''
**IMPORTANT: Before submitting an issue, please check the following:** **IMPORTANT: Before submitting an issue, please check the following:**
1. **Read [CONTRIBUTING.md](https://github.com/jgromes/RadioLib/blob/master/CONTRIBUTING.md)!** Issues that do not follow this document will be closed/locked/deleted/ignored. 1. **Read [CONTRIBUTING.md](https://github.com/jgromes/RadioLib/blob/master/CONTRIBUTING.md)!** Issues that do not follow this document will be closed/locked/deleted/ignored.
2. RadioLib has a [Troubleshooting Guide](https://github.com/jgromes/RadioLib/wiki/Troubleshooting-Guide) Wiki page and an extensive [API documentation](https://jgromes.github.io/RadioLib/). You might find a solution to your issue there. 2. RadioLib has a [Troubleshooting Guide](https://github.com/jgromes/RadioLib/wiki/Troubleshooting-Guide) Wiki page and an extensive [API documentation](https://jgromes.github.io/RadioLib/). If you are seeing an error code, we have [online status code decoder](https://radiolib-org.github.io/status_decoder/decode.html).
3. Make sure you're using the latest release of the library! Releases can be found [here](https://github.com/jgromes/RadioLib/releases). 3. Make sure you're using the latest release of the library! Releases can be found [here](https://github.com/jgromes/RadioLib/releases).
4. Use [Arduino forums](https://forum.arduino.cc/) to ask generic questions about wireless modules, wiring, usage, etc. Only create issues for problems specific to RadioLib! 4. Use [Arduino forums](https://forum.arduino.cc/) to ask generic questions about wireless modules, wiring, usage, etc. Only create issues for problems specific to RadioLib!
5. Error codes, their meaning and how to fix them can be found on [this page](https://jgromes.github.io/RadioLib/group__status__codes.html). 5. Error codes, their meaning and how to fix them can be found on [this page](https://jgromes.github.io/RadioLib/group__status__codes.html).

View file

@ -9,7 +9,7 @@ assignees: ''
**IMPORTANT: Before submitting an issue, please check the following:** **IMPORTANT: Before submitting an issue, please check the following:**
1. **Read [CONTRIBUTING.md](https://github.com/jgromes/RadioLib/blob/master/CONTRIBUTING.md)!** Issues that do not follow this document will be closed/locked/deleted/ignored. 1. **Read [CONTRIBUTING.md](https://github.com/jgromes/RadioLib/blob/master/CONTRIBUTING.md)!** Issues that do not follow this document will be closed/locked/deleted/ignored.
2. RadioLib has a [Troubleshooting Guide](https://github.com/jgromes/RadioLib/wiki/Troubleshooting-Guide) Wiki page and an extensive [API documentation](https://jgromes.github.io/RadioLib/). You might find a solution to your issue there. 2. RadioLib has a [Troubleshooting Guide](https://github.com/jgromes/RadioLib/wiki/Troubleshooting-Guide) Wiki page and an extensive [API documentation](https://jgromes.github.io/RadioLib/). If you are seeing an error code, we have [online status code decoder](https://radiolib-org.github.io/status_decoder/decode.html).
3. Make sure you're using the latest release of the library! Releases can be found [here](https://github.com/jgromes/RadioLib/releases). 3. Make sure you're using the latest release of the library! Releases can be found [here](https://github.com/jgromes/RadioLib/releases).
4. Use [Arduino forums](https://forum.arduino.cc/) to ask generic questions about wireless modules, wiring, usage, etc. Only create issues for problems specific to RadioLib! 4. Use [Arduino forums](https://forum.arduino.cc/) to ask generic questions about wireless modules, wiring, usage, etc. Only create issues for problems specific to RadioLib!
5. Error codes, their meaning and how to fix them can be found on [this page](https://jgromes.github.io/RadioLib/group__status__codes.html). 5. Error codes, their meaning and how to fix them can be found on [this page](https://jgromes.github.io/RadioLib/group__status__codes.html).

View file

@ -54,7 +54,7 @@ jobs:
- name: Build example - name: Build example
run: run:
arduino-cli compile --libraries /home/runner/work/RadioLib --fqbn arduino:avr:uno $PWD/examples/SX126x/SX126x_Transmit_Blocking/SX126x_Transmit_Blocking.ino --warnings=all arduino-cli compile --libraries /home/runner/work/RadioLib --fqbn arduino:avr:uno $PWD/examples/SX123x/SX123x_Transmit_Blocking/SX123x_Transmit_Blocking.ino --warnings=all
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3 uses: github/codeql-action/analyze@v3

View file

@ -10,12 +10,11 @@ on:
id: id:
description: The ID of the platform on which the build is run description: The ID of the platform on which the build is run
required: true required: true
default: arduino:avr:uno default: arduino:avr:mega
type: choice type: choice
options: options:
- all - all
- none - none
- arduino:avr:uno
- arduino:avr:mega - arduino:avr:mega
- arduino:mbed:nano33ble - arduino:mbed:nano33ble
- arduino:mbed:envie_m4 - arduino:mbed:envie_m4
@ -27,7 +26,6 @@ on:
- esp32:esp32:esp32 - esp32:esp32:esp32
- esp8266:esp8266:generic - esp8266:esp8266:generic
- Intel:arc32:arduino_101 - Intel:arc32:arduino_101
- SparkFun:apollo3:sfe_artemis
- STMicroelectronics:stm32:GenF3:pnum=BLACKPILL_F303CC - STMicroelectronics:stm32:GenF3:pnum=BLACKPILL_F303CC
- STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_WL55JC1 - STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_WL55JC1
- stm32duino:STM32F1:mapleMini - stm32duino:STM32F1:mapleMini
@ -38,6 +36,7 @@ on:
- MegaCore:avr:1281 - MegaCore:avr:1281
- teensy:avr:teensy41 - teensy:avr:teensy41
- arduino:renesas_uno:minima - arduino:renesas_uno:minima
- SiliconLabs:silabs:xg24explorerkit
jobs: jobs:
build: build:
@ -45,8 +44,6 @@ jobs:
matrix: matrix:
# platform-dependent settings - extra board options, board index URLs, skip patterns etc. # platform-dependent settings - extra board options, board index URLs, skip patterns etc.
include: include:
- id: arduino:avr:uno
run: echo "skip-pattern=(STM32WL|SSTV|LoRaWAN|LR11x0_Firmware_Update|Pager|APRS|Morse)" >> $GITHUB_OUTPUT
- id: arduino:avr:mega - id: arduino:avr:mega
run: | run: |
echo "options=':cpu=atmega2560'" >> $GITHUB_OUTPUT echo "options=':cpu=atmega2560'" >> $GITHUB_OUTPUT
@ -86,19 +83,16 @@ jobs:
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
echo "options=':xtal=80,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=qio,eesz=512K'" >> $GITHUB_OUTPUT echo "options=':xtal=80,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=qio,eesz=512K'" >> $GITHUB_OUTPUT
echo "index-url=--additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json" >> $GITHUB_OUTPUT echo "index-url=--additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json" >> $GITHUB_OUTPUT
- id: SparkFun:apollo3:sfe_artemis - id: STMicroelectronics:stm32:GenF3
run: |
echo "skip-pattern=(STM32WL|LoRaWAN)" >> $GITHUB_OUTPUT
echo "warnings='none'" >> $GITHUB_OUTPUT
echo "index-url=--additional-urls https://raw.githubusercontent.com/sparkfun/Arduino_Apollo3/master/package_sparkfun_apollo3_index.json" >> $GITHUB_OUTPUT
- id: STMicroelectronics:stm32:GenF3:pnum=BLACKPILL_F303CC
run: | run: |
echo "options=':pnum=BLACKPILL_F303CC'" >> $GITHUB_OUTPUT
echo "index-url=--additional-urls https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json" >> $GITHUB_OUTPUT echo "index-url=--additional-urls https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json" >> $GITHUB_OUTPUT
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
- id: STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_WL55JC1 - id: STMicroelectronics:stm32:Nucleo_64
run: | run: |
echo "options=':pnum=NUCLEO_WL55JC1'" >> $GITHUB_OUTPUT
# Do *not* skip STM32WL examples # Do *not* skip STM32WL examples
echo "skip-pattern='LR11x0_Firmware_Update'" >> $GITHUB_OUTPUT echo "skip-pattern=(LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
echo "index-url=--additional-urls https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json" >> $GITHUB_OUTPUT echo "index-url=--additional-urls https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json" >> $GITHUB_OUTPUT
- id: stm32duino:STM32F1:mapleMini - id: stm32duino:STM32F1:mapleMini
run: | run: |
@ -127,11 +121,14 @@ jobs:
- id: arduino:renesas_uno:minima - id: arduino:renesas_uno:minima
run: | run: |
echo "skip-pattern=(STM32WL|LoRaWAN|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT echo "skip-pattern=(STM32WL|LoRaWAN|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
- id: SiliconLabs:silabs:xg24explorerkit
run: |
echo "index-url=--additional-urls https://siliconlabs.github.io/arduino/package_arduinosilabs_index.json" >> $GITHUB_OUTPUT
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: ${{ matrix.id }} name: ${{ matrix.id }}
env: env:
run-build: ${{ (inputs.id != 'none' && matrix.id == 'arduino:avr:uno') || contains(github.event.head_commit.message, 'CI_BUILD_ALL') || contains(github.event.head_commit.message, 'Bump version to') || contains(github.event.head_commit.message, format('{0}', matrix.id)) || inputs.id == 'all' || inputs.id == matrix.id }} run-build: ${{ (inputs.id != 'none' && matrix.id == 'arduino:avr:mega') || contains(github.event.head_commit.message, 'CI_BUILD_ALL') || contains(github.event.head_commit.message, 'Bump version to') || contains(github.event.head_commit.message, format('{0}', matrix.id)) || inputs.id == 'all' || inputs.id == matrix.id }}
steps: steps:
- name: Free Disk Space (Ubuntu) - name: Free Disk Space (Ubuntu)
@ -185,28 +182,64 @@ jobs:
if: ${{ env.run-build == 'true' }} if: ${{ env.run-build == 'true' }}
run: run:
| |
for example in $(find $PWD/examples -name '*.ino' | sort); do cd $PWD/extras/test/ci
# check whether to skip this sketch ./build_examples.sh ${{ matrix.id }} "${{ steps.prep.outputs.skip-pattern }}" ${{ steps.prep.outputs.options }}
if [ ! -z '${{ steps.prep.outputs.skip-pattern }}' ] && [[ ${example} =~ ${{ steps.prep.outputs.skip-pattern }} ]]; then
# skip sketch
echo -e "\n\033[1;33mSkipped ${example##*/} (matched with ${{ steps.prep.outputs.skip-pattern }})\033[0m";
else
# apply special flags for LoRaWAN
if [[ ${example} =~ "LoRaWAN" ]]; then
flags="-DRADIOLIB_LORAWAN_DEV_ADDR=0 -DRADIOLIB_LORAWAN_FNWKSINT_KEY=0 -DRADIOLIB_LORAWAN_SNWKSINT_KEY=0 -DRADIOLIB_LORAWAN_NWKSENC_KEY=0 -DRADIOLIB_LORAWAN_APPS_KEY=0 -DRADIOLIB_LORAWAN_APP_KEY=0 -DRADIOLIB_LORAWAN_NWK_KEY=0 -DRADIOLIB_LORAWAN_DEV_EUI=0 -DARDUINO_TTGO_LORA32_V1"
fi
# build sketch - name: Extract short commit hash
echo -e "\n\033[1;33mBuilding ${example##*/} ... \033[0m"; id: short-hash
arduino-cli compile --libraries /home/runner/work/RadioLib --fqbn ${{ matrix.id }}${{ steps.prep.outputs.options }} --build-property compiler.cpp.extra_flags="$flags" $example --warnings=${{ steps.prep.outputs.warnings }} run: echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
if [ $? -ne 0 ]; then
echo -e "\033[1;31m${example##*/} build FAILED\033[0m\n"; - name: Parse sizes
exit 1; if: ${{ env.run-build == 'true' }}
else run:
echo -e "\033[1;32m${example##*/} build PASSED\033[0m\n"; |
fi cd $PWD/extras/test/ci
fi ./parse_size.sh ${{ matrix.id }}
done cat size_${{ steps.short-hash.outputs.short_sha }}_${{ steps.split.outputs._0 }}-${{ steps.split.outputs._1 }}-${{ steps.split.outputs._2 }}.csv
- name: Upload size report as artifact
uses: actions/upload-artifact@v4
with:
name: size-file-${{ steps.split.outputs._0 }}-${{ steps.split.outputs._1 }}-${{ steps.split.outputs._2 }}
path: extras/test/ci/size_${{ steps.short-hash.outputs.short_sha }}_${{ steps.split.outputs._0 }}-${{ steps.split.outputs._1 }}-${{ steps.split.outputs._2 }}.csv
metrics:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master'
steps:
- name: Set up SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.ACTIONS_METRICS_DEPLOY_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Clone artifact repo
run:
|
cd $PWD/..
git clone git@github.com:radiolib-org/artifacts.git
cd artifacts
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Download size artifacts
uses: actions/download-artifact@v4
with:
path: aggregated-sizes
- name: Push size files
run:
|
ls -R aggregated-sizes
mkdir -p $PWD/../artifacts/radiolib-ci/l0
cp aggregated-sizes/*/size_*.csv $PWD/../artifacts/radiolib-ci/l0/.
cd $PWD/../artifacts/radiolib-ci
git add .
COMMIT_URL="https://github.com/jgromes/RadioLib/commit/$GITHUB_SHA"
git commit -m "Push artifacts from $COMMIT_URL"
git push origin main
esp-build: esp-build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -256,10 +289,11 @@ jobs:
run: | run: |
cd $PWD/examples/NonArduino/Tock cd $PWD/examples/NonArduino/Tock
git clone https://github.com/tock/libtock-c.git git clone https://github.com/tock/libtock-c.git
cd libtock-c; git checkout dbee65a56d74b4bad166317f199e80b959f7c82c; cd ../ cd libtock-c; git checkout c0202f9ab78da4a6e95f136cf5250701e3778f63; cd ../
LIBTOCK_C_DIRECTORY="$(pwd)/libtock-c" ./build.sh LIBTOCK_C_DIRECTORY="$(pwd)/libtock-c" ./build.sh
rpi-build: rpi-build:
if: false # self-hosted runner temporarily disabled
runs-on: [self-hosted, ARM64] runs-on: [self-hosted, ARM64]
steps: steps:
- name: Checkout repository - name: Checkout repository
@ -291,6 +325,7 @@ jobs:
./build.sh ./build.sh
rpi-test: rpi-test:
if: false # self-hosted runner temporarily disabled
needs: rpi-build needs: rpi-build
runs-on: [self-hosted, ARM64] runs-on: [self-hosted, ARM64]
steps: steps:

37
.github/workflows/release.yml vendored Normal file
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 # Jetbrain IDEs
.idea .idea
# Debug decoder
extras/decoder/log.txt
extras/decoder/out.txt
# Spectrum scan
extras/SX126x_Spectrum_Scan/out/*
# PlatformIO # PlatformIO
.pio* .pio*

View file

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

View file

@ -4,8 +4,6 @@
## Universal wireless communication library for embedded devices ## Universal wireless communication library for embedded devices
## See the [Wiki](https://github.com/jgromes/RadioLib/wiki) and [FAQ](https://github.com/jgromes/RadioLib/wiki/Frequently-Asked-Questions) for further information. See the [GitHub Pages](https://jgromes.github.io/RadioLib) for detailed and up-to-date API reference.
RadioLib allows its users to integrate all sorts of different wireless communication modules, protocols and even digital modes into a single consistent system. RadioLib allows its users to integrate all sorts of different wireless communication modules, protocols and even digital modes into a single consistent system.
Want to add a Bluetooth interface to your LoRa network? Sure thing! Do you just want to go really old-school and play around with radio teletype, slow-scan TV, or even Hellschreiber using nothing but a cheap radio module? Why not! Want to add a Bluetooth interface to your LoRa network? Sure thing! Do you just want to go really old-school and play around with radio teletype, slow-scan TV, or even Hellschreiber using nothing but a cheap radio module? Why not!
@ -13,6 +11,13 @@ RadioLib natively supports Arduino, but can run in non-Arduino environments as w
RadioLib was originally created as a driver for [__RadioShield__](https://github.com/jgromes/RadioShield), but it can be used to control as many different wireless modules as you like - or at least as many as your microcontroller can handle! RadioLib was originally created as a driver for [__RadioShield__](https://github.com/jgromes/RadioShield), but it can be used to control as many different wireless modules as you like - or at least as many as your microcontroller can handle!
### Quick links:
* [__Wiki__](https://github.com/jgromes/RadioLib/wiki) - contains useful general information on using this library
* [__FAQ__](https://github.com/jgromes/RadioLib/wiki/Frequently-Asked-Questions) - frequently asked questions, and answers
* [__API Reference__](https://jgromes.github.io/RadioLib) - full API reference, automatically generated from the source code
* [__Status Code Decoder__](https://radiolib-org.github.io/status_decoder/decode.html) - decoder for status codes returned by RadioLib methods
* [__Debug Log Decoder__](https://radiolib-org.github.io/debug_decoder/decode.html) - decoder for RadioLib SPI debug logs
### Supported modules: ### Supported modules:
* __CC1101__ FSK radio module * __CC1101__ FSK radio module
* __LLCC68__ LoRa module * __LLCC68__ LoRa module
@ -43,12 +48,13 @@ SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x, LR11x0 and
SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x and SX128x SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x and SX128x
* [__POCSAG__](https://www.sigidwiki.com/wiki/POCSAG) using 2-FSK for modules: * [__POCSAG__](https://www.sigidwiki.com/wiki/POCSAG) using 2-FSK for modules:
SX127x, RFM9x, RF69, SX1231, CC1101, nRF24L01, RFM2x and Si443x SX127x, RFM9x, RF69, SX1231, CC1101, nRF24L01, RFM2x and Si443x
* [__LoRaWAN__](https://lora-alliance.org/) using LoRa for modules: * [__LoRaWAN__](https://lora-alliance.org/) using LoRa and FSK for modules:
SX127x, RFM9x, SX126x, LR11x0 and SX128x SX127x, RFM9x, SX126x, LR11x0 and SX128x
### Supported Arduino platforms: ### Supported Arduino platforms:
* __Arduino__ * __Arduino__
* [__AVR__](https://github.com/arduino/ArduinoCore-avr) - Arduino Uno, Mega, Leonardo, Pro Mini, Nano etc. * [__AVR__](https://github.com/arduino/ArduinoCore-avr) - Arduino Uno, Mega, Leonardo, Pro Mini, Nano etc.
* NOTE: Arduino boards based on ATmega328 (Uno, Pro Mini, Nano etc.) and smaller are NOT recommended. This is because the ATmega328 MCU is very constrained in terms of program and memory size, so the library will end up taking most of the space available.
* [__mbed__](https://github.com/arduino/ArduinoCore-mbed) - Arduino Nano 33 BLE and Arduino Portenta H7 * [__mbed__](https://github.com/arduino/ArduinoCore-mbed) - Arduino Nano 33 BLE and Arduino Portenta H7
* [__megaAVR__](https://github.com/arduino/ArduinoCore-megaavr) - Arduino Uno WiFi Rev.2 and Nano Every * [__megaAVR__](https://github.com/arduino/ArduinoCore-megaavr) - Arduino Uno WiFi Rev.2 and Nano Every
* [__SAM__](https://github.com/arduino/ArduinoCore-sam) - Arduino Due * [__SAM__](https://github.com/arduino/ArduinoCore-sam) - Arduino Due
@ -88,4 +94,7 @@ SX127x, RFM9x, SX126x, LR11x0 and SX128x
* __PJRC__ * __PJRC__
* [__Teensy__](https://github.com/PaulStoffregen/cores) - Teensy 2.x, 3.x and 4.x boards * [__Teensy__](https://github.com/PaulStoffregen/cores) - Teensy 2.x, 3.x and 4.x boards
* __Silicon Labs__
* [__EFR32__](https://github.com/SiliconLabs/arduino) - Silicon Labs xG24, xG27 and other boards
The list above is by no means exhaustive - RadioLib code is independent of the used platform! Compilation of all examples is tested for all platforms officially supported prior to releasing new version. In addition, RadioLib includes an internal hardware abstraction layer, which allows it to be easily ported even to non-Arduino environments. The list above is by no means exhaustive - RadioLib code is independent of the used platform! Compilation of all examples is tested for all platforms officially supported prior to releasing new version. In addition, RadioLib includes an internal hardware abstraction layer, which allows it to be easily ported even to non-Arduino environments.

View file

@ -35,9 +35,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// this requires connection to the module direct // this requires connection to the module direct

View file

@ -35,9 +35,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// this requires connection to the module direct // this requires connection to the module direct
@ -105,32 +109,49 @@ void setup() {
} }
void loop() { void loop() {
Serial.print(F("[APRS] Sending position ... ")); Serial.println(F("[APRS] Sending location reports"));
// send a location without message or timestamp // send a location without message or timestamp
char destination[] = "N0CALL"; char destination[] = "N0CALL";
char latitude[] = "4911.67N"; char latitude[] = "4911.67N";
char longitude[] = "01635.96E"; char longitude[] = "01635.96E";
int state = aprs.sendPosition(destination, 0, latitude, longitude); int state = aprs.sendPosition(destination, 0, latitude, longitude);
if(state != RADIOLIB_ERR_NONE) {
Serial.print(F("[APRS] Failed to send location, code "));
Serial.println(state);
}
delay(500); delay(500);
// send a location with message and without timestamp // send a location with message and without timestamp
char message[] = "I'm here!"; char message[] = "I'm here!";
state |= aprs.sendPosition(destination, 0, latitude, longitude, message); state = aprs.sendPosition(destination, 0, latitude, longitude, message);
if(state != RADIOLIB_ERR_NONE) {
Serial.print(F("[APRS] Failed to send location and message code "));
Serial.println(state);
}
delay(500); delay(500);
// you can also set repeater callsigns and SSIDs
// up to 8 repeaters may be used
// sendPosition will be sent with "WIDE2-2" path
char* repeaterCallsigns[] = { "WIDE2" };
uint8_t repeaterSSIDs[] = { 2 };
aprs.useRepeaters(repeaterCallsigns, repeaterSSIDs, 1);
// send a location with message and timestamp // send a location with message and timestamp
char timestamp[] = "093045z"; char timestamp[] = "093045z";
state |= aprs.sendPosition(destination, 0, latitude, longitude, message, timestamp); state = aprs.sendPosition(destination, 0, latitude, longitude, message, timestamp);
delay(500); if(state != RADIOLIB_ERR_NONE) {
Serial.print(F("[APRS] Failed to send location, message and timestamp code "));
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state); Serial.println(state);
} }
delay(500);
// when repeaters are no longer needed, they can be dropped
aprs.dropRepeaters();
// wait one minute before transmitting again // wait one minute before transmitting again
Serial.println(F("[APRS] All done!"));
delay(60000); delay(60000);
} }

View file

@ -27,9 +27,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create APRS client instance using the LoRa radio // create APRS client instance using the LoRa radio
APRSClient aprs(&radio); APRSClient aprs(&radio);

View file

@ -38,9 +38,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AX.25 client instance using the FSK module // create AX.25 client instance using the FSK module
AX25Client ax25(&radio); AX25Client ax25(&radio);

View file

@ -31,9 +31,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AX.25 client instance using the FSK module // create AX.25 client instance using the FSK module
AX25Client ax25(&radio); AX25Client ax25(&radio);

View file

@ -32,9 +32,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// this requires connection to the module direct // this requires connection to the module direct

View file

@ -24,9 +24,13 @@
// GDO2 pin: 3 (optional) // GDO2 pin: 3 (optional)
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3); CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//CC1101 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -31,9 +31,13 @@
// GDO2 pin: 3 (optional) // GDO2 pin: 3 (optional)
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3); CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//CC1101 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -29,9 +29,28 @@
// GDO2 pin: 3 (optional) // GDO2 pin: 3 (optional)
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3); CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//CC1101 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// flag to indicate that a packet was received
volatile bool receivedFlag = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we got a packet, set the flag
receivedFlag = true;
}
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@ -72,21 +91,6 @@ void setup() {
// radio.readData(); // radio.readData();
} }
// flag to indicate that a packet was received
volatile bool receivedFlag = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we got a packet, set the flag
receivedFlag = true;
}
void loop() { void loop() {
// check if the flag is set // check if the flag is set
if(receivedFlag) { if(receivedFlag) {

View file

@ -35,9 +35,13 @@ CC1101 radio1 = new Module(10, 2, RADIOLIB_NC, 3);
// GDO2 pin: 5 (optional) // GDO2 pin: 5 (optional)
CC1101 radio2 = new Module(9, 4, RADIOLIB_NC, 5); CC1101 radio2 = new Module(9, 4, RADIOLIB_NC, 5);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//CC1101 radio3 = RadioShield.ModuleB; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio3 = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -24,9 +24,13 @@
// GDO2 pin: 3 (optional) // GDO2 pin: 3 (optional)
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3); CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//CC1101 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@ -78,10 +82,11 @@ void setup() {
void loop() { void loop() {
Serial.print(F("[CC1101] Transmitting packet ... ")); Serial.print(F("[CC1101] Transmitting packet ... "));
// you can transmit C-string or Arduino string up to 63 characters long // you can transmit C-string or Arduino string up to 255 characters long
int state = radio.transmit("Hello World!"); int state = radio.transmit("Hello World!");
// you can also transmit byte array up to 63 bytes long // you can also transmit byte array up to 255 bytes long
// With some limitations see here: https://github.com/jgromes/RadioLib/discussions/1138
/* /*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}; byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
int state = radio.transmit(byteArr, 8); int state = radio.transmit(byteArr, 8);

View file

@ -2,7 +2,7 @@
RadioLib CC1101 Blocking Transmit Example RadioLib CC1101 Blocking Transmit Example
This example transmits packets using CC1101 FSK radio module. This example transmits packets using CC1101 FSK radio module.
Each packet contains up to 64 bytes of data, in the form of: Each packet contains up to 255 bytes of data with some limitations (https://github.com/jgromes/RadioLib/discussions/1138), in the form of:
- Arduino String - Arduino String
- null-terminated char array (C-string) - null-terminated char array (C-string)
- arbitrary binary data (byte array) - arbitrary binary data (byte array)
@ -28,9 +28,13 @@
// GDO2 pin: 3 // GDO2 pin: 3
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3); CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//CC1101 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@ -53,11 +57,11 @@ int count = 0;
void loop() { void loop() {
Serial.print(F("[CC1101] Transmitting packet ... ")); Serial.print(F("[CC1101] Transmitting packet ... "));
// you can transmit C-string or Arduino string up to 63 characters long // you can transmit C-string or Arduino string up to 255 characters long
String str = "Hello World! #" + String(count++); String str = "Hello World! #" + String(count++);
int state = radio.transmit(str); int state = radio.transmit(str);
// you can also transmit byte array up to 63 bytes long // you can also transmit byte array up to 255 bytes long with some limitations; https://github.com/jgromes/RadioLib/discussions/1138
/* /*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}; byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
int state = radio.transmit(byteArr, 8); int state = radio.transmit(byteArr, 8);
@ -68,7 +72,7 @@ void loop() {
Serial.println(F("success!")); Serial.println(F("success!"));
} else if (state == RADIOLIB_ERR_PACKET_TOO_LONG) { } else if (state == RADIOLIB_ERR_PACKET_TOO_LONG) {
// the supplied packet was longer than 64 bytes // the supplied packet was longer than 255 bytes
Serial.println(F("too long!")); Serial.println(F("too long!"));
} else { } else {

View file

@ -3,7 +3,7 @@
This example transmits packets using CC1101 FSK radio module. This example transmits packets using CC1101 FSK radio module.
Once a packet is transmitted, an interrupt is triggered. Once a packet is transmitted, an interrupt is triggered.
Each packet contains up to 64 bytes of data, in the form of: Each packet contains up to 255 bytes of data with some limitations (https://github.com/jgromes/RadioLib/discussions/1138), in the form of:
- Arduino String - Arduino String
- null-terminated char array (C-string) - null-terminated char array (C-string)
- arbitrary binary data (byte array) - arbitrary binary data (byte array)
@ -25,13 +25,32 @@
// GDO2 pin: 3 // GDO2 pin: 3
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3); CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//CC1101 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// save transmission state between loops // save transmission state between loops
int transmissionState = RADIOLIB_ERR_NONE; int transmissionState = RADIOLIB_ERR_NONE;
// flag to indicate that a packet was sent
volatile bool transmittedFlag = false;
// this function is called when a complete packet
// is transmitted by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we sent a packet, set the flag
transmittedFlag = true;
}
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@ -54,10 +73,12 @@ void setup() {
Serial.print(F("[CC1101] Sending first packet ... ")); Serial.print(F("[CC1101] Sending first packet ... "));
// you can transmit C-string or Arduino string up to // you can transmit C-string or Arduino string up to
// 64 characters long // 255 characters long
transmissionState = radio.startTransmit("Hello World!"); transmissionState = radio.startTransmit("Hello World!");
// you can also transmit byte array up to 64 bytes long // you can also transmit byte array up to 255 bytes long
// When transmitting more than 64 bytes startTransmit blocks to refill the FIFO.
// Blocking ceases once the last bytes have been placed in the FIFO
/* /*
byte byteArr[] = {0x01, 0x23, 0x45, 0x56, byte byteArr[] = {0x01, 0x23, 0x45, 0x56,
0x78, 0xAB, 0xCD, 0xEF}; 0x78, 0xAB, 0xCD, 0xEF};
@ -65,21 +86,6 @@ void setup() {
*/ */
} }
// flag to indicate that a packet was sent
volatile bool transmittedFlag = false;
// this function is called when a complete packet
// is transmitted by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we sent a packet, set the flag
transmittedFlag = true;
}
// counter to keep track of transmitted packets // counter to keep track of transmitted packets
int count = 0; int count = 0;
@ -115,11 +121,11 @@ void loop() {
Serial.print(F("[CC1101] Sending another packet ... ")); Serial.print(F("[CC1101] Sending another packet ... "));
// you can transmit C-string or Arduino string up to // you can transmit C-string or Arduino string up to
// 256 characters long // 255 characters long
String str = "Hello World! #" + String(count++); String str = "Hello World! #" + String(count++);
transmissionState = radio.startTransmit(str); transmissionState = radio.startTransmit(str);
// you can also transmit byte array up to 256 bytes long // you can also transmit byte array up to 255 bytes long with limitations https://github.com/jgromes/RadioLib/discussions/1138
/* /*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67, byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF}; 0x89, 0xAB, 0xCD, 0xEF};

View file

@ -34,9 +34,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create FSK4 client instance using the FSK module // create FSK4 client instance using the FSK module
FSK4Client fsk4(&radio); FSK4Client fsk4(&radio);

View file

@ -32,9 +32,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// this requires connection to the module direct // this requires connection to the module direct

View file

@ -32,9 +32,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create Hellschreiber client instance using the FSK module // create Hellschreiber client instance using the FSK module
HellClient hell(&radio); HellClient hell(&radio);

View file

@ -31,9 +31,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// this requires connection to the module direct // this requires connection to the module direct

View file

@ -34,6 +34,14 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110 // set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching // Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different! // NOTE: other boards may be different!
@ -57,10 +65,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@ -71,6 +75,9 @@ void setup() {
Serial.println(state); Serial.println(state);
while (true) { delay(10); } while (true) { delay(10); }
} }
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
} }
void loop() { void loop() {

View file

@ -29,6 +29,14 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110 // set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching // Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different! // NOTE: other boards may be different!
@ -49,13 +57,24 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
END_OF_MODE_TABLE, END_OF_MODE_TABLE,
}; };
// flag to indicate that a packet was detected or CAD timed out
volatile bool scanFlag = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// something happened, set the flag
scanFlag = true;
}
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@ -67,6 +86,9 @@ void setup() {
while (true) { delay(10); } while (true) { delay(10); }
} }
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// set the function that will be called // set the function that will be called
// when LoRa packet or timeout is detected // when LoRa packet or timeout is detected
radio.setIrqAction(setFlag); radio.setIrqAction(setFlag);
@ -82,21 +104,6 @@ void setup() {
} }
} }
// flag to indicate that a packet was detected or CAD timed out
volatile bool scanFlag = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// something happened, set the flag
scanFlag = true;
}
void loop() { void loop() {
// check if the flag is set // check if the flag is set
if(scanFlag) { if(scanFlag) {

View file

@ -48,9 +48,13 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//LR1110 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -26,9 +26,13 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//LR1110 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

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

@ -27,9 +27,13 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//LR1110 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@ -58,7 +62,8 @@ void setup() {
3, // header count 3, // header count
0x13A); // hopping sequence seed 0x13A); // hopping sequence seed
state = radio.setOutputPower(10.0); state = radio.setOutputPower(10.0);
state = radio.setSyncWord(0x12345678); uint8_t syncWord[] = {0x01, 0x23, 0x45, 0x67};
state = radio.setSyncWord(syncWord, 4);
if (state != RADIOLIB_ERR_NONE) { if (state != RADIOLIB_ERR_NONE) {
Serial.print(F("Unable to set configuration, code ")); Serial.print(F("Unable to set configuration, code "));
Serial.println(state); Serial.println(state);

View file

@ -22,6 +22,14 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110 // set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching // Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different! // NOTE: other boards may be different!
@ -66,10 +74,6 @@ void setFlag(void) {
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@ -81,6 +85,9 @@ void setup() {
while (true) { delay(10); } while (true) { delay(10); }
} }
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// set the function that will be called // set the function that will be called
// when new packet is received // when new packet is received
radio.setIrqAction(setFlag); radio.setIrqAction(setFlag);

View file

@ -39,6 +39,14 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110 // set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching // Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different! // NOTE: other boards may be different!
@ -62,10 +70,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@ -76,6 +80,9 @@ void setup() {
Serial.println(state); Serial.println(state);
while (true) { delay(10); } while (true) { delay(10); }
} }
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
} }
void loop() { void loop() {

View file

@ -35,6 +35,14 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110 // set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching // Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different! // NOTE: other boards may be different!
@ -55,13 +63,24 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
END_OF_MODE_TABLE, END_OF_MODE_TABLE,
}; };
// flag to indicate that a packet was received
volatile bool receivedFlag = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we got a packet, set the flag
receivedFlag = true;
}
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@ -73,6 +92,9 @@ void setup() {
while (true) { delay(10); } while (true) { delay(10); }
} }
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// set the function that will be called // set the function that will be called
// when new packet is received // when new packet is received
radio.setPacketReceivedAction(setFlag); radio.setPacketReceivedAction(setFlag);
@ -98,21 +120,6 @@ void setup() {
// radio.scanChannel(); // radio.scanChannel();
} }
// flag to indicate that a packet was received
volatile bool receivedFlag = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we got a packet, set the flag
receivedFlag = true;
}
void loop() { void loop() {
// check if the flag is set // check if the flag is set
if(receivedFlag) { if(receivedFlag) {

View file

@ -30,6 +30,14 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110 // set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching // Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different! // NOTE: other boards may be different!
@ -53,10 +61,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@ -68,6 +72,9 @@ void setup() {
delay(1000); delay(1000);
while (true) { delay(10); } while (true) { delay(10); }
} }
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
} }
// counter to keep track of transmitted packets // counter to keep track of transmitted packets

View file

@ -31,6 +31,14 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110 // set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching // Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different! // NOTE: other boards may be different!
@ -54,13 +62,24 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
// save transmission state between loops // save transmission state between loops
int transmissionState = RADIOLIB_ERR_NONE; int transmissionState = RADIOLIB_ERR_NONE;
// flag to indicate that a packet was sent
volatile bool transmittedFlag = false;
// this function is called when a complete packet
// is transmitted by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we sent a packet, set the flag
transmittedFlag = true;
}
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@ -72,6 +91,9 @@ void setup() {
while (true) { delay(10); } while (true) { delay(10); }
} }
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// set the function that will be called // set the function that will be called
// when packet transmission is finished // when packet transmission is finished
radio.setPacketSentAction(setFlag); radio.setPacketSentAction(setFlag);
@ -91,21 +113,6 @@ void setup() {
*/ */
} }
// flag to indicate that a packet was sent
volatile bool transmittedFlag = false;
// this function is called when a complete packet
// is transmitted by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we sent a packet, set the flag
transmittedFlag = true;
}
// counter to keep track of transmitted packets // counter to keep track of transmitted packets
int count = 0; int count = 0;

View file

@ -32,6 +32,14 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110 // set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching // Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different! // NOTE: other boards may be different!
@ -55,10 +63,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@ -69,6 +73,9 @@ void setup() {
Serial.println(state); Serial.println(state);
while (true) { delay(10); } while (true) { delay(10); }
} }
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
} }
void loop() { void loop() {

View file

@ -32,6 +32,14 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110 // set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching // Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different! // NOTE: other boards may be different!
@ -52,13 +60,23 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
END_OF_MODE_TABLE, END_OF_MODE_TABLE,
}; };
// flag to indicate that a scan was completed
volatile bool scanFlag = false;
// this function is called when a scan is completed
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// scan is complete, set the flag
scanFlag = true;
}
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@ -70,6 +88,9 @@ void setup() {
while (true) { delay(10); } while (true) { delay(10); }
} }
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// set the function that will be called // set the function that will be called
// when WiFi scan is complete // when WiFi scan is complete
radio.setIrqAction(setFlag); radio.setIrqAction(setFlag);
@ -85,20 +106,6 @@ void setup() {
} }
} }
// flag to indicate that a scan was completed
volatile bool scanFlag = false;
// this function is called when a scan is completed
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// scan is complete, set the flag
scanFlag = true;
}
void loop() { void loop() {
// check if the flag is set // check if the flag is set
if(scanFlag) { if(scanFlag) {

View file

@ -41,9 +41,11 @@ const uint32_t uplinkIntervalSeconds = 5UL * 60UL; // minutes x seconds
// for the curious, the #ifndef blocks allow for automated testing &/or you can // for the curious, the #ifndef blocks allow for automated testing &/or you can
// put your EUI & keys in to your platformio.ini - see wiki for more tips // put your EUI & keys in to your platformio.ini - see wiki for more tips
// regional choices: EU868, US915, AU915, AS923, AS923_2, AS923_3, AS923_4, IN865, KR920, CN500 // regional choices: EU868, US915, AU915, AS923, AS923_2, AS923_3, AS923_4, IN865, KR920, CN470
const LoRaWANBand_t Region = EU868; const LoRaWANBand_t Region = EU868;
const uint8_t subBand = 0; // For US915, change this to 2, otherwise leave on 0
// subband choice: for US915/AU915 set to 2, for CN470 set to 1, otherwise leave on 0
const uint8_t subBand = 0;
// ============================================================================ // ============================================================================
// Below is to support the sketch - only make changes if the notes say so ... // Below is to support the sketch - only make changes if the notes say so ...

View file

@ -48,6 +48,9 @@ void setup() {
// Override the default join rate // Override the default join rate
uint8_t joinDR = 4; uint8_t joinDR = 4;
// Optionally provide a custom sleep function - see config.h
//node.setSleepFunction(customDelay);
// Setup the OTAA session information // Setup the OTAA session information
node.beginOTAA(joinEUI, devEUI, nwkKey, appKey); node.beginOTAA(joinEUI, devEUI, nwkKey, appKey);
@ -68,7 +71,7 @@ void setup() {
// Manages uplink intervals to the TTN Fair Use Policy // Manages uplink intervals to the TTN Fair Use Policy
node.setDutyCycle(true, 1250); node.setDutyCycle(true, 1250);
// Enable the dwell time limits - 400ms is the limit for the US // Update dwell time limits - 400ms is the limit for the US
node.setDwellTime(true, 400); node.setDwellTime(true, 400);
Serial.println(F("Ready!\n")); Serial.println(F("Ready!\n"));

View file

@ -37,9 +37,11 @@ const uint32_t uplinkIntervalSeconds = 5UL * 60UL; // minutes x seconds
// for the curious, the #ifndef blocks allow for automated testing &/or you can // for the curious, the #ifndef blocks allow for automated testing &/or you can
// put your EUI & keys in to your platformio.ini - see wiki for more tips // put your EUI & keys in to your platformio.ini - see wiki for more tips
// regional choices: EU868, US915, AU915, AS923, AS923_2, AS923_3, AS923_4, IN865, KR920, CN500 // regional choices: EU868, US915, AU915, AS923, AS923_2, AS923_3, AS923_4, IN865, KR920, CN470
const LoRaWANBand_t Region = EU868; const LoRaWANBand_t Region = EU868;
const uint8_t subBand = 0; // For US915, change this to 2, otherwise leave on 0
// subband choice: for US915/AU915 set to 2, for CN470 set to 1, otherwise leave on 0
const uint8_t subBand = 0;
// ============================================================================ // ============================================================================
// Below is to support the sketch - only make changes if the notes say so ... // Below is to support the sketch - only make changes if the notes say so ...
@ -142,4 +144,19 @@ void arrayDump(uint8_t *buffer, uint16_t len) {
Serial.println(); Serial.println();
} }
// Custom delay function:
// Communication over LoRaWAN includes a lot of delays.
// By default, RadioLib will use the Arduino delay() function,
// which will waste a lot of power. However, you can put your
// microcontroller to sleep instead by customizing the function below,
// and providing it to RadioLib via "node.setSleepFunction".
// NOTE: You ahve to ensure that this function is timed precisely, and
// does actually wait for the amount of time specified!
// Failure to do so will result in missed downlinks or failed join!
void customDelay(RadioLibTime_t ms) {
// this is just an example, so we use the Arduino delay() function,
// but you can put your microcontroller to sleep here
::delay(ms);
}
#endif #endif

View file

@ -37,9 +37,11 @@ const uint32_t uplinkIntervalSeconds = 5UL * 60UL; // minutes x seconds
// for the curious, the #ifndef blocks allow for automated testing &/or you can // for the curious, the #ifndef blocks allow for automated testing &/or you can
// put your EUI & keys in to your platformio.ini - see wiki for more tips // put your EUI & keys in to your platformio.ini - see wiki for more tips
// regional choices: EU868, US915, AU915, AS923, AS923_2, AS923_3, AS923_4, IN865, KR920, CN500 // regional choices: EU868, US915, AU915, AS923, AS923_2, AS923_3, AS923_4, IN865, KR920, CN470
const LoRaWANBand_t Region = EU868; const LoRaWANBand_t Region = EU868;
const uint8_t subBand = 0; // For US915, change this to 2, otherwise leave on 0
// subband choice: for US915/AU915 set to 2, for CN470 set to 1, otherwise leave on 0
const uint8_t subBand = 0;
// ============================================================================ // ============================================================================
// Below is to support the sketch - only make changes if the notes say so ... // Below is to support the sketch - only make changes if the notes say so ...

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 the Frequency plan appropriate for your region. Consider that almost all countries have laws relating to what frequencies you use so don't get creative. For Europe please use the recommended option. For other regions use the entry marked 'used by TTN'.
Choose LoRaWAN 1.1.0 - the last one in the list - the latest specfication. RadioLib uses RP001 Regional Parameters 1.1 revision A. Choose LoRaWAN 1.1.0 - the last one in the list - the latest specfication. RadioLib uses RP001 Regional Parameters 1.1 revision B.
At this point you will be asked for your JoinEUI. As this is a DIY device and we are using RadioLib, you can use all zero's as recommended by The LoRa Alliance TR007 Technical Recommendations document. Once you've put in all zeros and clicked confirm you will be asked for a DevEUI, AppKey and NwkKey. It is preferable to have the console generate them so they are properly formatted. At this point you will be asked for your JoinEUI. As this is a DIY device and we are using RadioLib, you can use all zero's as recommended by The LoRa Alliance TR007 Technical Recommendations document. Once you've put in all zeros and clicked confirm you will be asked for a DevEUI, AppKey and NwkKey. It is preferable to have the console generate them so they are properly formatted.

View file

@ -6,17 +6,17 @@ RadioLib LoRaWAN examples.
* [LoRaWAN_ABP](https://github.com/jgromes/RadioLib/tree/master/examples/LoRaWAN/LoRaWAN_ABP): if you wish to use ABP instead of OTAA (but why?), this example shows how you can do this using RadioLib. * [LoRaWAN_ABP](https://github.com/jgromes/RadioLib/tree/master/examples/LoRaWAN/LoRaWAN_ABP): if you wish to use ABP instead of OTAA (but why?), this example shows how you can do this using RadioLib.
## LoRaWAN versions & regional parameters ## LoRaWAN versions & regional parameters
RadioLib implements both LoRaWAN v1.1 and v1.0.4. Confusingly, v1.0.4 is newer than v1.1, but v1.1 includes more security checks and as such **LoRaWAN v1.1 is preferred**. RadioLib implements both LoRaWAN Specification 1.1 and 1.0.4. Confusingly, 1.0.4 is newer than 1.1, but 1.1 includes more security checks and as such **LoRaWAN 1.1 is preferred**.
The catch is in the Regional Parameters: as v1.0.4 is newer, it is more up to date regarding local laws & regulations. Therefore, RadioLib implements 1.0.4 as baseline and 1.1 as fallback, but **Regional Parameters v1.0.4 is preferred**. The catch is in the Regional Parameters: as RP002 1.0.4 is newer than RP001 1.1, it is more up to date regarding local laws & regulations. Therefore, RadioLib implements 1.0.4 as baseline and 1.1 (revision B) as fallback, and as such **RP002 Regional Parameters 1.0.4 is preferred**.
_Note: the CN500 band is implemented as specified in RP v1.1, as the RP v1.0.4 version is much too complex._ _Note: the CN470 band is implemented as specified in RP001 1.1 revision B, as the RP002 1.0.4 version is much too complex._
To activate a LoRaWAN v1.1 session, supply all the required keys: To activate a LoRaWAN 1.1 session, supply all the required keys:
```cpp ```cpp
node.beginOTAA(joinEUI, devEUI, nwkKey, appKey); node.beginOTAA(joinEUI, devEUI, nwkKey, appKey);
node.beginABP(devAddr, fNwkSIntKey, sNwkSIntKey, nwkSEncKey, appSKey); node.beginABP(devAddr, fNwkSIntKey, sNwkSIntKey, nwkSEncKey, appSKey);
``` ```
To activate a LoRaWAN v1.0.4 session, set the keys that are not available to `NULL`: To activate a LoRaWAN 1.0.4 session, set the keys that are not available to `NULL`:
```cpp ```cpp
node.beginOTAA(joinEUI, devEUI, NULL, appKey); node.beginOTAA(joinEUI, devEUI, NULL, appKey);
node.beginABP(devAddr, NULL, NULL, nwkSEncKey, appSKey); node.beginABP(devAddr, NULL, NULL, nwkSEncKey, appSKey);
@ -26,9 +26,9 @@ The device doesn't need to know the Regional Parameters version - that is of imp
## LoRaWAN persistence ## LoRaWAN persistence
> [!WARNING] > [!WARNING]
> These examples do not actually comply with LoRaWAN v1.0.4/v1.1: for that, persistent storage is necessary. As the implementation of persistent storage differs between different platforms, these are not given here, but in a separate repository, see below: > These examples do not actually comply with LoRaWAN 1.0.4/1.1: for that, persistent storage is necessary. As the implementation of persistent storage differs between different platforms, these are not given here, but in a separate repository, see below:
In [this repository](https://github.com/radiolib-org/radiolib-persistence), examples are provided that do comply with the required persistence of certain parameters for LoRaWAN v1.1. Examples are (or will become) available for some of the most popular platforms. **These examples assume you have successfully used the Starter sketch and understood (most of) the accompanying notes!** In [this repository](https://github.com/radiolib-org/radiolib-persistence), examples are provided that do comply with the required persistence of certain parameters for LoRaWAN 1.1. Examples are (or will become) available for some of the most popular platforms. **These examples assume you have successfully used the Starter sketch and understood (most of) the accompanying notes!**
Currently, examples are available for the following platforms: Currently, examples are available for the following platforms:
* [LoRaWAN for ESP32](https://github.com/radiolib-org/radiolib-persistence/tree/main/examples/LoRaWAN_ESP32) * [LoRaWAN for ESP32](https://github.com/radiolib-org/radiolib-persistence/tree/main/examples/LoRaWAN_ESP32)

View file

@ -30,9 +30,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// pin 5 is connected to SX1278 DIO2 // pin 5 is connected to SX1278 DIO2

View file

@ -30,9 +30,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// pin 5 is connected to SX1278 DIO2 // pin 5 is connected to SX1278 DIO2

View file

@ -31,9 +31,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// this requires connection to the module direct // this requires connection to the module direct

View file

@ -33,9 +33,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create Morse client instance using the FSK module // create Morse client instance using the FSK module
MorseClient morse(&radio); MorseClient morse(&radio);

View file

@ -7,7 +7,7 @@
// this example only works on ESP32 and is unlikely to work on ESP32S2/S3 etc. // this example only works on ESP32 and is unlikely to work on ESP32S2/S3 etc.
// if you need high portability, you should probably use Arduino anyway ... // if you need high portability, you should probably use Arduino anyway ...
#if CONFIG_IDF_TARGET_ESP32 == 0 #if CONFIG_IDF_TARGET_ESP32 == 0
#error Target is not ESP32! #error This example HAL only supports ESP32 targets. Support for ESP32S2/S3 etc. can be added by adjusting this file to user needs.
#endif #endif
// include all the dependencies // include all the dependencies

View file

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

View file

@ -18,7 +18,7 @@
#include <RadioLib.h> #include <RadioLib.h>
// include the hardware abstraction layer // include the hardware abstraction layer
#include "PiHal.h" #include "hal/RPi/PiHal.h"
// create a new instance of the HAL class // create a new instance of the HAL class
// use SPI channel 1, because on Waveshare LoRaWAN Hat, // use SPI channel 1, because on Waveshare LoRaWAN Hat,

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 # The build system for libtock-c is a bit odd and the version of libraries
# built changes based on compiler version. # built changes based on compiler version.
if (RISCV_BUILD) if (RISCV_BUILD)
if(EXISTS "$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-13.2.0") if(EXISTS "$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-14.1.0")
target_link_libraries(${PROJECT_NAME} PUBLIC
RadioLib
$ENV{LIBTOCK_C_DIRECTORY}/libtock/build/rv32imc/libtock.a
$ENV{LIBTOCK_C_DIRECTORY}/libtock-sync/build/rv32imc/libtocksync.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-14.1.0/riscv/lib/gcc/riscv64-unknown-elf/14.1.0/rv32i/ilp32/libgcc.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-14.1.0/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libstdc++.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.4.0.20231231/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libc.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.4.0.20231231/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libm.a
)
target_include_directories(RadioLib AFTER PUBLIC
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.3.0.20230120/riscv/riscv64-unknown-elf/include/
)
elseif(EXISTS "$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-13.2.0")
target_link_libraries(${PROJECT_NAME} PUBLIC target_link_libraries(${PROJECT_NAME} PUBLIC
RadioLib RadioLib
$ENV{LIBTOCK_C_DIRECTORY}/libtock/build/rv32imc/libtock.a $ENV{LIBTOCK_C_DIRECTORY}/libtock/build/rv32imc/libtock.a
@ -80,7 +94,17 @@ if (RISCV_BUILD)
) )
endif() endif()
else() else()
if(EXISTS "$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-13.2.0") if (EXISTS "$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-14.1.0")
target_link_libraries(${PROJECT_NAME} PUBLIC
RadioLib
$ENV{LIBTOCK_C_DIRECTORY}/libtock/build/cortex-m4/libtock.a
$ENV{LIBTOCK_C_DIRECTORY}/libtock-sync/build/cortex-m4/libtocksync.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-14.1.0/arm/lib/gcc/arm-none-eabi/14.1.0/libgcc.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-14.1.0/arm/arm-none-eabi/lib/libstdc++.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.4.0.20231231/arm/arm-none-eabi/lib/libc.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.4.0.20231231/arm/arm-none-eabi/lib/libm.a
)
elseif(EXISTS "$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-13.2.0")
target_link_libraries(${PROJECT_NAME} PUBLIC target_link_libraries(${PROJECT_NAME} PUBLIC
RadioLib RadioLib
$ENV{LIBTOCK_C_DIRECTORY}/libtock/build/cortex-m4/libtock.a $ENV{LIBTOCK_C_DIRECTORY}/libtock/build/cortex-m4/libtock.a

View file

@ -23,7 +23,7 @@ The RadioLib example can be built with:
$ git clone https://github.com/jgromes/RadioLib.git $ git clone https://github.com/jgromes/RadioLib.git
$ cd RadioLib/examples/NonArduino/Tock/ $ cd RadioLib/examples/NonArduino/Tock/
$ git clone https://github.com/tock/libtock-c.git $ git clone https://github.com/tock/libtock-c.git
$ cd libtock-c; git checkout dbee65a56d74b4bad166317f199e80b959f7c82c; cd ../ $ cd libtock-c; git checkout c0202f9ab78da4a6e95f136cf5250701e3778f63; cd ../
$ LIBTOCK_C_DIRECTORY="$(pwd)/libtock-c" ./build.sh $ LIBTOCK_C_DIRECTORY="$(pwd)/libtock-c" ./build.sh
``` ```

View file

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

View file

@ -1,225 +0,0 @@
/*
RadioLib Non-Arduino Tock Library helper functions
Licensed under the MIT License
Copyright (c) 2023 Alistair Francis <alistair@alistair23.me>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef TOCK_HAL_H
#define TOCK_HAL_H
// include RadioLib
#include <RadioLib.h>
// include all the dependencies
#include "libtock/net/lora_phy.h"
#include "libtock/net/syscalls/lora_phy_syscalls.h"
#include "libtock-sync/net/lora_phy.h"
#include "libtock/peripherals/gpio.h"
#include "libtock-sync/services/alarm.h"
#include "libtock/kernel/read_only_state.h"
#define RADIO_BUSY 1
#define RADIO_DIO_1 2
#define RADIO_DIO_3 3
#define RADIO_RESET 4
// Skip the chips select as Tock handles this for us
#define RADIO_NSS RADIOLIB_NC
// define Arduino-style macros
#define PIN_LOW (0x0)
#define PIN_HIGH (0x1)
#define PIN_INPUT (0x01)
#define PIN_OUTPUT (0x03)
#define PIN_RISING (0x01)
#define PIN_FALLING (0x02)
typedef void (*gpioIrqFn)(void);
gpioIrqFn gpio_funcs[4] = { NULL, NULL, NULL, NULL};
uint32_t frequency = 0;
/*
* Get the the timer frequency in Hz.
*/
int alarm_internal_frequency(uint32_t* frequency) {
syscall_return_t rval = command(0x0, 1, 0, 0);
return tock_command_return_u32_to_returncode(rval, frequency);
}
int alarm_internal_read(uint32_t* time) {
syscall_return_t rval = command(0x0, 2, 0, 0);
return tock_command_return_u32_to_returncode(rval, time);
}
static void lora_phy_gpio_Callback (int gpioPin,
__attribute__ ((unused)) int arg2,
__attribute__ ((unused)) int arg3,
void* userdata)
{
gpioIrqFn fn = gpio_funcs[gpioPin - 1];
if (fn != NULL ) {
fn();
}
}
class TockHal : public RadioLibHal {
public:
// default constructor - initializes the base HAL and any needed private members
TockHal()
: RadioLibHal(PIN_INPUT, PIN_OUTPUT, PIN_LOW, PIN_HIGH, PIN_RISING, PIN_FALLING) {
}
void init() override {
}
void term() override {
}
// GPIO-related methods (pinMode, digitalWrite etc.) should check
// RADIOLIB_NC as an alias for non-connected pins
void pinMode(uint32_t pin, uint32_t mode) override {
if(pin == RADIOLIB_NC) {
return;
}
if (mode == PIN_OUTPUT) {
libtock_lora_phy_gpio_enable_output(pin);
} else if (mode == PIN_INPUT) {
libtock_lora_phy_gpio_enable_input(pin, libtock_pull_down);
}
}
void digitalWrite(uint32_t pin, uint32_t value) override {
if(pin == RADIOLIB_NC) {
return;
}
if (value) {
libtock_lora_phy_gpio_set(pin);
} else {
libtock_lora_phy_gpio_clear(pin);
}
}
uint32_t digitalRead(uint32_t pin) override {
int value;
if(pin == RADIOLIB_NC) {
return 0;
}
libtock_lora_phy_gpio_read(pin, &value);
return value;
}
void attachInterrupt(uint32_t interruptNum, gpioIrqFn interruptCb, uint32_t mode) override {
if(interruptNum == RADIOLIB_NC) {
return;
}
gpio_funcs[interruptNum - 1] = interruptCb;
libtock_lora_phy_gpio_command_interrupt_callback(lora_phy_gpio_Callback, NULL);
// set GPIO as input and enable interrupts on it
libtock_lora_phy_gpio_enable_input(interruptNum, libtock_pull_down);
libtock_lora_phy_gpio_enable_interrupt(interruptNum, libtock_change);
}
void detachInterrupt(uint32_t interruptNum) override {
if(interruptNum == RADIOLIB_NC) {
return;
}
gpio_funcs[interruptNum - 1] = NULL;
libtock_lora_phy_gpio_disable_interrupt(interruptNum);
}
void delay(unsigned long ms) override {
#if !defined(RADIOLIB_CLOCK_DRIFT_MS)
libtocksync_alarm_delay_ms(ms);
#else
libtocksync_alarm_delay_ms(ms * 1000 / (1000 + RADIOLIB_CLOCK_DRIFT_MS));
#endif
}
void delayMicroseconds(unsigned long us) override {
#if !defined(RADIOLIB_CLOCK_DRIFT_MS)
libtocksync_alarm_delay_ms(us / 1000);
#else
libtocksync_alarm_delay_ms((us * 1000 / (1000 + RADIOLIB_CLOCK_DRIFT_MS)) / 1000);
#endif
}
unsigned long millis() override {
uint32_t now;
unsigned long ms;
if (frequency == 0) {
alarm_internal_frequency(&frequency);
}
alarm_internal_read(&now);
ms = now / (frequency / 1000);
#if !defined(RADIOLIB_CLOCK_DRIFT_MS)
return ms;
#else
return ms * 1000 / (1000 + RADIOLIB_CLOCK_DRIFT_MS);
#endif
}
unsigned long micros() override {
return millis() / 1000;
}
long pulseIn(uint32_t pin, uint32_t state, unsigned long timeout) override {
return 0;
}
void spiBegin() {
}
void spiBeginTransaction() {
}
void spiTransfer(uint8_t* out, size_t len, uint8_t* in) {
libtocksync_lora_phy_read_write(out, in, len);
}
void spiEndTransaction() {
}
void spiEnd() {
}
void yield() {
::yield_no_wait();
}
private:
};
#endif

View file

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

View file

@ -45,9 +45,13 @@ const int pin = 5;
// create Pager client instance using the FSK module // create Pager client instance using the FSK module
PagerClient pager(&radio); PagerClient pager(&radio);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -31,9 +31,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create Pager client instance using the FSK module // create Pager client instance using the FSK module
PagerClient pager(&radio); PagerClient pager(&radio);

View file

@ -23,6 +23,14 @@
// extra GPIO/interrupt pin: 3 (unused on some modules) // extra GPIO/interrupt pin: 3 (unused on some modules)
RADIO_TYPE radio = new Module(10, 2, 9, 3); RADIO_TYPE radio = new Module(10, 2, 9, 3);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// get pointer to the common layer // get pointer to the common layer
PhysicalLayer* phy = (PhysicalLayer*)&radio; PhysicalLayer* phy = (PhysicalLayer*)&radio;

View file

@ -21,9 +21,13 @@
// RESET pin: 3 // RESET pin: 3
RF69 radio = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//RF69 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -23,9 +23,13 @@
// RESET pin: 3 // RESET pin: 3
RF69 radio = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//RF69 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -30,9 +30,13 @@
// RESET pin: 3 // RESET pin: 3
RF69 radio = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//RF69 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -21,9 +21,28 @@
// RESET pin: 3 // RESET pin: 3
RF69 radio = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//RF69 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// flag to indicate that a packet was received
volatile bool receivedFlag = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we got a packet, set the flag
receivedFlag = true;
}
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@ -64,21 +83,6 @@ void setup() {
// radio.readData(); // radio.readData();
} }
// flag to indicate that a packet was received
volatile bool receivedFlag = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we got a packet, set the flag
receivedFlag = true;
}
void loop() { void loop() {
// check if the flag is set // check if the flag is set
if(receivedFlag) { if(receivedFlag) {

View file

@ -33,9 +33,13 @@ RF69 radio1 = new Module(10, 2, 3);
// RESET pin: 5 // RESET pin: 5
RF69 radio2 = new Module(9, 4, 5); RF69 radio2 = new Module(9, 4, 5);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//RF69 radio3 = RadioShield.ModuleB; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio3 = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -21,9 +21,13 @@
// RESET pin: 3 // RESET pin: 3
RF69 radio = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//RF69 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -23,9 +23,13 @@
// RESET pin: 3 // RESET pin: 3
RF69 radio = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//RF69 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -27,9 +27,13 @@
// RESET pin: 3 // RESET pin: 3
RF69 radio = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//RF69 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -24,13 +24,32 @@
// RESET pin: 3 // RESET pin: 3
RF69 radio = new Module(10, 2, 3); RF69 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//RF69 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// save transmission state between loops // save transmission state between loops
int transmissionState = RADIOLIB_ERR_NONE; int transmissionState = RADIOLIB_ERR_NONE;
// flag to indicate that a packet was sent
volatile bool transmittedFlag = false;
// this function is called when a complete packet
// is transmitted by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we sent a packet, set the flag
transmittedFlag = true;
}
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@ -81,21 +100,6 @@ void setup() {
*/ */
} }
// flag to indicate that a packet was sent
volatile bool transmittedFlag = false;
// this function is called when a complete packet
// is transmitted by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we sent a packet, set the flag
transmittedFlag = true;
}
// counter to keep track of transmitted packets // counter to keep track of transmitted packets
int count = 0; int count = 0;

View file

@ -32,9 +32,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create RTTY client instance using the FSK module // create RTTY client instance using the FSK module
RTTYClient rtty(&radio); RTTYClient rtty(&radio);

View file

@ -29,9 +29,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// this requires connection to the module direct // this requires connection to the module direct

View file

@ -42,9 +42,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create SSTV client instance using the FSK module // create SSTV client instance using the FSK module
SSTVClient sstv(&radio); SSTVClient sstv(&radio);

View file

@ -38,9 +38,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module // create AFSK client instance using the FSK module
// this requires connection to the module direct // this requires connection to the module direct

View file

@ -33,6 +33,18 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
END_OF_MODE_TABLE, END_OF_MODE_TABLE,
}; };
// flag to indicate that a packet was detected or CAD timed out
volatile bool scanFlag = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
void setFlag(void) {
// something happened, set the flag
scanFlag = true;
}
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@ -66,18 +78,6 @@ void setup() {
} }
} }
// flag to indicate that a packet was detected or CAD timed out
volatile bool scanFlag = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
void setFlag(void) {
// something happened, set the flag
scanFlag = true;
}
void loop() { void loop() {
// check if the flag is set // check if the flag is set
if(scanFlag) { if(scanFlag) {

View file

@ -43,6 +43,18 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
END_OF_MODE_TABLE, END_OF_MODE_TABLE,
}; };
// flag to indicate that a packet was received
volatile bool receivedFlag = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
void setFlag(void) {
// we got a packet, set the flag
receivedFlag = true;
}
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@ -97,18 +109,6 @@ void setup() {
// radio.scanChannel(); // radio.scanChannel();
} }
// flag to indicate that a packet was received
volatile bool receivedFlag = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
void setFlag(void) {
// we got a packet, set the flag
receivedFlag = true;
}
void loop() { void loop() {
// check if the flag is set // check if the flag is set
if(receivedFlag) { if(receivedFlag) {
@ -154,8 +154,5 @@ void loop() {
Serial.println(state); Serial.println(state);
} }
// put module back to listen mode
radio.startReceive();
} }
} }

View file

@ -38,6 +38,18 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
// save transmission state between loops // save transmission state between loops
int transmissionState = RADIOLIB_ERR_NONE; int transmissionState = RADIOLIB_ERR_NONE;
// flag to indicate that a packet was sent
volatile bool transmittedFlag = false;
// this function is called when a complete packet
// is transmitted by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
void setFlag(void) {
// we sent a packet, set the flag
transmittedFlag = true;
}
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@ -85,18 +97,6 @@ void setup() {
*/ */
} }
// flag to indicate that a packet was sent
volatile bool transmittedFlag = false;
// this function is called when a complete packet
// is transmitted by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
void setFlag(void) {
// we sent a packet, set the flag
transmittedFlag = true;
}
// counter to keep track of transmitted packets // counter to keep track of transmitted packets
int count = 0; int count = 0;

View file

@ -29,9 +29,13 @@
// RESET pin: 3 // RESET pin: 3
SX1231 radio = new Module(10, 2, 3); SX1231 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1231 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -28,9 +28,13 @@
// RESET pin: 3 // RESET pin: 3
SX1231 radio = new Module(10, 2, 3); SX1231 radio = new Module(10, 2, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1231 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -30,12 +30,13 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1262 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
// or using CubeCell #include <RadioBoards.h>
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -25,12 +25,28 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1262 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// or using CubeCell // flag to indicate that a packet was detected or CAD timed out
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); volatile bool scanFlag = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// something happened, set the flag
scanFlag = true;
}
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@ -61,21 +77,6 @@ void setup() {
} }
} }
// flag to indicate that a packet was detected or CAD timed out
volatile bool scanFlag = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// something happened, set the flag
scanFlag = true;
}
void loop() { void loop() {
// check if the flag is set // check if the flag is set
if(scanFlag) { if(scanFlag) {

View file

@ -27,12 +27,31 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1262 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// or using CubeCell // whether we are receiving, or scanning
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); bool receiving = false;
// flag to indicate that a packet was detected or CAD timed out
volatile bool scanFlag = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// something happened, set the flag
scanFlag = true;
}
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@ -63,23 +82,6 @@ void setup() {
} }
} }
// flag to indicate that a packet was detected or CAD timed out
volatile bool scanFlag = false;
bool receiving = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// something happened, set the flag
scanFlag = true;
}
void loop() { void loop() {
// check if the flag is set // check if the flag is set
if(scanFlag) { if(scanFlag) {

View file

@ -26,12 +26,13 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1262 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
// or using CubeCell #include <RadioBoards.h>
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@ -125,33 +126,4 @@ void loop() {
Serial.println(F("[SX1262] Failed to receive packet, code ")); Serial.println(F("[SX1262] Failed to receive packet, code "));
Serial.println(state); Serial.println(state);
} }
// FSK modem has built-in address filtering system
// it can be enabled by setting node address, broadcast
// address, or both
//
// to transmit packet to a particular address,
// use the following methods:
//
// radio.transmit("Hello World!", address);
// radio.startTransmit("Hello World!", address);
// set node address to 0x02
state = radio.setNodeAddress(0x02);
// set broadcast address to 0xFF
state = radio.setBroadcastAddress(0xFF);
if (state != RADIOLIB_ERR_NONE) {
Serial.println(F("[SX1262] Unable to set address filter, code "));
Serial.println(state);
}
// address filtering can also be disabled
// NOTE: calling this method will also erase previously set
// node and broadcast address
/*
state = radio.disableAddressFiltering();
if (state != RADIOLIB_ERR_NONE) {
Serial.println(F("Unable to remove address filter, code "));
}
*/
} }

View file

@ -0,0 +1,113 @@
/*
RadioLib SX126x LR-FHSS Modem Example
This example shows how to use LR-FHSS modem in SX126x chips.
This modem can only transmit data, and is not able to receive.
This example transmits packets using SX1262 LoRa radio module.
Each packet contains up to 256 bytes of data, in the form of:
- Arduino String
- null-terminated char array (C-string)
- arbitrary binary data (byte array)
Other modules from SX126x family can also be used.
Using blocking transmit is not recommended, as it will lead
to inefficient use of processor time!
Instead, interrupt transmit is recommended.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lr-fhss-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// SX1262 has the following connections:
// NSS pin: 10
// IRQ pin: 2
// NRST pin: 3
// BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() {
Serial.begin(9600);
// initialize SX1262 with default settings
Serial.print(F("[SX1262] Initializing ... "));
int state = radio.beginLRFHSS();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// some modules have an external RF switch
// controlled via two pins (RX enable, TX enable)
// to enable automatic control of the switch,
// call the following method
// RX enable: 4
// TX enable: 5
/*
radio.setRfSwitchPins(4, 5);
*/
}
// counter to keep track of transmitted packets
int count = 0;
void loop() {
// LR-FHSS modem can only transmit!
Serial.print(F("[SX1262] Transmitting packet ... "));
// you can transmit C-string or Arduino string up to
// 256 characters long
String str = "Hello World! #" + String(count++);
int state = radio.transmit(str);
// you can also transmit byte array up to 256 bytes long
/*
byte byteArr[] = {0x01, 0x23, 0x45, 0x56, 0x78, 0xAB, 0xCD, 0xEF};
int state = radio.transmit(byteArr, 8);
*/
if (state == RADIOLIB_ERR_NONE) {
// the packet was successfully transmitted
Serial.println(F("success!"));
// print measured data rate
Serial.print(F("[SX1262] Datarate:\t"));
Serial.print(radio.getDataRate());
Serial.println(F(" bps"));
} else if (state == RADIOLIB_ERR_PACKET_TOO_LONG) {
// the supplied packet was longer than 256 bytes
Serial.println(F("too long!"));
} else if (state == RADIOLIB_ERR_TX_TIMEOUT) {
// timeout occurred while transmitting packet
Serial.println(F("timeout!"));
} else {
// some other error occurred
Serial.print(F("failed, code "));
Serial.println(state);
}
// wait for a second before transmitting again
delay(1000);
}

View file

@ -0,0 +1,151 @@
/*
RadioLib SX126x LR-FHSS Transmit with Interrupts Example
This example shows how to use LR-FHSS modem in SX126x chips.
This modem can only transmit data, and is not able to receive.
This example transmits packets using SX1262 LoRa radio module.
Each packet contains up to 256 bytes of data, in the form of:
- Arduino String
- null-terminated char array (C-string)
- arbitrary binary data (byte array)
Other modules from SX126x family can also be used.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lr-fhss-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// SX1262 has the following connections:
// NSS pin: 10
// IRQ pin: 2
// NRST pin: 3
// BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// save transmission state between loops
int transmissionState = RADIOLIB_ERR_NONE;
// flag to indicate that a packet was sent
// or a frequency hop is needed
volatile bool flag = false;
// this function is called when a complete packet
// is transmitted by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we sent a packet or need to hop, set the flag
flag = true;
}
void setup() {
Serial.begin(9600);
// initialize SX1262 with default settings
Serial.print(F("[SX1262] Initializing ... "));
int state = radio.beginLRFHSS();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// set the function that will be called
// when packet transmission is finished
radio.setPacketSentAction(setFlag);
// start transmitting the first packet
Serial.print(F("[SX1262] Sending first packet ... "));
// you can transmit C-string or Arduino string up to
// 256 characters long
transmissionState = radio.startTransmit("Hello World!");
// you can also transmit byte array up to 256 bytes long
/*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF};
state = radio.startTransmit(byteArr, 8);
*/
}
// counter to keep track of transmitted packets
int count = 0;
void loop() {
// LR-FHSS modem can only transmit!
// check if the previous transmission finished
if(flag) {
// reset flag
flag = false;
// check if this was caused by hopping or transmission finished
if(radio.getIrqFlags() & RADIOLIB_SX126X_IRQ_LR_FHSS_HOP) {
radio.hopLRFHSS();
} else {
if (transmissionState == RADIOLIB_ERR_NONE) {
// packet was successfully sent
Serial.println(F("transmission finished!"));
// NOTE: when using interrupt-driven transmit method,
// it is not possible to automatically measure
// transmission data rate using getDataRate()
} else {
Serial.print(F("failed, code "));
Serial.println(transmissionState);
}
// clean up after transmission is finished
// this will ensure transmitter is disabled,
// RF switch is powered down etc.
radio.finishTransmit();
// wait a second before transmitting again
delay(1000);
// send another one
Serial.print(F("[SX1262] Sending another packet ... "));
// you can transmit C-string or Arduino string up to
// 256 characters long
String str = "Hello World! #" + String(count++);
transmissionState = radio.startTransmit(str);
// you can also transmit byte array up to 256 bytes long
/*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF};
transmissionState = radio.startTransmit(byteArr, 8);
*/
}
}
}

View file

@ -1,6 +1,9 @@
/* /*
RadioLib SX126x Ping-Pong Example RadioLib SX126x Ping-Pong Example
This example is intended to run on two SX126x radios,
and send packets between the two.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
@ -22,12 +25,13 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1262 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
// or using CubeCell #include <RadioBoards.h>
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); Radio radio = new RadioModule();
*/
// save transmission states between loops // save transmission states between loops
int transmissionState = RADIOLIB_ERR_NONE; int transmissionState = RADIOLIB_ERR_NONE;

View file

@ -13,10 +13,10 @@
Other modules from SX126x family can also be used. Other modules from SX126x family can also be used.
Using blocking receive is not recommended, as it will lead Using blocking receive is not recommended, as it will lead
to significant amount of timeouts, inefficient use of processor to significant amount of timeouts, inefficient use of processor
time and can some miss packets! time and can some miss packets!
Instead, interrupt receive is recommended. Instead, interrupt receive is recommended.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
@ -35,12 +35,13 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1262 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
// or using CubeCell #include <RadioBoards.h>
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -31,12 +31,28 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1262 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// or using CubeCell // flag to indicate that a packet was received
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); volatile bool receivedFlag = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we got a packet, set the flag
receivedFlag = true;
}
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@ -77,21 +93,6 @@ void setup() {
// radio.scanChannel(); // radio.scanChannel();
} }
// flag to indicate that a packet was received
volatile bool receivedFlag = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we got a packet, set the flag
receivedFlag = true;
}
void loop() { void loop() {
// check if the flag is set // check if the flag is set
if(receivedFlag) { if(receivedFlag) {

View file

@ -41,12 +41,13 @@ SX1262 radio1 = new Module(10, 2, 3, 9);
// BUSY pin: 6 // BUSY pin: 6
SX1268 radio2 = new Module(8, 4, 5, 6); SX1268 radio2 = new Module(8, 4, 5, 6);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1261 radio3 = RadioShield.ModuleB; /*
#define RADIO_BOARD_AUTO
// or using CubeCell #include <RadioBoards.h>
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); Radio radio3 = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -34,6 +34,14 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);

View file

@ -34,6 +34,14 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// frequency range in MHz to scan // frequency range in MHz to scan
const float freqStart = 431; const float freqStart = 431;
const float freqEnd = 435; const float freqEnd = 435;

View file

@ -30,12 +30,13 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1262 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
// or using CubeCell #include <RadioBoards.h>
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -27,16 +27,32 @@
// BUSY pin: 9 // BUSY pin: 9
SX1262 radio = new Module(10, 2, 3, 9); SX1262 radio = new Module(10, 2, 3, 9);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1262 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
// or using CubeCell #include <RadioBoards.h>
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); Radio radio = new RadioModule();
*/
// save transmission state between loops // save transmission state between loops
int transmissionState = RADIOLIB_ERR_NONE; int transmissionState = RADIOLIB_ERR_NONE;
// flag to indicate that a packet was sent
volatile bool transmittedFlag = false;
// this function is called when a complete packet
// is transmitted by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we sent a packet, set the flag
transmittedFlag = true;
}
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@ -70,21 +86,6 @@ void setup() {
*/ */
} }
// flag to indicate that a packet was sent
volatile bool transmittedFlag = false;
// this function is called when a complete packet
// is transmitted by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we sent a packet, set the flag
transmittedFlag = true;
}
// counter to keep track of transmitted packets // counter to keep track of transmitted packets
int count = 0; int count = 0;

View file

@ -31,9 +31,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

View file

@ -26,9 +26,43 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// flag to indicate that a preamble was not detected
volatile bool timeoutFlag = false;
// flag to indicate that a preamble was detected
volatile bool detectedFlag = false;
// this function is called when no preamble
// is detected within timeout period
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlagTimeout(void) {
// we timed out, set the flag
timeoutFlag = true;
}
// this function is called when LoRa preamble
// is detected within timeout period
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlagDetected(void) {
// we got a preamble, set the flag
detectedFlag = true;
}
void setup() { void setup() {
// Serial port speed must be high enough for this example // Serial port speed must be high enough for this example
@ -64,36 +98,6 @@ void setup() {
} }
} }
// flag to indicate that a preamble was not detected
volatile bool timeoutFlag = false;
// flag to indicate that a preamble was detected
volatile bool detectedFlag = false;
// this function is called when no preamble
// is detected within timeout period
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlagTimeout(void) {
// we timed out, set the flag
timeoutFlag = true;
}
// this function is called when LoRa preamble
// is detected within timeout period
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlagDetected(void) {
// we got a preamble, set the flag
detectedFlag = true;
}
void loop() { void loop() {
// check if we need to restart channel activity detection // check if we need to restart channel activity detection
if(detectedFlag || timeoutFlag) { if(detectedFlag || timeoutFlag) {

View file

@ -31,9 +31,46 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// flag to indicate that a preamble was not detected
volatile bool timeoutFlag = false;
// flag to indicate that a preamble was detected
volatile bool detectedFlag = false;
// flag to indicate if we are currently receiving
bool receiving = false;
// this function is called when no preamble
// is detected within timeout period
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlagTimeout(void) {
// we timed out, set the flag
timeoutFlag = true;
}
// this function is called when LoRa preamble
// is detected within timeout period
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlagDetected(void) {
// we got a preamble, set the flag
detectedFlag = true;
}
void setup() { void setup() {
// Serial port speed must be high enough for this example // Serial port speed must be high enough for this example
@ -70,39 +107,6 @@ void setup() {
} }
} }
// flag to indicate that a preamble was not detected
volatile bool timeoutFlag = false;
// flag to indicate that a preamble was detected
volatile bool detectedFlag = false;
// flag to indicate if we are currently receiving
bool receiving = false;
// this function is called when no preamble
// is detected within timeout period
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlagTimeout(void) {
// we timed out, set the flag
timeoutFlag = true;
}
// this function is called when LoRa preamble
// is detected within timeout period
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlagDetected(void) {
// we got a preamble, set the flag
detectedFlag = true;
}
void loop() { void loop() {
// check if we need to restart channel activity detection // check if we need to restart channel activity detection
if(detectedFlag || timeoutFlag) { if(detectedFlag || timeoutFlag) {

View file

@ -26,9 +26,13 @@
// DIO1 pin: 3 // DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3); SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield // or detect the pinout automatically using RadioBoards
// https://github.com/jgromes/RadioShield // https://github.com/radiolib-org/RadioBoards
//SX1278 radio = RadioShield.ModuleA; /*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);

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