Compare commits

...
Sign in to create a new pull request.

1467 commits

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

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

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

* [SX1280] meet cpp check

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

Add Max packet size for FIFO Refills

* Define FIFO Size, Max packet Length for FIFO refills

* FIFO REFILL

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

* Fix typos

* Fix another typo

* min -> std::min per build check

* Revert std::min back to min

* Use RADIOLIB_MIN Macro instead of min

* Move MARC State check for Idle to finishTransmit function

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

* Add timeouts for both MARC state checks

* Fix typo

* No interrupt for packets bigger than 64 bytes

* Initialize state as RADIOLIB_ERR_NONE if avoiding ISR

* Update example with packet size and discussion link

* Update example with new packet size and discussion link

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

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

* [CI] Update workflow

* [CI] Fix indentation

* [CI] Ignore geninfo errors

* [CI] Force gcov 11

* [CI] Install gcc 11

* [CI] Revert gcc-11

* Use ubuntu 22.04 as unit test runner

* Deploy coverage report to github pages

* Add coverage link

---------

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

* Add example sleep function

* [LoRaWAN] Switch all delay calls to sleepDelay

* [LoRaWAN] Remove unused variable

---------

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

* [SX126x] Add support for staged Rx/Tx

* [PHY] Add missing virtual specifiers

* [SX126x] Add missing overrides

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

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

* [PHY] Pass mode config by reference

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

* [SX126x] Implement staged modes

* [SX128x] Implement staged modes

* [SX127x] Implement staged modes

* [LR11x0] Implement staged modes

* [SX127x] Remove unused method from header

* [SX126x] Make array const

* Add new methods to keywords

---------

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

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

* Update LR1120.h

* add RADIOLIB_CHECK_PARAMS

* remove  skipRfValidation parameter

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

* [CI] Add gitignore

* [CI] Install libfmt

---------

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

* Add force option to SPIsetRegValue

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

* Fix token name

* Fix path

* Pass size files via artifacts

* Fix path to artifacts

* Fix git hash in artifact filename

* Fix git hash

* Fix artifact name

* Fix artifact path

* Avoid filenames with colons

* Fix artifact paths

* Remove incorrect cd

* Add missing cd

* Fix paths in second repo

* More path fixing

* Fix artifacts repo name

* Remove path from example filename in output

* Add hash to commit message

* Fix typo

* Fix artifact commit message

* Move git hash

* Use GITHUB_SHA variable

* Drop markdown format

---------

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

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

* NonArduino/Tock: Update to latest libtock-c

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

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

---------

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

* [SX127x] Added setFifoThreshold

* Add setFifoThreshold to RF69 class.

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

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

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

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

* Added new keyword

* [SX126x] Added setModem implementation

* [LoRaWAN] Use setModem

* [PHY] Added getModem

* [LoRaWAN] Use getModem instead of caching modulation

* [SX126x] Implement getModem

* Added new keywords

* [LR11x0] Added get/set modem

* [LLCC68] Added get/set modem

* [SX126x] Added missing default branch

* [SX127x] Added get/set modem

* [SX128x] Added get/set modem

* [CI] Drop Hellschreiber from AVR builds

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

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

* [LR11x0] Fix ambiguous call

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

* [LR11x0] Added almanac update

* [LR11x0] Added almanac update example

* [LR11x0] Add missing memory deallocation

* [LR11x0] Fix underflow in delay until subframe

* [LR11x0] Remove pin mapping from example

* [LR11x0] Finish rework of the GNSS API

* [LR11x0] Added position and satellite examples

* [LR11x0] Fix result member in example

* Added LR11x0 GNSS keywords

* [LR11x0] Fix typo in macro name

* [LR11x0] Print scan failed in example

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

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

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

* [SX126x] Added initial LR-FHSS transmission support

* [CI] Use RPi build for CodeQL

* [SX126x] Fix signed comparison warning

* [FEC] Make input to Viterbi encoder const

* [CI] Drop SX126x examples from Arduino Uno builds

* [CI] Build SX123x for CodeQL scan

* [FEC] Fix comparison type

* [SX126x] Added configurable grid step

* [SX126x] Rename convolutional coding class

* [SX126x] Fix payload CRC

* [SX126x] ADded LR-FHSS example

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

* Add dependencies to CMakeLists

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

* document new parameters

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

According LR1121 datasheet

* Update LR11x0.cpp

Now OK

* Update LR11x0.cpp

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

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

* [LoRaWAN] Some CI fixes, add retransmission timeout

* [LoRaWAN] CI fixes

* [LoRaWAN] Add missing initializers

* [LoRaWAN] Return Rx window number, fix casing

* [LoRaWAN] Un-static functions to fix overriding

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

* [LoRaWAN] Add const

* [LoRaWAN] Do not accept invalid Rx2 datarate

* [LoRaWAN] Integrate feedback

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

* Update keywords.txt

* [LoRaWAN] Fix initial datarate, misc cleanup

* [LoRaWAN] Update examples

* [LoRaWAN] Update README

* [LoRaWAN] Reject oversized downlinks

* [LoRaWAN] Remove VLAs

* [LoRaWAN] CI fixes

* [LoRaWAN] More CI

* [LoRaWAN] Fix getMaxPayloadLen

* [LoRaWAN] Rename some status codes

* [CI] Skip LoRaWAN on XMega48

* [CI] Skip FW update for LR11x0

---------

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

* [CI] Fix package version passing

* [CI] Fix swapped logic

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

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

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

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

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

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

* [LR11x0] Added channel scan configuration

* [SX126x] Added channel scan configuration

* [SX128x] Added channel scan configuration

* Use microsecond timeout

* [PHY] Added generalized IRQ handling via PHY

* [LR11x0] Added generalized IRQ handling via PHY

* [SX126x] Added generalized IRQ handling via PHY

* [SX127x] Added generalized IRQ handling via PHY

* [SX128x] Added generalized IRQ handling via PHY

* Added missing typedef

* [PHY] Fix IRQ method argument type

* [SX128x] Fix non-trivial initializer usage

* [LR11x0] Added missing override specifiers

* [SX126x] Added missing override specifiers

* [SX127x] Added missing override specifiers

* [SX128x] Added missing override specifiers

* [PHY] Added missing IRQ map initializer

* [CI] Drop APRS builds on AVR

* [CI] Drop Morse builds for AVR

* [PHY] Rework generic IRQ to allow multiple flags

* [LR11x0] Rework generic IRQ to allow multiple flags

* [SX126x] Rework generic IRQ to allow multiple flags

* [SX127x] Rework generic IRQ to allow multiple flags

* [SX128x] Rework generic IRQ to allow multiple flags

* [LoRaWAN] Use generic IRQ

* Add missing typedef

* [SX127x] Make Rx mode implicit based on timeout

* [SX127x] Fixed shadowed variable

* [LR11x0] Fix missing initializers

* [SX127x] Added default startReceive arguments

* [LR11x0] Pass scan config by const reference

* [SX126x] Pass scan config by const reference

* [SX128x] Pass scan config by const reference

* [PHY] Pass scan config by const reference

* [SX127x] Add missing IRQ conversion

* [SX126x] Fixed default CAD scan config IRQ

* [LR11x0] Fixed default CAD scan config IRQ

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

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

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

* Update CC1101.h

* Update CC1101.cpp

* Update CC1101.cpp

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

* [CC1101] Fix packet mode not resetting directModeEnabled bool
2024-06-12 17:46:10 +02:00
jgromes
e855636384 [LR11x0] Added missing macros 2024-06-09 10:27:39 +02:00
jgromes
81b9e6cd53 [LR11x0] Fix LR-FHSS time on air calculation (#1117) 2024-06-09 10:22:21 +02:00
StevenCellist
68d0e393b7
[LoRaWAN] Remove forbidden CN780 2024-06-07 10:09:59 +02:00
IoTThinks.com
38abf92aaf
[LoRaWAN] Added frequency plans AS923_2, AS923_3 and AS923_4 for Asian countries (#1116)
* Added AS923_2, AS923_3 and AS923_4
These plans are used by Asian countries such as Vietnam, Indonesia, Philippines...
2024-06-07 10:04:38 +02:00
StevenCellist
e42cd7e2a5 [LoRaWAN] Fix dwelltime & JR-dr for AU915, add JR dwelltime check 2024-06-05 21:27:19 +02:00
IoTThinks.com
aebbdd4c93
[LoRaWAN] To change CR to 4/5 for all frequency plans (#1115)
To set AS923-1/2/3/4, IN868, EU433, KR, CN...use default CR 4/5 instead of CR 4/7
2024-06-04 08:12:43 +02:00
jgromes
5d9917eb06 [LoRaWAN] Change FSK switch to modulation variable 2024-06-02 09:29:55 +02:00
jgromes
b8d5b984d1 [CI] Added ESP32 back to build matrix 2024-06-01 08:30:40 +02:00
jgromes
954477b0c0 [LoRaWAN] Remove old error code (CI_BUILD_ALL) 2024-05-28 18:25:35 +02:00
jgromes
e1830052a3 [CI] Temporarily disable ESP32 CI (platform broken) (CI_BUILD_ALL) 2024-05-28 18:20:57 +02:00
jgromes
7d96b4290e Bump version to 6.6.0 2024-05-28 17:53:19 +02:00
jgromes
6bd3f92cad [LR11x0] Update RF switch map for WM1110 2024-05-27 21:22:19 +02:00
jgromes
62df57885a Move PR template 2024-05-26 19:05:23 +02:00
jgromes
2536d8842c Added PR template 2024-05-26 18:59:05 +02:00
jgromes
a465f64969 [LR11x0] Implemented RF switch control 2024-05-26 17:03:45 +02:00
jgromes
3af427fefb [SX126x] Fix duplicate method 2024-05-26 16:43:54 +02:00
jgromes
f78b3ccc97 [MOD] Increase maximum number of RF switch pins to 5 2024-05-26 16:36:42 +02:00
jgromes
852d336c50 [SX126x] Added getMod implementation 2024-05-26 16:32:51 +02:00
jgromes
c3e99c8698 [LR11x0] Make regulator mode and Rx gain config public (#1108) 2024-05-26 14:11:05 +02:00
jgromes
0d491060b2 [CI] Fix cppcheck sequence 2024-05-26 12:50:02 +01:00
jgromes
bb7c6592fc [CI] Add cppcheck script 2024-05-26 12:49:14 +01:00
jgromes
cc2cb2c9a0 [LoRaWAN] Fix shadowed variable 2024-05-26 11:26:15 +01:00
jgromes
41f89198aa [Crypto] Suppress cppcheck unused private function 2024-05-26 09:31:59 +02:00
jgromes
79d10c242a [LoRaWAN] Use memset for channel array init 2024-05-26 09:27:00 +02:00
jgromes
9a9e04d047 Add check for self-assignment 2024-05-26 09:25:13 +02:00
jgromes
a5e2e58c36 [CI] Skip Pager examples for Uno 2024-05-26 09:22:28 +02:00
jgromes
99bb025173 [PHY] Added missing zero inits 2024-05-26 09:07:07 +02:00
jgromes
525fdfb1a0 [LoRaWAN] Cppcheck cleanup 2024-05-26 09:02:23 +02:00
jgromes
45d3aac0d9 [CC1101] Fixed signed comparison warning 2024-05-26 08:55:38 +02:00
jgromes
6c11480416 [LR11x0] Cppcheck cleanup 2024-05-26 08:49:02 +02:00
jgromes
16710d4dae [SX128x] Added missing override 2024-05-26 08:45:42 +02:00
jgromes
195339a0c7 [LR11x0] Added missing override 2024-05-26 08:44:42 +02:00
jgromes
77bc8fb33e [SX126x] Added missing override 2024-05-26 08:44:12 +02:00
jgromes
214a566d9a [CC1101] Make frequency range check bounds inclusive 2024-05-26 08:43:02 +02:00
StevenCellist
139fc7ee35 [LoRaWAN] Force default Rx2 for JoinAccept 2024-05-25 15:25:46 +02:00
StevenCellist
7186ae598b [LoRaWAN] Improve debug output 2024-05-25 15:12:36 +02:00
StevenCellist
237531c9a0 [LoRaWAN] Improve FPort checks, add TS009 option 2024-05-25 15:00:36 +02:00
StevenCellist
ceb91c91c7 Update return codes in keywords.txt 2024-05-25 14:40:52 +02:00
StevenCellist
d4b25e75af [LoRaWAN] Hide Rx2 config into guarded setRx2Dr() 2024-05-25 14:38:04 +02:00
StevenCellist
88b4da94c1 [LoRaWAN] Fix cppcheck warnings 2024-05-25 13:13:35 +02:00
StevenCellist
fe221cf84f [LoRaWAN] Revert LW to LORAWAN 2024-05-25 13:00:02 +02:00
HeadBoffin
875da9d89d
LW examples updated for new initialisation / join sequence (#1104)
* Updated for new initalisation / join sequence

* Removed duplicate entry

* Pragmatic / conservative disabling on unknown configs with potentially wrong defines - to be investigated at a later date

---------

Co-authored-by: Nick McCloud <hiq.bitbucket@armoured.email>
2024-05-25 07:19:02 +02:00
jgromes
4a011e0915 [SX128x] Fix check output power argument name 2024-05-25 07:13:31 +02:00
Jan Gromeš
8864a2a10a
[SX128x] Merge pull request #1105 from lewisxhe/master
Fixed SX128X checkOutputPower
2024-05-25 07:11:53 +02:00
lewisxhe
84402968c2 Fixed SX128X checkOutputPower 2024-05-25 10:50:58 +08:00
StevenCellist
298a612699
[LoRaWAN] Change session activation (#1093)
* [LoRaWAN] Improve session restoration/activation behaviour

* [LoRaWAN] Custom return codes for session begin

* [LoRaWAN] Separate begin() and activate()

* [LoRaWAN] Fix activateABP()

* [LoRaWAN] Additional error-code

* [LoRaWAN] Fix rejoining during active session

* [LoRaWAN] Expose clearSession, drop `force`

* Update keywords...
2024-05-21 12:03:49 +02:00
jgromes
bfb27ec8c9 [CI] Skip CubeCell LR11x0 FW update 2024-05-20 20:02:43 +02:00
jgromes
e52fe99f03 [CC1101] Rework power check to not use constexpr 2024-05-20 19:56:47 +02:00
jgromes
90627325d3 [CI] Fix STM32F1 skip pattern 2024-05-20 19:39:51 +02:00
jgromes
8cda0d7a26 [CI] Fix STM32F1 skip pattern 2024-05-20 19:30:07 +02:00
jgromes
bcbefab4e8 [CI] Fix STM32WL skip pattern missing 2024-05-20 19:19:14 +02:00
jgromes
020a2ce8df [LR11x0] Do not use yield in example 2024-05-20 18:08:27 +02:00
jgromes
2b65070212 [CI] Disable LR11x0 FW update on most platforms 2024-05-20 18:07:48 +02:00
StevenCellist
f660f2794f
Merge pull request #1102 from pnxs/master
fix payload of DevStatusAns mac-command
2024-05-20 11:24:27 +02:00
Thomas Schätzlein
f2e1b547d5 fix payload of DevStatusAns mac-command
Lorawan specs say (e.g. 1.0.4 or 1.1), that the first byte is the
battery-level and the second byte is the margin.
2024-05-20 10:51:41 +02:00
jgromes
e121f963dc [CI] Skip LR11x0 firmware example on AVRs 2024-05-19 21:22:19 +02:00
jgromes
648268d5c1 [CI] Remove Intel Arc (broken platform) 2024-05-19 21:14:44 +02:00
jgromes
ffafb7353d [CI] Fix syntax 2024-05-19 21:06:15 +02:00
jgromes
764c0bf271 [CI] Disable LR11x0 firmware update on low-end platforms 2024-05-19 19:19:07 +02:00
jgromes
534a2f2d62 [LR11x0] Fix struct initialization 2024-05-19 19:09:04 +02:00
jgromes
98c80a9cb9 [STM32WL] Fix output ramp time configuration 2024-05-19 19:05:03 +02:00
jgromes
60d1738c91 [AX25] Fix possible string truncation 2024-05-19 18:32:44 +02:00
jgromes
76f61144df Fix gitattributes 2024-05-19 15:03:44 +02:00
jgromes
9ebafbe507 Exclude FW images from linguist 2024-05-19 15:02:36 +02:00
jgromes
4ab0ac8a13 [CI] Skip LR11x0 FW update build on Uno 2024-05-19 15:00:05 +02:00
jgromes
5e398bd868 [LR11x0] Added firmware update support 2024-05-19 14:55:11 +02:00
jgromes
8f5440e4b5 [LR11x0] Clarified device macro naming 2024-05-19 13:55:53 +02:00
jgromes
ffbcdd0d57 [MOD] Move SPI timeout to SPI config struct 2024-05-19 13:55:22 +02:00
jgromes
b5fd75b4dc [LR11x0] Implemented v2 GNSS commands 2024-05-18 08:44:50 +02:00
jgromes
47f5569e7f [LR11x0] Dump FW versions in debug mode 2024-05-15 21:27:31 +02:00
jgromes
3b412d7521 [SX126x] Add rounding when using custom image rejection (#1096) 2024-05-15 20:22:30 +02:00
Jan Gromeš
5ac5bdaadc
Merge pull request #1099 from alistair23/alistair/tock-bump
examples/NonArduino/Tock: Update to the latest libtock-c API
2024-05-15 18:49:33 +02:00
jgromes
f9af9b4d3f [SX128x] Fix forgotten sleep 2024-05-15 18:45:57 +02:00
jgromes
63ef9e0977 Fixup doxygen comments (#1089) 2024-05-15 18:43:19 +02:00
Dominic Moffat
b336dd59f9
Fixes overload warning when building with ESP IDF (#1089)
* fixes overload

* fixes overload

* fixes overload warnings in ESP-IDF
2024-05-15 18:40:08 +02:00
Alistair Francis
f12875fac5 examples/NonArduino/Tock: Update to the latest libtock-c API
Update to use the latest libtock-c functions.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
2024-05-15 19:52:18 +10:00
jgromes
23dcc4b8b7 Remove submodule file 2024-05-13 12:36:01 +02:00
Jan Gromeš
6fe3eb67e4
Merge pull request #1095 from alistair23/alistair/libtock-c-removal
examples/NonArduino/Tock: Remove libtock-c submodule
2024-05-13 12:31:41 +02:00
Alistair Francis
58c8d2d1f4 examples/NonArduino/Tock: Remove libtock-c submodule
Remove the libtock-c submodule to fix https://github.com/jgromes/RadioLib/issues/1091

Signed-off-by: Alistair Francis <alistair@alistair23.me>
2024-05-13 19:45:13 +10:00
jgromes
9e8da76740 [ITA2] Added assignment operator overload and copy constructor 2024-05-12 19:49:56 +01:00
jgromes
71ccce4a3d [EXT] Added assignment operator overload and copy constructor 2024-05-12 19:49:46 +01:00
jgromes
e3f851ef6d [AX.25] Added assignment operator overload 2024-05-12 19:49:28 +01:00
Jan Gromeš
0e28810bb0
Merge pull request #1094 from bkleiner/feature-fix-set-rfswitch
LR11x0: fix setDioAsRfSwitch argument count
2024-05-12 19:22:05 +02:00
bkleiner
f3d358bbe3 LR11x0: fix setDioAsRfSwitch argument count 2024-05-12 19:01:17 +02:00
jgromes
dd9dc39f69 [Crypto] Fixed issues found by cppcheck 2024-05-12 12:04:41 +01:00
jgromes
330f4e8fe1 [CRC] Fixed issues found by cppcheck 2024-05-12 12:04:19 +01:00
jgromes
356e8c8546 [FEC] Fixed issues found by cppcheck 2024-05-12 12:04:09 +01:00
jgromes
a93e7b93de [SSTV] Fixed issues found by cppcheck 2024-05-12 12:03:53 +01:00
jgromes
d4e7af836c [Hell] Fixed issues found by cppcheck 2024-05-12 12:03:43 +01:00
jgromes
1dcd61b71d [SX128x] Use const pointers where appropriate 2024-05-12 12:03:19 +01:00
jgromes
be4ad51330 [LR11x0] Use const pointers where appropriate 2024-05-12 12:03:08 +01:00
jgromes
f0ed8cdf00 [CI] cppcheck do not report progress 2024-05-11 20:34:10 +01:00
jgromes
f72f7bd46d [RTTTY] Fixed issues found by cppcheck 2024-05-11 20:33:45 +01:00
jgromes
909969aa15 [Print] Fixed issues found by cppcheck 2024-05-11 20:33:39 +01:00
jgromes
89e406775d [Pager] Fixed issues found by cppcheck 2024-05-11 20:33:07 +01:00
jgromes
48ed06aa4b [Morse] Fixed issues found by cppcheck 2024-05-11 20:32:57 +01:00
jgromes
d779a834a0 [Hell] Fixed issues found by cppcheck 2024-05-11 20:32:50 +01:00
jgromes
f53d5b9027 [FSK4] Fixed issues found by cppcheck 2024-05-11 20:32:41 +01:00
jgromes
0f0ab73832 [EXT] Fixed issues found by cppcheck 2024-05-11 20:32:32 +01:00
jgromes
914c616c2a [Bell] Fixed issues found by cppcheck 2024-05-11 20:32:20 +01:00
jgromes
98bae46c33 [AX25] Fixed issues found by cppcheck 2024-05-11 20:32:02 +01:00
jgromes
ac07269f97 [APRS] Fixed issues found by cppcheck 2024-05-11 20:31:57 +01:00
jgromes
d61589a2c5 [AFSK] Fixed issues found by cppcheck 2024-05-11 20:31:01 +01:00
jgromes
44b2dcaa15 [CI] Update cppcheck config to unclutter output 2024-05-11 17:23:23 +01:00
jgromes
3d9815f93d Use explicit constructors for base classes 2024-05-11 17:22:57 +01:00
jgromes
e35689cbaa [nRF24] Fixed issues found by cppcheck 2024-05-11 17:20:19 +01:00
jgromes
2f867153f9 [Si443x] Fixed issues found by cppcheck 2024-05-11 17:15:25 +01:00
jgromes
c641099e9f [SX127x] Fixed issues found by cppcheck 2024-05-11 16:49:51 +01:00
jgromes
dec7265f72 [SX128x] Fixed issues found by cppcheck 2024-05-11 16:49:29 +01:00
jgromes
a643d0db7a [LR11x0] Fixed issues found by cppcheck 2024-05-10 20:45:54 +01:00
jgromes
4d7c16bd44 [RF69] Fixed issues found by cppcheck 2024-05-10 20:45:36 +01:00
jgromes
46e6f78731 [LR11x0] Fixed inverted deallocation logic 2024-05-08 20:13:57 +01:00
jgromes
d12e9f11f5 [LoRaWAN] Added timeout to downlink wait loop 2024-05-08 15:29:39 +02:00
jgromes
c494b983f5 [LR11x0] Added methods for LoRaWAN compatibility 2024-05-08 14:55:48 +02:00
jgromes
2f06885f9f [SX126x] Remove copypate from setSyncBits 2024-05-08 14:55:19 +02:00
jgromes
8a4514703b [SX128x] Use 32-bit IRQ flags 2024-05-08 14:54:33 +02:00
jgromes
bfb7c8dd3b [SX126x] Use 32-bit IRQ flags 2024-05-08 14:54:22 +02:00
jgromes
8eac3f1bf2 [SX127x] Use 32-bit IRQ flags 2024-05-08 14:53:01 +02:00
jgromes
df9e9ee68c [Si443x] Use 32-bit IRQ flags 2024-05-08 14:52:51 +02:00
jgromes
be56474596 [RF69] Use 32-bit IRQ flags 2024-05-08 14:52:42 +02:00
jgromes
44afc5a6f5 [nRF24] Use 32-bit IRQ flags 2024-05-08 14:52:31 +02:00
jgromes
2a776f4c09 [CC1101] Use 32-bit IRQ flags 2024-05-08 14:52:15 +02:00
jgromes
90eca88859 [LoRaWAN] Use 32-bit IRQ flags 2024-05-08 14:51:43 +02:00
jgromes
2c9446ef1e [LoRaWAN] Added rx start assert 2024-05-08 14:50:34 +02:00
jgromes
3b62c88a2e [SX126x] Fixed issues found by cppcheck 2024-05-05 20:11:02 +01:00
jgromes
4f52738ed4 [LLCC68] Fixed issues found by cppcheck 2024-05-05 20:10:46 +01:00
jgromes
26fb617062 [MOD] Make cmd pointer const 2024-05-05 19:47:09 +01:00
jgromes
4f1e5c5521 [LR11x0] Added LoRa header configuration methods 2024-05-05 20:42:06 +02:00
jgromes
bcd8a05cd4 [SX128x] Added interface for interrupt-driven CAD (#1085) 2024-05-05 12:42:03 +01:00
jgromes
86cdefe8a2 [LR11x0] Added support for WiFi scanning 2024-05-05 11:35:35 +02:00
StevenCellist
bb7fffe95d [LoRaWAN] Improve readability to better match documentation 2024-05-04 23:26:59 +02:00
StevenCellist
bbeca9a53e [LoRaWAN] Consistent fOpts casing to match documents 2024-05-04 23:21:45 +02:00
StevenCellist
163a4020d2 [LoRaWAN] Consistent fCnt/fPort casing to match documents 2024-05-04 23:18:36 +02:00
StevenCellist
43adfee174 [LoRaWAN] Shorten LORAWAN to LW 2024-05-03 22:58:11 +02:00
jgromes
639ff00109 [SSTV] Added image converter tool 2024-05-03 21:28:18 +01:00
jgromes
b675e0c034 Fix RPi example flags 2024-05-03 21:05:44 +01:00
jgromes
6fe581aea7 Fix minor format warnings 2024-05-03 20:54:18 +01:00
jgromes
7209690bf6 [Mod] Fixed hexdump not escaping format specifiers 2024-05-01 19:12:22 +01:00
jgromes
92cb09a932 [CC1101] Resolve issues reported by cppcheck 2024-05-01 18:05:16 +01:00
jgromes
809025eba6 [Mod] Fix issues from cppcheck scan 2024-05-01 15:51:01 +01:00
jgromes
cb9cb87556 [HAL] Make ArduinoHal constructor explicit 2024-05-01 15:41:24 +01:00
jgromes
97adb260ce [CI] Enable cppcheck inline suppression and suppres unchecked config 2024-05-01 15:40:08 +01:00
jgromes
05e35407f4 [FSK4] Use abs macro instead of abs function 2024-05-01 15:14:44 +02:00
Alistair Francis
2f85326fec
examples/NonArduino/Tock: Support RISC-V and bump libtock-c (#1082)
* examples/NonArduino/Tock: Support building for RISC-V

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

* examples/NonArduino/Tock: Update to newer libtock-c

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

---------

Signed-off-by: Alistair Francis <alistair@alistair23.me>
2024-05-01 15:12:05 +02:00
StevenCellist
1b2b8bd67b
[LoRaWAN] Improve PHY behaviour, update beginABP, bugfixes (#1080)
* [LoRaWAN] Add getter for ToA, prevent MAC queue overflow

* [LoRaWAN] Permute arguments to beginABP

* Implement & split off checkOutputPower

* [LoRaWAN] Configure physical layer on each up/downlink

* [LoRaWAN] Remove unnecessary dynamic array

* [LoRaWAN] Improve downlink handling

* Resolve return-warnings in checkOutputPower()

* [LoRaWAN] Improve buffer definition

* [LoRaWAN] Prevent requesting repeated MAC commands

* Update keywords.txt

* [CC1101] Resolve unused variable warning

* [CC1101] Update checkOutputPower

* [SX1278] Fix variable assignment

* Update keywords.txt

* [CC1101] Added checkOutputPower override for PHY compatibility

* [LR11x0] Added checkOutputPower override for PHY compatibility

* [SX127x] Added checkOutputPower override for PHY compatibility

---------

Co-authored-by: jgromes <jan.gromes@gmail.com>
2024-05-01 13:35:22 +02:00
jgromes
841b283c0f [LoRaWAN] Use dynamic array instead of VLA 2024-04-26 07:04:16 +02:00
Elizabeth Myers
205031550b
Use RadioLibTime_t (aka unsigned long) when dealing with millis() and micros() (#1075)
* Use unsigned long when dealing with millis() and micros().

Although sizeof(uint32_t) == sizeof(unsigned long) on Arduino, this is
not the case on 64-bit Linux, where sizeof(unsigned long) ==
sizeof(uint64_t).

Most timestamp arithmetic and comparisons have been left alone, to
reduce code churn. This is fine, as uint32_t is perfectly wide to store
most timestamp deltas this library will deal with, and C will promote
the integer rather than do a narrowing conversion. The real problem
arises with narrowing conversions being done by assuming timestamps are
32-bit.

No functional changes intended for platforms where sizeof(uint32_t) ==
sizeof(unsigned long) (so most 8/16/32-bit platforms).

Signed-off-by: Elizabeth Myers <elizabeth.jennifer.myers@gmail.com>

* Change most timestamps to use RadioLibTime_t.

This makes it obvious what is and isn't a timestamp.

Not everything has been converted; anything dealing with protocol and
chip-level timestamps has been left alone on purpose, to make it clear
that these functions do require 32-bit timestamps.

No functional changes intended on platforms where sizeof(uint32_t) ==
sizeof(unsigned long).

Signed-off-by: Elizabeth Myers <elizabeth.jennifer.myers@gmail.com>

* Use uint32_t internally in getTimeOnAir.

We need to not overflow the integers with the shifts and
multiplications, so this is correct behaviour.

Signed-off-by: Elizabeth Myers <elizabeth.jennifer.myers@gmail.com>

---------

Signed-off-by: Elizabeth Myers <elizabeth.jennifer.myers@gmail.com>
2024-04-25 21:50:58 +02:00
jgromes
ecfc18c35d [CC1101] Fix RSSI readout (#1077) 2024-04-25 20:03:06 +02:00
jgromes
43ca08d8ee [LR11x0] Added LR1120/21 classes 2024-04-21 15:24:49 +02:00
jgromes
e8a6297c60 [LR11x0] Added support for LR-FHSS 2024-04-21 15:01:57 +02:00
jgromes
ce4d9aa150 [LR11x0] Fixed LoRa CRC configuration 2024-04-21 08:47:27 +02:00
jgromes
9451f36332 [LR11x0] Use IRQ instead of DIO1 as pin name 2024-04-21 08:34:00 +02:00
jgromes
01208574d9 [LR11x0] Added CAD support (#679) 2024-04-20 21:29:32 +02:00
jgromes
b283c1b117 Added LR11x0 to supported protocols 2024-04-20 18:07:27 +02:00
jgromes
3c502b9cdf [AX25] Fix direct mode start 2024-04-20 18:05:57 +02:00
jgromes
99d2e6c452 [LR11x0] Added direct mode support 2024-04-20 18:05:31 +02:00
jgromes
6fa4aa3ebb [LR11x0] Added GFSK modem support (#679) 2024-04-19 20:30:53 +02:00
jgromes
4d1157e3a4 Add LR11x0 to readme and library tags 2024-04-14 19:51:59 +01:00
jgromes
88e1411399 [LR11x0] Fix potential use after free 2024-04-14 19:42:14 +01:00
jgromes
4a6e182789 [LR11x0] Fix virtual method hiding (#679) 2024-04-14 20:38:12 +02:00
jgromes
7bb747fdba [LR11x0] Add missing header for non-Arduino paltforms (#679) 2024-04-14 19:29:35 +01:00
jgromes
f956a66ef2 [LR11x0] Fix typos in variable names 2024-04-14 19:29:12 +01:00
jgromes
23f45153c1 [LR11x0] Suppress warnings for unimplemented features 2024-04-14 19:28:54 +01:00
jgromes
6d232a64cf Merge branch 'master' of https://github.com/jgromes/RadioLib 2024-04-14 20:23:00 +02:00
jgromes
77ed4452ae [LR11x0] Added basic LR11x0 support (#679) 2024-04-14 20:22:55 +02:00
jgromes
e7da14421d [Mod] Fix SPI command byte order 2024-04-14 20:22:16 +02:00
jgromes
46ef20ebe9 Fix interrupt emulation in Raspberry Pi example 2024-04-14 14:37:55 +01:00
Velocet
91f89fa1f3
Updated board definitions for the LoRaWAN Examples (#1052)
* Update README.md

Clarify intended purpose. Remove unsupported modules.

* Update board configs in configABP.h

Added HelTec boards and corrected some errors

* Update board configs in config.h

Added HelTec boards and corrected some errors

* Update board configs in config.h

Added HelTec boards and corrected some errors

* Update prebuilt modules in notes.md

* Delete README.md

* Recreate README.md
2024-04-14 08:15:50 +02:00
jgromes
c11ac4703b [SX127x] Fixed getRSSI overload for PhysicalLayer (#1064) 2024-04-13 21:21:33 +02:00
jgromes
d77823375a [LoRaWAN] Generate random numbers instead of digital/analog read (#1056) 2024-04-09 22:18:40 +02:00
jgromes
c9d8c601df [Mod] Use enum for bit widths 2024-04-07 17:34:31 +01:00
jgromes
f982314858 Eanble all warnings in CMake 2024-04-07 16:13:33 +01:00
Jan Gromeš
4fa0656ddd
[MOD] SPI configuration interface rework (#1057)
* [MOD] Rework SPI config interface

* [CC1101] Rework SPI config interface

* [nRF24] Rework SPI config interface

* [SX126x] Rework SPI config interface

* [SX128x] Rework SPI config interface

* Fix missing moved debug info

* [MOD] Fix signed warnings
2024-04-07 17:05:07 +02:00
jgromes
f61be0d273 [SX126x] Added public method to set PA ramp time (#1054) 2024-04-05 17:30:05 +02:00
jgromes
263f7883cf [SX126x] Use integer frequency for band selection 2024-04-04 21:31:09 +02:00
jgromes
a387b3b706 [SX126x] Fix image calibration (#1051) 2024-04-04 21:28:17 +02:00
jgromes
5d741779a1 [SX126x] Use predefined image calibration bands (#1051) 2024-04-04 21:27:12 +02:00
StevenCellist
aa46a0c8b3 [LoRaWAN] Hide broken CSMA 2024-04-02 22:25:50 +02:00
StevenCellist
a4ad32e6ff [LoRaWAN] Fix downlink crashes (#1049), remove redundant parameter 2024-04-02 22:24:06 +02:00
Matthias Prinke
fbee7471c7
[LoRaWAN] Added pin maps (#1047)
* Added pin maps

* Modified pin map for ARDUINO_TTGO_LORA32_V2 (DIO1 not connected & not needed)
2024-04-01 21:03:38 +02:00
jgromes
e7ee407b0d [Doc] Additional doxygen fixes 2024-04-01 12:11:13 +02:00
Jan Gromeš
e57c9b08ea
[Doxygen] Warnings fixes (#1046)
* [APRS] Fix Doxygen warnings

* [Print] Fix Doxygen warnings

* [CC1101] Fixed doxygen warnings

* [nRF24] Fixed doxygen warnings

* [RF69] Fixed doxygen warnings

* [SX126x] Fixed doxygen warnings

* [SX127x] Fixed doxygen warnings

* [AFSK] Fixed doxygen warnings

* [APRS] Fixed doxygen warnings

* [Bell] Fixed doxygen warnings

* [Ext] Fixed doxygen warnings

* [LoRaWAN] Fixed doxygen warnings

* [PHY] Fixed doxygen warnings

* [Print] Fixed doxygen warnings

* [Mod] Fixed doxygen warnings
2024-04-01 11:11:24 +02:00
Jonathan Bennett
e5493618a4
Update ArduinoHal.h to make spi and friends protected (#1044)
Most of the "override" functions here can't actually be overridden in a useful way when spi, spiSettings, and everything else is marked private. If everything is override, then nothing should be private.
2024-03-31 21:43:30 +02:00
Jan Gromeš
9daf4c4f26
[CI] Minor fixes (#1045)
* [CI] Add Teensy back in

* [CI] Add Arduino 101 back to build matrix

* [CI] Try different path to libs

* [CI] Skip LoRaWAN on Teensy
2024-03-31 21:41:12 +02:00
StevenCellist
b2c7e98d6c
Update examples/LoRaWAN/README 2024-03-30 09:33:30 +01:00
jgromes
721a44c6e4 [RF69] Fix copy-pate error (#1013) 2024-03-29 08:40:25 +01:00
jgromes
88f26c4aab [SX126x] Use millis for timeouts (#1013) 2024-03-29 08:36:51 +01:00
jgromes
fb7d698007 [SX127x] Use millis for timeouts 2024-03-29 08:36:05 +01:00
jgromes
8098bea254 [SX128x] Use millis for timeouts 2024-03-29 08:35:29 +01:00
jgromes
eba32d7dcd [Si443x] Use millis for timeouts 2024-03-29 08:35:08 +01:00
jgromes
5980e0fb00 [RF69] Use millis for timeouts 2024-03-29 08:34:56 +01:00
jgromes
aafe96faf8 [nRF24] Use millis for timeouts 2024-03-29 08:34:48 +01:00
jgromes
936a39ad98 [CC1101] Use millis for timeouts 2024-03-29 08:34:35 +01:00
Crsarmv7l
1fb5100413
[CC1101] 3 New CC1101 Functions (#1038)
* getFrequency implementation

* getFrequency Method

* Get bitrate method

* getBitRate

* CalcRxBandwidth() method

* CalcRxBandwidth();

* Fix Notes

* Changes for pull

* Changes for pull 2

* Update keywords.txt

* Revert to hopefully bring in current

* Fix ()

* Re add
2024-03-28 18:44:10 +01:00
jgromes
0707a326a5 Bump version to 6.5.0 2024-03-27 19:03:51 +01:00
jgromes
78211e7566 [LoRaWAN] Added specific error code for no downlink received 2024-03-27 18:48:16 +01:00
jgromes
b91fd2bdad [CI] Disable LoRaWAN CI build for Apollo3 (unable to pass flags) 2024-03-26 21:23:54 +01:00
jgromes
9cf04b633d [CI] Disable LoRaWAN CI build for UNO R4 (unable to pass flags) 2024-03-26 20:40:43 +01:00
jgromes
5c891ae337 [LoRaWAN] Do not use analog pin macros that may not be defined 2024-03-26 20:23:53 +01:00
jgromes
5391d5d383 [LoRaWAN] Add cast for DevAddr print 2024-03-26 20:15:03 +01:00
jgromes
c77670c076 [CI] Disable build for Arduino 101 (platform broken) 2024-03-26 20:03:54 +01:00
jgromes
7b5211130a [CC1101] Fix doxygen comment 2024-03-26 07:27:16 +01:00
jgromes
0ed586a840 [CC1101] Fixup tabs 2024-03-26 07:26:16 +01:00
Crsarmv7l
b3ed84a035
[CC1101] PQT = 0 in setPromiscuous (#1033)
* PQT = 0 in setPromiscuous

* Carriersense in promiscuous

* carriersense to promiscuous

* Fix explanation
2024-03-26 07:24:02 +01:00
Jan Gromeš
648b455cff
[LoRaWAN] Added array of supported bands (#1032) 2024-03-26 06:57:25 +01:00
Jan Gromeš
9e4783cf8b
[CI] Fix for new LoraWAN examples (#1035)
* Update CI for new LoRaWAN examples

* Use single line for flags

* Fixup flag strings

* Fixup array dump helper

* Added missing LoRaWAN defines

* Drop Teensy from CI (still broken)

* Define a board for CI runs
2024-03-26 06:55:37 +01:00
StevenCellist
9c6eb20169
Merge pull request #1034: update LoRaWAN examples 2024-03-25 18:04:13 +01:00
Nick McCloud
388a714e53 Added uplink complete msg 2024-03-25 14:21:14 +00:00
HeadBoffin
14e1a9bd42
Update notes.md 2024-03-25 14:09:09 +00:00
StevenCellist
61b94bf4fc
Fix typos in the LoRaWAN Starter notes 2024-03-25 14:13:57 +01:00
StevenCellist
2d454bdc61
Populate README with direct links to (persistence) examples 2024-03-25 14:05:54 +01:00
HeadBoffin
2f1efdb8a0
Create README.md 2024-03-25 13:00:22 +00:00
StevenCellist
d1b911b273
Add link to persistence repository in LoRaWAN Reference example 2024-03-25 13:42:52 +01:00
StevenCellist
18c1ce47b4
Improve introductory comments in LoRaWAN ABP example 2024-03-25 13:41:04 +01:00
Nick McCloud
c0ebd5a92e Header comments & ABP 2024-03-25 11:55:29 +00:00
HeadBoffin
ff5ade2aa1
Merge pull request #1 from jgromes/master
LoRaWAN examples update
2024-03-25 11:17:57 +00:00
Nick McCloud
5bc97550ec Clean up prior named directories plus neglected Reference is included 2024-03-23 17:03:21 +00:00
Nick McCloud
0182a123fb Update of examples to latest API, testing, repeat 2024-03-23 17:00:13 +00:00
Jan Gromeš
cfc425970c
[LoRaWAN] Resolve warnings, fix bugs for fixed bands (#1021)
* [LoRaWAN] Resolve warnings

* [LoRaWAN] Fixed bands: improve initial datarate, fix CFList bug

* [LoRaWAN] Improve MAC debug output formatting

* Fix hexdump debug level

* Remove unnecessary error, add new ones to keywords

* [LoRaWAN] Discard useless check

---------

Co-authored-by: StevenCellist <steven@boonstoppel.nu>
2024-03-18 16:39:55 +01:00
jgromes
44f6c1d432 [CI] Enable LoRaWAN builds for previously disabled platforms 2024-03-18 09:37:16 +01:00
StevenCellist
ca2a3073b9
[LoRaWAN] Change and upgrade persistence handling (#1017)
* [LoRaWAN] Change and upgrade persistence handling

* [BuildOpt] Patch to upstream

* [LoRaWAN] Fix #1018

* [LoRaWAN] Remove outdated parts

* [LoRaWAN] Resolve feedback

Warning: untested - am not at my desk

* [LoRaWAN] Small bugfixes
2024-03-18 08:51:38 +01:00
Jan Gromeš
3d5f05b963
Static check (#1019)
* Update CodeQL action

* [CI] Added workflow dispatch for codeql

* [CI] Use v4 checkout action

* [CI] Add cppcheck action (#1018)
2024-03-17 18:10:54 +01:00
jgromes
0b11d101aa [CC1101] Clarify direct methods are synchronous (#1016) 2024-03-15 19:32:57 +01:00
jgromes
9fd7db4d13 [SX126x] Fix rx/tx fallback mode (#1008) 2024-03-13 07:00:20 +01:00
jgromes
b288485d6c [SX126x] Added option to select standby mode (#1008) 2024-03-12 21:52:17 +01:00
jgromes
24ffbfc284 Added ESP IRAM attribute to examples (#1010) 2024-03-10 20:40:41 +01:00
jgromes
4993ac7c9d Added links to troubleshooting guide 2024-03-10 12:44:04 +01:00
jgromes
4ee17cc168 Debugging rework 2024-03-10 11:07:23 +01:00
jgromes
9774a2299b Update issue template for new debug levels 2024-03-10 09:56:23 +01:00
jgromes
cf561733d2 [Pager] Minor fixes 2024-03-02 18:09:56 +01:00
Jan Szumiec
268e2d704f
Receive messages for multiple POCSAG RICs (#998)
* Make it possible to supply a list of addresses for POCSAG reception.

* Initialize some instance variables to sensible values.
2024-03-02 18:01:32 +01:00
Nick McCloud
a926d5e13a Change the names to protect the innocent 2024-03-02 14:01:32 +00:00
Nick McCloud
3d8c2e866d WIP Starter for preview 2024-03-02 13:54:49 +00:00
Nick McCloud
ec9126dae0 Added last updated dates & corresponding RadioLib version number 2024-03-01 09:48:55 +00:00
Nick McCloud
7389d74e69 Update the reference version to latest LW code base 2024-03-01 09:46:38 +00:00
Nick McCloud
22045d7189 Range of tweaks & dutycycle / FUP 2024-02-28 20:46:47 +00:00
jgromes
744834509f Merge branch 'master' of https://github.com/jgromes/RadioLib 2024-02-28 18:09:26 +01:00
jgromes
10acb6d9ca Added ESP-IDF badge to readme 2024-02-28 18:09:24 +01:00
Nicklas Börjesson
a52920bcb2
IDF Component Registry manifest (#990)
* Add idf_component.yxml

* Fix URL, add compote dist to .gitignore
2024-02-28 17:50:04 +01:00
StevenCellist
5766d386af
[LoRaWAN] Improve persistence behaviour, add dwell time error, clear up debug output (#980)
* [LoRaWAN] Improve examples, add getter for DevAddr

* [ArduinoHAL] Only (over)write new values

* [HAL] Fix comment

* [TypeDef] Introduce error for LoRaWAN dwell time

* [LoRaWAN] Improve persistence behaviour, add dwell time error, clear up debug output

* [LoRaWAN] Prevent incorrect behaviour in restore()

* [LoRaWAN] Improve example comments and persistence

* [LoRaWAN] Fix DeviceTime and LinkCheck, fix FcntUp offset

* [LoRaWAN] Fix example incorrectly processing MAC commands

* [LoRaWAN] Fix downlink port, Fcnt 'underflow', user MAC processing

* [LoRaWAN] Add simple receive methods

* [LoRaWAN] Add co-author

Co-Authored-By: HeadBoffin <60431281+HeadBoffin@users.noreply.github.com>

* [LoRaWAN] Fix example output

* [LoRaWAN] Improve persistence behaviour, bugfix subband

* [LoRaWAN] Prevent useless rejoin during nonpersistent session

* [LoRaWAN] Graciously block an uplink if not joined

---------

Co-authored-by: HeadBoffin <60431281+HeadBoffin@users.noreply.github.com>
2024-02-27 17:29:45 +01:00
Jan Gromeš
5c30bb1e32
[CI] Run apt-get update before install (#989) 2024-02-27 17:16:33 +01:00
jgromes
9f0bdffc50 [LoRaWAN] Use ESP_PLATFORM macro to include esp_attr.h (#952) 2024-02-25 18:02:31 +01:00
StevenCellist
0ea00fad44
[LoRaWAN] Improve examples, add getter for DevAddr (#974) 2024-02-15 20:36:03 +01:00
StevenCellist
bb239468ef
Merge pull request #970 from barnslig/master
[LoRaWAN] Fix fcntUp wrap-around after 50 transmissions
2024-02-14 18:55:21 +01:00
Leonard Techel
ea2ccfd6d0 [LoRaWAN] Fix fcntUp wrap-around after 50 transmissions
Resolves #950
2024-02-13 19:58:02 +01:00
jgromes
a907026c7b [SX127x] Fixed software timeout duration (#962) 2024-02-13 07:04:04 +01:00
Olivér Remény
e4267760f9
Fix stringop-truncation warning in AX25 callsign getter (#958)
* Update LoRaWAN.cpp

* Update Pager.cpp

* Update AX25.cpp

Fixed stringop-truncation error
2024-02-11 09:41:41 +01:00
Olivér Remény
7945ffb996
include esp_attr.h where IRAM_ATTR is used (#952)
* Update LoRaWAN.cpp

* Update Pager.cpp
2024-02-02 16:57:43 +01:00
jgromes
bce14023f9 [PHY] Fixed godmode not exposing private member (#950) 2024-02-02 16:36:50 +01:00
jgromes
547328f375 Bump version to 6.4.2 2024-01-28 14:04:33 +01:00
jgromes
d208f46f93 [LoRaWAN] Added data rate check debug print 2024-01-28 13:31:08 +01:00
jgromes
a168f9ba41 [SX127x] Fixed data rate checking 2024-01-28 13:29:14 +01:00
jgromes
118980fd27 [SX126x] Fixed data rate checking (#948) 2024-01-28 13:28:48 +01:00
jgromes
5ebea18572 [LLCC68] Fixed data rate checking 2024-01-28 13:28:21 +01:00
jgromes
a44a3daa1c [LoRaWAN] Removed unsupported initializer (CI_BUILD_ALL)[ 2024-01-27 19:05:44 +01:00
jgromes
070a0bf240 [LoRaWAN] Fixed missing bracket (CI_BUILD_ALL) 2024-01-27 19:00:16 +01:00
jgromes
50d335e339 [CI] Skip LoRaWAN on MegaAVR (CI_BUILD_ALL) 2024-01-27 18:58:36 +01:00
jgromes
7c50be3158 [LoRaWAN] Add explicit initialization 2024-01-27 18:57:11 +01:00
jgromes
139574d963 Bump version to 6.4.1 2024-01-27 18:50:16 +01:00
jgromes
1c8d2d5cfb [LoRaWAN] Typo fixes 2024-01-27 18:49:34 +01:00
jgromes
f35e3282f5 [LoRaWAN] Added ADR data rate check (#946) 2024-01-27 18:47:40 +01:00
jgromes
f109fd0158 [LLCC68] Fixed set data rate for LLCC68 (#946) 2024-01-27 18:47:05 +01:00
jgromes
a642f5a8df [SX126x] Implemented data rate check 2024-01-27 18:46:22 +01:00
jgromes
a4b148d609 [SX127x] Implemented data rate check 2024-01-27 18:45:37 +01:00
jgromes
b734e23460 [PHY] Added data rate check method 2024-01-27 18:23:52 +01:00
Jan Gromeš
a981f9828a
Merge pull request #942 from StevenCellist/master
[LoRaWAN] Fix channel logic: for fixed bands, persistence of dynamic bands, rejoining during active session
2024-01-27 16:12:17 +01:00
jgromes
1025abce8b [CI] Fixed SDK path export 2024-01-27 14:07:46 +01:00
jgromes
9053786c02 Added RPi Pico build to CI 2024-01-27 14:03:58 +01:00
jgromes
eaa42b0d6b Update RPi Pico SDK example 2024-01-27 14:03:40 +01:00
Jan Gromeš
33f1ef7d22
Merge pull request #941 from cameron-goddard/master
examples: NonArduino: Raspberry Pi Pico
2024-01-27 13:54:27 +01:00
StevenCellist
b98a5c6b29 [LoRaWAN] Fix Tx power calculation 2024-01-24 08:46:10 +01:00
StevenCellist
51ab103d07 [LoRaWAN] Keep Dev/JoinNonce on OTAA wipe with same credentials 2024-01-23 09:04:25 +01:00
StevenCellist
9008fb00a7 [LoRaWAN] Fix setDatarate function 2024-01-22 14:38:35 +01:00
StevenCellist
ee542c3b56 [LoRaWAN] Fix dynamic-band non-ADR session persistance 2024-01-22 13:34:00 +01:00
StevenCellist
aedf519ea4 [LoRaWAN] Fix rejoining during active session 2024-01-22 12:53:18 +01:00
StevenCellist
4ec10a4749 [LoRaWAN] Fix fixed band CFList processing 2024-01-22 12:32:15 +01:00
StevenCellist
6979bff863 [LoRaWAN] Improve channel masks for fixed bands 2024-01-22 11:40:57 +01:00
Cameron Goddard
e558f541e1 add Pico HAL 2024-01-21 15:39:28 -05:00
Jan Gromeš
86136d3b46
Merge pull request #936 from StevenCellist/master
[LoRaWAN] Fix session restore throwing unnecessary error
2024-01-20 19:04:14 +01:00
StevenCellist
598228fba0 [LoRaWAN] Fix session restore throwing unnecessary error 2024-01-20 11:03:54 +01:00
jgromes
4c5321e5cb [SX1233] Fix incorrect exclude macro guard (#929) 2024-01-14 21:56:18 +01:00
jgromes
efe303ca69 [LoRaWAN] Properly size fopts buffer 2024-01-14 19:05:52 +01:00
jgromes
8c5ae6d266 [LoRaWAN] Remove variable length array (CI_BUILD_ALL) 2024-01-14 18:25:51 +01:00
jgromes
132aae944f [LoRaWAN] Fix Module* not needed without persistent storage 2024-01-14 18:25:04 +01:00
jgromes
718dae3f35 [CI] Temporarily remove Teensy (CI_BUILD_ALL) 2024-01-14 17:08:54 +01:00
jgromes
3cbf6669df [CI] Temporarily remove Teensy from CI (broken platform) (CI_BUILD_ALL) 2024-01-14 17:00:24 +01:00
jgromes
ea66037c11 [STM32WL] Fix Module pinter (CI_BUILD_ALL) 2024-01-14 16:48:32 +01:00
jgromes
d301aa6a37 [SX126x] Fix txMode made private 2024-01-14 16:48:06 +01:00
jgromes
b2d1306e9e [LoRaWAN] Simplify variable length arrays (CI_BUILD_ALL) 2024-01-14 16:40:23 +01:00
jgromes
1467f98202 [CI] Remove LoRaWAN from megaAVR platform 2024-01-14 16:37:48 +01:00
jgromes
1681eeead3 [LoRaWAN] Fix MAC command initialization 2024-01-14 16:37:01 +01:00
jgromes
be52cd8edd [LoRaWAN] Fix possible integer overflow 2024-01-14 16:33:17 +01:00
jgromes
e392c7b91f [LoRaWAN] Fixed duty cycle enable ignored (CI_BUILD_ALL) 2024-01-14 16:31:24 +01:00
jgromes
8c1d0521c5 [SX127x] Removed extra semicolons 2024-01-14 16:29:57 +01:00
jgromes
c1bf281f21 Bump version to 6.4.0 2024-01-14 16:00:57 +01:00
Jan Gromeš
d1d6e04f2b
Merge pull request #928 from plietar/master
[CC1101] Correctly wait for packet end on blocking receive.
2024-01-13 19:20:04 +01:00
Paul Lietar
ab41bcac00 [CC1101] Correctly wait for packet end on blocking receive.
When using a blocking receive, I was getting non-sensical packet length
and garbage data, whereas IRQ mode was working fine. This was happening
despite what looked like a workaround for this in the code which would
read the length twice.

I tracked it down to the receive function trying to read the data too
early, before the packet had even been received. The receive function
would wait for the GDO0 pin to become low, then assume the packet was
ready and read off the data.

However, the GD0 pin is set by the `startReceive` as inverted and,
according to the datasheet, in a mode which "asserts when sync word has
been received, and de-asserts at the end of the packet". In other words,
taking into account the inversion, GDO0 becomes low at the start of the
packet and high at the end of it.

Therefore the receive function would actually try to read the packet
data as soon as the packet had started, rather than wait until the end,
explaining the garbage data.

I suspect that with a slow MCU and a fast transmission rate, the
previous workaround of reading the length field twice may have delayed
the data read just enough to allow the packet to be fully received, but
this does not work in the general case.

This commit updates the logic by first waiting for a low signal,
followed by a high one. This is actually the exact same logic used in
the blocking transmit implementation, but inverted to account for the
INV flag set on GDO0. The commit also removes the past workaround, since
it should not be necessary anymore.
2024-01-13 17:18:23 +00:00
Jan Gromeš
cb0218009d
Merge pull request #918 from StevenCellist/master
[LoRaWAN] Revamp internal processing, key checking, new MAC commands, implement DutyCycle & DwellTime
2024-01-13 16:27:00 +01:00
jgromes
842c54849d [SX127x] Added setLowBatteryThreshold (#925) 2024-01-13 13:39:51 +01:00
StevenCellist
3338034ac7 [LoRaWAN] Update examples 2024-01-13 00:15:52 +01:00
StevenCellist
0bba68f3ae [LoRaWAN] Rework channel logic 2024-01-13 00:05:25 +01:00
jgromes
30961964c5 [CC1101] Cleanup private/protected members 2024-01-12 20:35:10 +01:00
jgromes
1575e37355 [nRF24] Cleanup private/protected members 2024-01-12 20:29:09 +01:00
jgromes
3a5d9b5c32 [RF69] Cleanup private/protected members 2024-01-12 20:26:07 +01:00
jgromes
935c316f7c [Si443x] cleanup 2024-01-12 20:14:18 +01:00
jgromes
d31b4836e1 [Si443x] Cleanup private/protected members 2024-01-12 20:12:45 +01:00
jgromes
34d80faaf0 [SX126x] Cleanup private/protected members 2024-01-12 20:00:08 +01:00
jgromes
948088c1e1 [SX128x] Moved setHeaderType to private methods 2024-01-12 19:49:17 +01:00
jgromes
b5d931ec79 [SX128x] Cleanup private/protected members 2024-01-12 19:45:41 +01:00
jgromes
bbe407b50f [SX127x] Cleanup private/protected members 2024-01-12 18:51:55 +01:00
Jan Gromeš
7e95fdfe7b
Merge pull request #923 from peterus/peterus-patch-1
fix warning/error: compound assignment with 'volatile'-qualified left operand is deprecated
2024-01-11 18:20:33 +01:00
Peter Buchegger
abfc91a9bc
Update SX127x.cpp 2024-01-11 17:52:50 +01:00
Peter Buchegger
6600860915
Update RF69.cpp 2024-01-11 17:51:39 +01:00
StevenCellist
d0979ce853 [LoRaWAN] Fix checksum calculation 2024-01-08 23:36:17 +01:00
StevenCellist
7c676f9393 [LoRaWAN] Implement requested changes 2024-01-08 22:33:34 +01:00
StevenCellist
2da09b5adc [LoRaWAN] Convert setDatarate() and setTxPower() to internal MAC; improve ADR 2024-01-06 15:03:55 +01:00
StevenCellist
f7730463bd [LoRaWAN] Fix ADR bug if not enabled 2024-01-05 13:41:00 +01:00
StevenCellist
00264f48a9 [HAL] Fix a comment 2024-01-05 11:49:59 +01:00
StevenCellist
853c1731ca [LoRaWAN] Fix warnings 2024-01-05 11:36:01 +01:00
StevenCellist
574555ca09 [LoRaWAN] Revamp internal processing, key checking, new MAC commands, implement DutyCycle & DwellTime 2024-01-05 11:06:24 +01:00
jgromes
bf061c655f [SX126x] Allow custom band calibration 2024-01-04 18:30:22 +01:00
jgromes
19b61739e6 [SX126x] Fixed image calibration 2024-01-04 18:23:36 +01:00
jgromes
3478d90819 [SX126x] Improved image calibration 2024-01-04 18:21:35 +01:00
jgromes
cc76bad06f Fix tabs 2023-12-30 23:03:16 +01:00
Jan Gromeš
7d6ddfa9f4
Merge pull request #914 from StevenCellist/master
[LoRaWAN] Fix ABP initialization, support MAC in payload
2023-12-30 09:01:05 +01:00
StevenCellist
797b7a4323 [LoRaWAN] Fix macros 2023-12-29 23:53:44 +01:00
StevenCellist
badcbbe809 [LoRaWAN] Fix ABP initialization, support MAC in payload 2023-12-29 16:38:55 +01:00
jgromes
6bac59ce08 [CC1101] Fixed direct transmit (#911) 2023-12-22 15:04:19 +01:00
Jan Gromeš
fa9054263d
Merge pull request #900 from StevenCellist/master
[LoRaWAN] Expose downlink framecounters
2023-12-09 16:24:53 +01:00
jgromes
a30d3da296 [SX123x] Added note about high bit rate mode for SX1233 2023-12-09 16:12:10 +01:00
jgromes
57a6a9ccc3 [SX123x] Added missing include 2023-12-09 16:00:42 +01:00
jgromes
af9073fae4 [RF69] Make setMode protected 2023-12-09 15:38:38 +01:00
jgromes
4639cb5875 Merge branch 'master' of https://github.com/jgromes/RadioLib 2023-12-09 15:34:58 +01:00
jgromes
c0d8d7871e [SX123x] Added support for SX1233 (#898) 2023-12-09 15:34:56 +01:00
StevenCellist
fc8d80c9de
Merge branch 'jgromes:master' into master 2023-12-09 10:31:13 +01:00
StevenCellist
62276e070b [LoRaWAN] Expose downlink framecounters 2023-12-09 10:28:13 +01:00
Jan Gromeš
b30b7c6dad
Merge pull request #899 from xNombre/master
LoRaWAN: Fix broken node when memory is dynamically allocated
2023-12-08 19:21:16 +01:00
Andrzej Perczak
79fbe9be8e LoRaWAN: Fix uninitialized variables 2023-12-08 18:34:21 +01:00
Jan Gromeš
77562c963a
Merge pull request #896 from S5NC/removeDuplicateRADIOLIBNameInMacros
Remove last remaining duplicate 'RADIOLIB's from macros
2023-12-01 07:05:44 +01:00
S5NC
ed15ce3569
Remove double '_RADIOLIB's 2023-11-30 20:23:45 +00:00
Jan Gromeš
d1d774acd5
Merge pull request #893 from S5NC/SX128Xalsochangemacro
Maintain consistency across SX126x and SX128x with macro rename
2023-11-30 16:58:40 +01:00
S5NC
14a2238ca6
Update SX128x.h 2023-11-30 12:18:13 +00:00
jgromes
94bd83329d Bump version to 6.3.0 2023-11-29 17:31:00 +01:00
jgromes
34d2bc85b3 Print debug info correctly 2023-11-27 21:24:32 +01:00
jgromes
974c027452 [SSTV] Reworked macro configuration system 2023-11-27 21:19:04 +01:00
jgromes
eddde76371 [RTTY] Reworked macro configuration system 2023-11-27 21:18:20 +01:00
jgromes
e6a6923b25 [Print] Reworked macro configuration system 2023-11-27 21:18:10 +01:00
jgromes
395101ec20 [PHY] Reworked macro configuration system 2023-11-27 21:17:58 +01:00
jgromes
074b707924 [Pager] Reworked macro configuration system 2023-11-27 21:17:45 +01:00
jgromes
8f5cff0cd4 [Morse] Reworked macro configuration system 2023-11-27 21:17:35 +01:00
jgromes
670e70bd9f [LoRaWAN] Reworked macro configuration system 2023-11-27 21:17:26 +01:00
jgromes
ac18a2c8f7 [Hell] Reworked macro configuration system 2023-11-27 21:17:06 +01:00
jgromes
71dbf371e7 [FSK4] Reworked macro configuration system 2023-11-27 21:16:56 +01:00
jgromes
f85abafe19 [Bell] Reworked macro configuration system 2023-11-27 21:16:43 +01:00
jgromes
6c07552f84 [AX25] Reworked macro configuration system 2023-11-27 21:16:34 +01:00
jgromes
98054055bd [APRS] Reworked macro configuration system 2023-11-27 21:16:13 +01:00
jgromes
fe0136b15c [AFSK] Reworked macro configuration system 2023-11-27 21:15:52 +01:00
jgromes
379c475d5e [SX1231] Reworked macro configuration system 2023-11-27 21:15:21 +01:00
jgromes
827aac5938 [SX128x] Reworked macro configuration system 2023-11-27 21:15:07 +01:00
jgromes
34c861cfbe [SX127x] Reworked macro configuration system 2023-11-27 21:14:33 +01:00
jgromes
49feff6df2 [SX126x] Reworked macro configuration system 2023-11-27 19:43:01 +01:00
jgromes
77c9b2875d [Si443x] Reworked macro configuration system 2023-11-27 19:40:57 +01:00
jgromes
f0f9200269 [RFM2x] Reworked macro configuration system 2023-11-27 19:40:32 +01:00
jgromes
2e1ce8ce89 [RF69] Reworked macro configuration system 2023-11-27 19:40:19 +01:00
jgromes
63287ab6fd [nRF24] Reworked macro configuration system 2023-11-27 19:40:00 +01:00
jgromes
509b8204f1 [LLCC68] Reworked macro configuration system 2023-11-27 19:39:35 +01:00
jgromes
0c436e5ed8 [CC1101] Reworked macro configuration system 2023-11-27 19:39:24 +01:00
jgromes
1d77d8bd55 [FEC] Reworked macro configuration system 2023-11-27 19:38:30 +01:00
jgromes
a2e2003001 Reworked macro configuration system 2023-11-27 19:38:10 +01:00
Jonathan Bennett
f4938ea585
Check for RADIOLIB_SPI_PARANOID = 1 rather than just defined (#883)
* Update BuildOpt.h to set RADIOLIB_SPI_PARANOID to 1 by default

* Update Module.cpp to check for RADIOLIB_SPI_PARANOID set to 1
2023-11-27 18:45:18 +01:00
StevenCellist
b6f6718f1f
[LoRaWAN] Add datarate into event structure (#885)
* [LoRaWAN] Move TX power logic to function

* Update keywords

* [LoRaWAN] Add datarate into event structure
2023-11-27 16:43:56 +01:00
StevenCellist
047eafce74
Merge branch 'jgromes:master' into master 2023-11-27 16:20:37 +01:00
StevenCellist
4703f58b7f [LoRaWAN] Add datarate into event structure 2023-11-27 16:20:06 +01:00
StevenCellist
b2b73ab21d
[LoRaWAN] Move TX power logic to function (#884)
* [LoRaWAN] Move TX power logic to function

* Update keywords
2023-11-27 16:10:47 +01:00
StevenCellist
3d6db1b79a Update keywords 2023-11-27 15:41:41 +01:00
StevenCellist
594d8cbba1 [LoRaWAN] Move TX power logic to function 2023-11-27 12:39:14 +01:00
jgromes
81c59f61ff [SX127x] Fixed copy-pasted code snippet 2023-11-21 20:48:06 +01:00
jgromes
4aadd7aab2 [HAL] Fixed unused variable warnings 2023-11-18 16:56:45 +01:00
jgromes
7e70785909 [LoRaWAN] Replaced VLAs with dynamically allocated memory 2023-11-18 16:46:12 +01:00
jgromes
713162fcc7 [LoRaWAN] Fixed unused variable warning on non-EEPROM boards 2023-11-18 16:38:03 +01:00
jgromes
0dbe05229a [CI] Fixed STM32WL not skipped properly 2023-11-18 16:36:46 +01:00
jgromes
51169106c2 [SX126x] Fixed unused variable warning 2023-11-18 16:34:48 +01:00
jgromes
7d57a5f6c7 [LoRaWAN] Fixed example naming 2023-11-18 16:27:29 +01:00
jgromes
c96dd51f57 [LoRaWAN] Fixed inconsistent naming 2023-11-18 16:27:05 +01:00
jgromes
5b406688a3 [CI] Skip persistent LoRaWAN example on platforms without EEPROM 2023-11-18 16:24:46 +01:00
jgromes
e4bfb6429b [LoRaWAN] Fixed variable-sized arrays 2023-11-18 16:15:48 +01:00
jgromes
455c3c8dd0 [CC1101] Fixed crash in blocking receive (#839) 2023-11-18 15:11:10 +01:00
jgromes
615cebcf6b Added warning for low-end platforms (Uno etc.) 2023-11-18 15:07:19 +01:00
jgromes
bd1fbb3b0a Updated version macro print 2023-11-18 15:06:46 +01:00
jgromes
063b42752f [LoRaWAN] Fixed a few warnings 2023-11-18 15:03:48 +01:00
jgromes
75a9420552 [LoRaWAN] Added event struct to pass extra info (#821) 2023-11-12 17:53:05 +01:00
jgromes
cb9ba88d03 Fix some tabs 2023-11-12 17:51:34 +01:00
StevenCellist
82258105b7
[LoRaWAN] Rework bands, official Rx windows, support ADR, confirm frames, improve EEPROM handling, support clock drift (#867)
* [LoRaWAN] rework bands, add ADR, partial MAC support

Known problem: terribly bad at receiving downlinks
Mask-list bands (e.g. US915) untested, likely a few bugs

* [LoRaWAN] Change Rx windows from CAD to RxSingle

* [LoRaWAN] improve persistence, better Rx windows, wear leveling, confirmed frames

* [LoRaWAN] Module-independent (OTAA) Rx windows, fix confirming downlinks

* [LoRaWAN] Implement SX127x support, fix MAC uplinking, support clock drift

* [ArduinoHal] fix clock drift calculation

* [LoRaWAN] Improve band & ADR logic, allow setting ADR, DR, subband, update examples

* [LoRaWAN] Fix EU868 coding rate, improve example

* [LoRaWAN] fix unused channel index

* [LoRaWAN] fix merge issue (deleted line)

* [LoRaWAN] fix CSMA calling now incorrect function

* [LoRaWAN] fix include logic

* [LoRaWAN] fix warnings, remove duplicate function

* [LoRaWAN] improve examples, add unified sendReceive, bugfixes, add FSK

* [LoRaWAN] improve examples

* [LoRaWAN] add new keywords, add debug guard

* [SX127x] Updated startReceive interface to be more in line with SX126x

* [SX127x] Added public method to convert from bytes to symbols

* [LoRaWAN] Update start receive for SX127x

* Added note about LoRaWAN beta

* [SX127x] Fixed potential float overflow

---------

Co-authored-by: jgromes <jan.gromes@gmail.com>
2023-11-12 14:02:39 +01:00
jgromes
ce202deb7f Merge branch 'master' of https://github.com/jgromes/RadioLib 2023-11-07 07:13:04 +01:00
jgromes
d262732554 [RFM9x] Added missing alias for RFM95 2023-11-07 07:13:02 +01:00
Nico Maas
f691b11c38
Fixed Persistent Storage Issue for RP2040 with Arduino Pico Framework (#868)
RP2040 does not have an EEPROM but always uses the last 4K chunk of the flash for a software EEPROM - if used. It is exactly handled as ESP32 "SoftEEPROMs", meaning it does copy the "flashEEPROM" to memory on .begin(); and does need to commit(); to write it back. We saw in the past that a node could successfully get an OTAA on an RP2040, but could never join - due to the missing commit and wrong init, this was the reason. As the "SoftEEPROM" is always written at the end of the flash, it also survives an Arduino Sketch reflash if not wiped afterwards by node.wipe(); More info and documentation here: https://arduino-pico.readthedocs.io/en/latest/eeprom.html
2023-11-04 16:09:13 +01:00
Amalinda Gamage
aca1d78a97
added functionality for LoRa Alliance TR-13 Enabling CSMA for LoRaWAN (#859)
* added functionality for LoRa Alliance TR-13 Enabling CSMA for LoRaWAN

* Addressed feedback on CSMA implementation

* symbolNumValues[6] array no longer needed as we will utilize only two symbol CAD operations for all SFs.
2023-10-29 14:19:00 +01:00
jgromes
912333c408 [HAL] Added check for defined ESP version macro (#860) 2023-10-28 21:54:31 +02:00
Lewis He
039fa0fc59
Update api adapt esp core 3.0.0-alpha2 (#860) 2023-10-28 19:41:51 +02:00
StevenCellist
556f37f608
[LoRaWAN] Implement full session persistence & more v1.1 specification (#835)
* Implement session persistence & more 1.1 protocol

* [LoRaW] Improve session persistence, check frame counters & Nonces, multiple MAC commands

* [LoRaWAN] fix popping MAC command from queue

I just realized that the method popMacCommand did not correctly remove items from the queue - this should solve the problem

* [LoRaWAN] implement improvements from #835

* [LoRaWAN] String --> uint8_t[]

* [LoRaWAN] Fix typo
2023-10-23 17:50:16 +02:00
jgromes
29c891e017 [SX126x] Fixed duplicate setPaConfig 2023-10-20 19:45:50 +02:00
jgromes
f1f3336e59 [SX126x] Make setPaConfig public (#852) 2023-10-20 19:37:44 +02:00
jgromes
eabc752703 [APRS] Fix array length calculation in static only mode 2023-10-18 17:47:09 +02:00
jgromes
46bf0445fa [SX126x] Decrease startup wait to 10 ms (#850) 2023-10-17 20:14:26 +02:00
jgromes
4e0ed033db [HAL] Fixed persistent storage on Sparkfun Apollo (#848) 2023-10-15 08:48:37 +02:00
jgromes
0d43891070 [STM32WLx] Added missing interrupt actions (#844) 2023-10-14 14:05:55 +02:00
jgromes
f4f00537c6 [LoRaWAN] Fixed debug float print (#844) 2023-10-14 10:28:27 +02:00
jgromes
96f90c8ee0 [Si443x] Fixed debug float print 2023-10-14 10:27:53 +02:00
jgromes
6e26852689 Fixed debug float print 2023-10-14 10:27:31 +02:00
chemary
ddcce424c8
Incorrectly checking sx1280 command status (#843) 2023-10-11 07:20:11 +02:00
jgromes
49a0a1cf44 [CC1101] Added list of supported bandwidths (#842) 2023-10-09 17:40:22 +02:00
BayCom GmbH
d329c60906
[SX127x] disable syncword generation & detection, add method to set preamble polarity (#834)
* allow syncword to be disabled if length is 0

* add method to change preamble polarity in FSK mode

* add new method 'setPreamblePolarity'

* move RADIOLIB_SX127X_PREAMBLE_POLARITY_55 from ::config to ::begin & ::beginFSK

* [SX127x] Remove FSK preamble config from LoRa init method

* [SX127x] Rename preamble inversion method

---------

Co-authored-by: BayCom GmbH <software@baycom.de>
Co-authored-by: jgromes <jan.gromes@gmail.com>
2023-09-29 14:27:31 +02:00
jgromes
44bdf0dba4 [SX126x] Changed default whitening initial value for SX127x/LoRaWAN compatibility (#832) 2023-09-25 06:42:15 +02:00
jgromes
b817819c60 [RM9x] Drop RFM9x as separate class 2023-09-24 18:19:48 +02:00
jgromes
10d225fadb [SX127x] Allow alternate chip versions 2023-09-24 18:19:19 +02:00
jgromes
b65fb88526 [RFM9x] Use RFM9x only as alias for SX127x (#833) 2023-09-24 18:17:32 +02:00
jgromes
690a050ebb Bump version to 6.2.0 2023-09-16 08:21:25 +02:00
jgromes
df8eeebb72 Added debug info to compilation process 2023-09-16 08:20:25 +02:00
jgromes
d03d4c29ee Moved FAQ to Wiki 2023-09-16 07:45:52 +02:00
jgromes
c13ab85670 Added LoRaWAN to properties files 2023-09-16 07:45:35 +02:00
jgromes
bc7e82999c Disable EEPROM on SAMD 2023-09-15 20:20:00 +02:00
jgromes
1dec070c0e [CI] Remove Leonardo option 2023-09-15 18:42:55 +02:00
jgromes
a9c66e25f5 [CI] Drop Arduino Leonardo 2023-09-15 18:42:21 +02:00
jgromes
9279b8ab6d [LoRaWAN] Workaround unused variable warning for unimplemented fields 2023-09-15 18:36:08 +02:00
jgromes
4b80080a37 Disable EEPROM on nRF52 and Portenta 2023-09-15 18:31:53 +02:00
jgromes
253dfd8c50 [LoRaWAN] Temporarily cast unused variables until implemented 2023-09-15 18:31:31 +02:00
jgromes
a4aace3ad0 Disable EEPROM on Nano 33 BLE and RP2040 2023-09-15 18:13:26 +02:00
jgromes
7de4a4693e [HAL] Disable EEPROM on Arduino Due 2023-09-15 18:10:47 +02:00
jgromes
58eab402ad [LoRaWAN] Implemented most MAC commands 2023-09-14 20:58:46 +02:00
jgromes
2638fd0ad0 [LoRaWAN] Fixed memory leak in downlink 2023-09-14 20:58:04 +02:00
jgromes
a23d85c196 [LoRaWAN] Typo fixes 2023-09-13 17:05:19 +02:00
jgromes
3055613b6d [LoRaWAN] Added support for US bands and reworked channel selection process (#814) 2023-09-12 19:10:44 +02:00
jgromes
7dec9477ae [PHY] Added coding rate to data rate struct 2023-09-12 19:06:30 +02:00
jgromes
44ffce1725 [SX127x] Skip printing symbol length 2023-09-12 19:05:06 +02:00
jgromes
d0c4e3d6fb [SX126x] Skip printing symbol length 2023-09-12 19:04:26 +02:00
jgromes
eb21f320ac [SX126x] Use debug macro for hexdump 2023-09-12 17:20:27 +02:00
jgromes
42c9cba838 Merge branch 'master' of https://github.com/jgromes/RadioLib 2023-09-12 17:13:09 +02:00
jgromes
392708f8b5 [MOD] Make regdump and hexdump only available in debug 2023-09-12 17:13:07 +02:00
Jan Gromeš
0ef554c6c8
Merge pull request #824 from alistair23/alistair/cmake
Tock: toolchain: Try to be smarter about finding toolchains
2023-09-08 13:48:01 +02:00
Alistair Francis
ffbcbdfc84 Tock: toolchain: Try to be smarter about finding toolchains
Instead of hard coding paths, let's instead try to find the toolchain
from the users PATH.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
2023-09-08 19:29:49 +10:00
jgromes
b114295c54 Revert "Moved gitmodule file to tock example"
This reverts commit aa24052fda.
2023-08-31 16:33:06 +02:00
Jan Gromeš
b6ab9f14ff
Merge pull request #819 from alistair23/alistair/tock-ci
github: Add Tock CI
2023-08-31 16:27:02 +02:00
Alistair Francis
84c6e8c9ed github: Add Tock CI
Signed-off-by: Alistair Francis <alistair@alistair23.me>
2023-08-31 22:49:45 +10:00
jgromes
aa24052fda Moved gitmodule file to tock example 2023-08-30 16:21:23 +02:00
jgromes
ada400630d Merge branch 'master' of https://github.com/jgromes/RadioLib 2023-08-29 21:57:53 +02:00
jgromes
414e338505 Fixed ESP32 platform detection 2023-08-29 21:57:51 +02:00
Jan Gromeš
53d65aa1ca
Merge pull request #818 from alistair23/alistair/fixup
Tock: Fixup build failure
2023-08-29 15:24:27 +02:00
Alistair Francis
7e9e7ba7be Tock: Fixup build failure
Signed-off-by: Alistair Francis <alistair@alistair23.me>
2023-08-29 21:00:47 +10:00
jgromes
b54aa77b42 [LoRaWAN] Fixed incorrect example name 2023-08-26 20:35:48 +02:00
jgromes
d170c02561 [LoRaWAN] Fixed initialization warnings 2023-08-26 20:34:37 +02:00
jgromes
3eb397adfd [CI] Moved IDF export to build step 2023-08-24 20:54:20 +02:00
jgromes
c999ac2cab [CI] Added CI action for ESP-IDF to catch -Werrors 2023-08-24 20:48:50 +02:00
jgromes
62d8a2ddb8 Merge branch 'master' of https://github.com/jgromes/RadioLib 2023-08-24 17:55:29 +02:00
jgromes
95e3839342 [LoRaWAN] Represent keys as byte arrays (#58) (#811) 2023-08-24 17:54:49 +02:00
Jan Gromeš
b66f39d329
Merge pull request #815 from nicklasb/master
Fix narrowing conversion error on ESP-IDF
2023-08-24 17:36:00 +02:00
Nicklas Börjesson
f8ae458185
Merge pull request #1 from nicklasb/nicklasb-patch-narrowing
Fix narrowing conversion error on ESP-IDF
2023-08-23 23:48:29 +02:00
Nicklas Börjesson
2555857013
Fix "narrowing conversion" error on ESP-IDF
The 1 without a cast caused the result to be an integer.
2023-08-23 20:16:57 +02:00
jgromes
16f0ba7cce [LoRaWAN] Implemented MAC command support 2023-08-23 19:22:23 +02:00
jgromes
73382c2933 [LoRaWAN] Fixed output power configuration (#814) 2023-08-20 19:16:38 +02:00
jgromes
b2b176f1c3 [LoRaWAN] Added MIC mismatch debug message 2023-08-20 19:16:07 +02:00
jgromes
3e8636b1f2 [APRS] Removed redundant condition (#810) 2023-08-18 20:21:53 +02:00
Jan Gromeš
42c2dba1cc
Merge pull request #810 from nicklasb/master-2
Remove unnecessary condition
2023-08-18 20:20:46 +02:00
jgromes
0a72d98750 [LoRaWAN] Fixed MIC calculation for downlink packets 2023-08-14 21:38:31 +02:00
jgromes
1ed22717d7 [LoRaWAN] Added check to not uplink in Rx slots 2023-08-12 21:48:31 +02:00
jgromes
45c376bde6 [LoRaWAN] Fixed variable range warning 2023-08-12 19:58:00 +02:00
jgromes
1a31efbf74 [LoRaWAN] Drop examples on Uno 2023-08-12 19:57:22 +02:00
jgromes
cbd15192bc [SX126x] Fixed example path 2023-08-12 19:52:41 +02:00
jgromes
cd9ac9916c [LoRaWAN] Added support for 1.1 and downlink (#58) 2023-08-12 19:49:37 +02:00
jgromes
d34902ee46 [SX127x] Added missing parentheses 2023-08-12 19:44:13 +02:00
jgromes
23fbd87d14 [SX126x] Added Rx after CAD example 2023-08-12 18:58:11 +02:00
jgromes
ca95135d8a [SX126x] Skip wiping IRQ flags on CAD done 2023-08-12 18:49:05 +02:00
jgromes
db3ac8bf19 [SX126x] Implemented common CAD methods 2023-08-12 18:45:42 +02:00
jgromes
ea4018d310 [SX127x] Added common CAD methods 2023-08-12 18:43:26 +02:00
jgromes
58da2a28ac [PHY] Added channel scan methods to common interface 2023-08-12 18:42:37 +02:00
jgromes
b48567722b [SX127x] Added method to get CAD result 2023-08-12 18:40:38 +02:00
jgromes
bb468ad59f [SX127x] Explicitly set non-inverted IQ on startup 2023-08-12 18:38:46 +02:00
jgromes
5d80dd46ae [SX126x] Explicitly set non-inverted IQ on startup 2023-08-12 18:38:15 +02:00
jgromes
2f36d5901e [LoRaWAN] Added LoRaWAN-specific status codes 2023-08-12 18:37:46 +02:00
jgromes
8c63f93820 [MOD] Skip SPI status parsing for single-byte commands 2023-08-12 18:36:12 +02:00
jgromes
bfe2c0829a [MOD] Moved debug info to runtime 2023-08-12 18:35:48 +02:00
jgromes
3e5c0d59c7 [MOD] Moved CS pin toggling inside SPI transaction block 2023-08-12 18:35:08 +02:00
Nicklas Börjesson
ebfe7972fc
Remove unnecessary condition
This will never be NULL and thus causes an error in ESP-IDF
2023-08-09 23:38:39 +02:00
jgromes
86724197ec [SX126x] Added default channel scan override 2023-08-06 16:07:28 +02:00
jgromes
f589d77e09 [SX127x] Override default channel scan method 2023-08-06 16:06:15 +02:00
jgromes
532caaa089 [PHY] Added virtual channel scan method 2023-08-06 16:02:24 +02:00
jgromes
68c5edd7c2 [SX127x] Add delay before IRQ clearing (#808) 2023-08-06 09:31:39 +02:00
Jan Gromeš
44c0ea25e6
Merge pull request #807 from ramaza/fix_rf69
Fixed wrong register definition
2023-08-05 10:53:23 +02:00
fraboe
f81f37cf43 Fixed wrong register definition for RADIOLIB_RF69_SEQUENCER_OFF and RADIOLIB_RF69_SEQUENCER_ON 2023-08-05 08:55:50 +02:00
jgromes
6247cb7e85 [CC1101] Fixed garbage data (#733) 2023-08-02 22:08:52 +02:00
jgromes
72b95e5c82 [CC1101] Decreased default Rx bandwidth 2023-08-02 22:04:20 +02:00
Jan Gromeš
4b9543889a
Merge pull request #802 from alistair23/alistair/fixes
Tock: Use the default radio begin()
2023-07-24 17:34:49 +02:00
Alistair Francis
87200bd312 Tock: Use the default radio begin()
Signed-off-by: Alistair Francis <alistair@alistair23.me>
2023-07-24 21:10:23 +10:00
Jan Gromeš
12387daba0
Merge pull request #801 from alistair23/alistair/fixes
Tock: A few more cleanups and fixes
2023-07-22 19:14:24 +02:00
jgromes
7de2996505 [APRS] Added APRS over LoRa example 2023-07-21 18:35:48 +02:00
jgromes
26222cc97f [APRS] Fixed buffer type 2023-07-21 18:26:15 +02:00
jgromes
247ca753f1 [APRS] Added support for APRS over LoRa 2023-07-21 18:18:05 +02:00
jgromes
1bc7c5771c [AX25] Added check for Bell modem 2023-07-21 18:08:40 +02:00
Alistair Francis
fe892ecd31 Tock: Fixup the radio setup
Signed-off-by: Alistair Francis <alistair@alistair23.me>
2023-07-21 22:03:45 +10:00
Alistair Francis
6234a84ac9 Tock: Build libtock-c lib with the build script
Signed-off-by: Alistair Francis <alistair@alistair23.me>
2023-07-21 22:01:56 +10:00
jgromes
0a6026e69e [LoRaWAN] Fixed typo in variable name 2023-07-20 18:43:49 +02:00
Jan Gromeš
3a365a364a
Merge pull request #799 from alistair23/alistair/tock-fixes
Tock: Fixup the time calculations and call non-blocking yield
2023-07-20 16:23:54 +02:00
Alistair Francis
377385fb13 Tock: Don't call blocking yield
Signed-off-by: Alistair Francis <alistair@alistair23.me>
2023-07-20 21:42:51 +10:00
Alistair Francis
2edbe9cd57 Tock: Fixup time calculation
Signed-off-by: Alistair Francis <alistair@alistair23.me>
2023-07-20 21:42:51 +10:00
jgromes
5e9b60a4b4 [LoRaWAN] Added APB example 2023-07-16 16:54:13 +02:00
jgromes
6a7773e005 [LoRaWAN] Fixed APB begin 2023-07-16 16:34:32 +02:00
jgromes
d52c9e3183 [LoRaWAN] Added preliminary FSK support 2023-07-16 16:33:47 +02:00
jgromes
76ac7d3dad [STM32WL] Fixed output power for modules without LP (#798) 2023-07-16 15:50:26 +02:00
jgromes
65a43dbd13 Added issue template config 2023-07-16 11:49:20 +02:00
jgromes
d1e3691c32 Added notes about getPacketLength (#214) 2023-07-15 19:40:07 +02:00
jgromes
5f2e5a1997 Added getPacketLength to examples (#214) 2023-07-15 19:36:23 +02:00
jgromes
498c5d5e22 [Morse] Fix typo 2023-07-15 19:25:51 +02:00
jgromes
8fd0a67a78 Typo fixes 2023-07-15 19:13:16 +02:00
Jan Gromeš
5974da27de
Merge pull request #795 from alistair23/alistair/tock-readme
Tock: Add a README for the example
2023-07-13 15:11:22 +02:00
Alistair Francis
bb61063810 Tock: Expand the .gitignore
Signed-off-by: Alistair Francis <alistair@alistair23.me>
2023-07-13 22:43:22 +10:00
Alistair Francis
3c7dc7acba Tock: README: Initial commit
Signed-off-by: Alistair Francis <alistair@alistair23.me>
2023-07-13 22:43:22 +10:00
Jan Gromeš
9fa8434e47
Merge pull request #793 from alistair23/alistair/tock
NonArduino: Tock: Fixup some bugs and expand the example
2023-07-11 16:11:05 +02:00
Alistair Francis
5750d88797 Tock: Use \r\n for all new lines
Signed-off-by: Alistair Francis <alistair@alistair23.me>
2023-07-11 13:27:04 +10:00
Alistair Francis
6a6bb8526b Tock: Update Radio config for SparkFun LoRa Thing Plus - expLoRaBLE
Signed-off-by: Alistair Francis <alistair@alistair23.me>
2023-07-11 13:24:19 +10:00
Alistair Francis
a72b549450 Tock: Implement yield()
Signed-off-by: Alistair Francis <alistair@alistair23.me>
2023-07-11 13:23:48 +10:00
Alistair Francis
ae05a4283e Tock: Use Tock's libgcc
The Tock specific version of libgcc is built to be position independent,
so use that instead of the one supplied by the compiler. This fixes a
few odd corner cases when using printf().

Signed-off-by: Alistair Francis <alistair@alistair23.me>
2023-07-11 13:23:34 +10:00
jgromes
89e405eeba [LoRaWAN] Fixes for SX127x series 2023-07-08 09:37:43 +02:00
jgromes
fc983efafb [Crypto] Fixed missing nonvolatile read 2023-07-08 08:51:58 +02:00
jgromes
94861b3db4 Merge branch 'master' of https://github.com/jgromes/RadioLib 2023-07-07 20:48:53 +02:00
jgromes
b139767559 [EXT] Implemented direct transmit (#646) 2023-07-07 20:48:51 +02:00
jgromes
01917ad0c2 [FEC] Implemented static-only memory management 2023-07-07 20:39:00 +02:00
jgromes
ccbec2c7bd [FEC] Fixed memory leak (#646) 2023-07-07 20:33:48 +02:00
Jan Gromeš
dd53ed9658
Merge pull request #792 from nicklasb/patch-1
Add parenthesis for compatibility
2023-07-06 22:51:25 +02:00
Nicklas Börjesson
d9538f959a
Add parenthesis for compatibility
Hi,
I am getting a compile error on ESP-IDF/Platformio:
```
managed_components/RadioLib/src/protocols/LoRaWAN/LoRaWAN.cpp: In member function 'int16_t LoRaWANNode::beginOTAA(uint64_t, uint64_t, uint8_t*, uint8_t*, bool)':
managed_components/RadioLib/src/protocols/LoRaWAN/LoRaWAN.cpp:125:61: error: suggest parentheses around comparison in operand of '&' [-Werror=parentheses]
  125 |   if(joinAcceptMsgEnc[0] & RADIOLIB_LORAWAN_MHDR_MTYPE_MASK != RADIOLIB_LORAWAN_MHDR_MTYPE_JOIN_ACCEPT) {
cc1plus: some warnings being treated as errors
*** [.pio/build/TTGO-LoRa32-v1/managed_components/RadioLib/src/protocols/LoRaWAN/LoRaWAN.o] Error 1

I propose adding a parenthesis, for clarity and compatibility.
2023-07-06 22:43:33 +02:00
jgromes
a78c415616 [LoRaWAN] Fixed loop comparison 2023-07-06 19:00:41 +02:00
jgromes
f354903864 [LoRaWAN] Added rev 1.1 checking 2023-07-06 18:50:04 +02:00
jgromes
a27d54716c [LoRaWAN] Added all official bands 2023-07-06 18:38:20 +02:00
jgromes
0d2ef419bf [LoRaWAN] Added basic LoRaWAN support (#58) 2023-07-06 13:41:31 +02:00
jgromes
3012185af4 [Crypto] Added AES key size macro 2023-07-06 13:30:56 +02:00
jgromes
df691db0a5 [HAL] Updated persistent management 2023-07-06 13:30:29 +02:00
jgromes
d725215e20 [HAL] Added persistent parameters to buildopt 2023-07-06 11:19:44 +02:00
jgromes
e486829b8f [HAL] Implemented basic persistent storage 2023-07-06 11:19:18 +02:00
jgromes
d5ce384bda [SX127x] Implemented new common PHY methods 2023-07-06 11:17:29 +02:00
jgromes
d561d41e95 [SX126x] Implemented new common PHY methods 2023-07-06 11:14:44 +02:00
jgromes
91787eb269 [PHY] Implemented more common methods 2023-07-06 11:10:20 +02:00
jgromes
47f9ab8463 Fixed typo in README 2023-07-05 09:46:12 +02:00
jgromes
bea5e70d0a [LLCC68] Changed default crystal to XTAL (#784) 2023-07-01 09:03:42 +02:00
jgromes
ac15b9ae7d [SX126x] Added comments about TCXO/XTAL (#784) 2023-07-01 09:02:43 +02:00
Jan Gromeš
a9a125a385
Merge pull request #782 from alistair23/alistair/tock
examples: NonArduino: Tock: Initial commit
2023-06-30 17:17:29 +02:00
Alistair Francis
a8172308fe examples: NonArduino: Tock: Initial commit
Add support for running RadioLib on Tock.

Tock is an embedded operating system designed for running multiple
concurrent, mutually distrustful applications on Cortex-M and RISC-V
based embedded platforms (https://github.com/tock/tock).

This PR uses libtock-c (https://github.com/tock/libtock-c) to add
support to running RadioLib as a Tock userspace application.

This has been tested on the SparkFun LoRa Thing Plus - expLoRaBLE board
(https://github.com/tock/tock/tree/master/boards/apollo3/lora_things_plus)
but will work on any LoRa compatible Tock board (currently only the
expLoRaBLE board).

Signed-off-by: Alistair Francis <alistair@alistair23.me>
2023-06-29 09:54:30 +10:00
Jan Gromeš
6622a14726
Merge pull request #781 from alistair23/alistair/lora-fix2
Module: Get status from first byte after the command
2023-06-28 17:24:14 +02:00
Alistair Francis
e88cf386d6 Module: Get status from first byte after the command
Instead of getting the status from the very first byte in the input
buffer, which will be what we read when we send the first byte. Let's
instead get the status from the first byte after the command. This
provides a more accurate status value.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
2023-06-28 20:43:28 +10:00
jgromes
3359907fa5 [SX128x] Fixed getStatus (#779) 2023-06-27 17:35:50 +02:00
Jan Gromeš
f6203e5036
Merge pull request #779 from alistair23/alistair/spi-status
modules: Don't read excess status data
2023-06-27 17:34:20 +02:00
Alistair Francis
445bc01450 modules: Don't read excess status data
The SX126x get status command returns a single status byte. The status
byte is automatically read in the `Module::SPItransferStream()` function
when we increment buffLen (see
https://github.com/jgromes/RadioLib/blob/master/src/Module.cpp#L259).

By setting numBytes we incorrectly end up reading 2 bytes. Instead set
numBytes to zero so we only read the single status byte.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
2023-06-27 21:29:02 +10:00
jgromes
9c2d457eeb [CI] Added Uno R4 to matrix 2023-06-27 07:30:36 +02:00
jgromes
d1f7c18240 Added support for Arduino Uno R4 2023-06-27 07:28:57 +02:00
jgromes
58c9e9fe03 Fixed String counters in examples (CI_BUILD_ALL) 2023-06-26 20:39:33 +02:00
jgromes
64b9c669dd [CI] Skip Pager for Arduino Leonardo 2023-06-26 20:22:32 +02:00
jgromes
523f28fd6b Bump version to 6.1.0 2023-06-26 20:18:01 +02:00
jgromes
1881381caa [CI] Fix missing pipe 2023-06-26 19:56:28 +02:00
jgromes
a4dbae03a3 [MOD] Fixed missing cast (#776) 2023-06-26 19:41:12 +02:00
jgromes
f4f11a35d3 [Mod] Updated examples to use buffered SPI (#776) 2023-06-26 19:39:10 +02:00
jgromes
a01b02fae2 [MOD] Rework for buffered SPI (#776) 2023-06-26 19:36:45 +02:00
jgromes
8acaca4884 [SX127x] Swap Tx IQ inversion (#778) 2023-06-25 09:33:17 +02:00
jgromes
43ff5906c2 [SX127x] Added missing counter 2023-06-24 22:24:49 +02:00
jgromes
4949d10b00 [CI] Fixed CodeQL build example 2023-06-24 22:23:14 +02:00
jgromes
4975828d03 [SX126x] Fixed debug print format 2023-06-24 22:22:56 +02:00
jgromes
2dafa83058 [SX1231] Renamed basic examples to _Blocking 2023-06-24 22:18:59 +02:00
jgromes
3a07f0aa02 [SX128x] Renamed basic examples to _Blocking 2023-06-24 22:17:13 +02:00
jgromes
c919185849 [SX127x] Renamed basic examples to _Blocking 2023-06-24 22:12:53 +02:00
jgromes
24be1747d0 [SX126x] Renamed basic examples to _Blocking 2023-06-24 22:12:11 +02:00
jgromes
9bad00ed39 [STM32WL] Renamed basic examples to _Blocking 2023-06-24 22:03:28 +02:00
jgromes
06529844c3 [Si443x] Renamed basic examples to _Blocking 2023-06-24 21:59:18 +02:00
jgromes
18307f478d [RF69] Renamed basic examples to _Blocking 2023-06-24 21:55:20 +02:00
jgromes
be97ba8543 [nRF24] Added packet counter 2023-06-24 21:51:20 +02:00
jgromes
4981ce9934 [CC1101] Added packet counter 2023-06-24 21:50:30 +02:00
jgromes
90368db27a [nRF24] Renamed basic examples to _Blocking 2023-06-24 21:48:25 +02:00
jgromes
ac78f31532 [CC1101] Renamed basic examples to _Blocking 2023-06-24 19:51:09 +02:00
jgromes
36530b00fc [SX128x] Fixed blocking receive 2023-06-24 19:23:26 +02:00
jgromes
7f40ee49c6 [SX126x] Fixed blocking receive (#777) 2023-06-24 19:23:09 +02:00
jgromes
9472d5b635 [PHY] Added interface showcase example (#773) 2023-06-21 22:25:31 +02:00
jgromes
1f6acc8347 [SX128x] Implemented generic IRQ actions 2023-06-21 22:23:43 +02:00
jgromes
787ebde43e [SX126x] Implemented generic IRQ actions (#773) 2023-06-21 22:21:55 +02:00
jgromes
46e1af764e [Si443x] Implemented generic IRQ actions 2023-06-21 22:17:48 +02:00
jgromes
df126c92f9 [RF69] Implemented generic actions 2023-06-21 22:15:54 +02:00
jgromes
43b9b13903 [SX127x] Fixed direction from HAL 2023-06-21 22:13:54 +02:00
jgromes
a21fb9f136 [CC1101] Fixed direction from HAL 2023-06-21 22:13:44 +02:00
jgromes
291251ea72 [nRF24] Implemented generic actions 2023-06-21 22:11:36 +02:00
jgromes
8567c77641 [CC1101] Implemented generic actions 2023-06-21 22:07:24 +02:00
jgromes
a6ba423c73 [SX127x] Implemented generic actions 2023-06-21 22:03:07 +02:00
jgromes
be7dc572a6 [PHY] Added generic actions 2023-06-21 22:02:40 +02:00
Jan Gromeš
9c8f94668a
Merge pull request #772 from h3ndrik/func
Pager: allow manual override of function bits
2023-06-19 22:18:28 +02:00
Hendrik Langer
79725481cf fix error description 2023-06-16 15:58:59 +02:00
Hendrik Langer
69bc96ac08 Pager: allow manual override of function bits 2023-06-16 15:53:47 +02:00
jgromes
27ef744edf [SX127x] Fixed references to 256 byte packets 2023-06-07 20:41:14 +02:00
jgromes
8adf4fd4f2 [CI] Added option to only run rpi build 2023-06-04 13:43:46 +02:00
Jan Gromeš
d8fa707d5f
Merge pull request #763 from KevWal/patch-1
Bug in waitForMicroseconds prevTimingLen in V6.0.0
2023-06-04 13:37:57 +02:00
jgromes
cb7b282c9b Updae ESP-IFD example (#748) 2023-06-04 13:25:08 +02:00
jgromes
9f5e77616b Updated CMake for ESP-IDF (#748) 2023-06-04 13:23:22 +02:00
Kevin Walton
f63d228d0b
Bug in waitForMicroseconds prevTimingLen in V6.0.0
In Module::waitForMicroseconds if RADIOLIB_INTERRUPT_TIMING is defined the variable prevTimingLen has been incorrectly upated in v6.0.0 introducing a bug that stops compilation.

Fix: renamed _prevTimingLen to prevTimingLen to match other updates
2023-06-01 21:51:57 +01:00
jgromes
8e6bd972a9 [CI] Moved cleanup step to pre-run script 2023-05-30 21:05:43 +02:00
jgromes
9d96cab4a6 [CI] Added none option to only run self-hosted rpi 2023-05-30 17:35:22 +02:00
jgromes
1161f67fa0 [Crypto] Fixed type comparison warning 2023-05-29 17:32:16 +02:00
jgromes
3029f0a4f8 [CI] Added cleanup step 2023-05-28 22:35:48 +02:00
jgromes
cf677e6b15 [SX126x] Fixed default parameters 2023-05-28 22:32:24 +02:00
jgromes
522aff911f [SX127x] Fixed default parameters 2023-05-28 22:32:13 +02:00
jgromes
1597e8d754 [SX128x] Fixed default parameters 2023-05-28 22:32:06 +02:00
jgromes
ca319c9c0b [Crypto] Added AES-128 2023-05-28 22:25:07 +02:00
jgromes
f513226376 [PHY] Added default start receive 2023-05-28 22:22:00 +02:00
jgromes
2b28296c94 [SX128x] Added default startReceive method 2023-05-28 22:20:54 +02:00
jgromes
a16322097a [SX127x] Added default startReceive method 2023-05-28 22:20:25 +02:00
jgromes
f936d53639 [SX128x] Added default startReceive method 2023-05-28 22:19:03 +02:00
jgromes
05bd83e0a2 [SX127x] Fixed missing debug newline 2023-05-28 22:13:51 +02:00
jgromes
0b92a33d83 [Pager] Use FEC util 2023-05-23 22:44:44 +02:00
jgromes
191db8b5ff [FEC] Added FEC class 2023-05-23 22:41:53 +02:00
jgromes
551c6fd304 [CRC] Fixed incorrect doxygen class name 2023-05-23 22:41:32 +02:00
jgromes
3968e611af [PHY] Fixed long prints 2023-05-21 18:26:59 +02:00
jgromes
bb4a45e850 [Pager] Fixed long prints 2023-05-21 18:26:46 +02:00
jgromes
a5edb9b1e6 [Morse] Fixed long prints 2023-05-21 18:26:23 +02:00
jgromes
c93d6eff65 [SX128x] Fixed long prints 2023-05-21 18:26:16 +02:00
jgromes
5158ac5b6b [SX126x] Fixed long prints 2023-05-21 18:26:03 +02:00
jgromes
bb17b3dff2 [Si443x] Fixed long prints 2023-05-21 18:25:07 +02:00
jgromes
642f1bb157 [MOD] Added missing newlines 2023-05-21 18:24:31 +02:00
jgromes
4e2ff97afc Added ESP-IDF example (#748) 2023-05-21 18:24:18 +02:00
jgromes
397bd9ab04 [CI] Fix lib include path 2023-05-18 21:59:45 +02:00
jgromes
a97baa6fc2 [CI] Updated SX1261 autotest 2023-05-18 21:57:24 +02:00
jgromes
b02a5c1867 Updated raspberry example 2023-05-18 20:52:28 +01:00
jgromes
6d54ea65db [MOD] Added option to use SX126x without GPIO 2023-05-18 20:49:37 +01:00
jgromes
efbec6b9d1 Added custom min/max/abs macros 2023-05-16 17:13:43 +01:00
jgromes
1a55220020 Updated non-Arduino example 2023-05-16 17:12:45 +01:00
jgromes
c2b9e19551 Removed dependency on algorithm (#748) 2023-05-15 20:34:19 +02:00
jgromes
acf683b91b [CRC] Reworked for non-standard CRC lengths 2023-05-13 16:40:01 +02:00
jgromes
8062a322c6 [CRC] Convert into singleton 2023-05-12 21:08:43 +02:00
jgromes
efd449875d [AX.25] Use common CRC implementation 2023-05-12 20:57:15 +02:00
jgromes
32a5166ae3 [Bell] Added missing exclude guard 2023-05-12 20:56:23 +02:00
jgromes
03d2a9bf26 [MOD] Added common reflect method 2023-05-12 20:55:51 +02:00
jgromes
3b8218c397 [CRC] Added common CRC 2023-05-12 20:54:36 +02:00
Jan Gromeš
1c573bf598
Merge pull request #746 from Olocool17/master
[SX1272] Correct LoRa mode CRC register values
2023-05-11 22:27:35 +02:00
Olocool17
acc16c25bd [SX1272] Correct LoRa mode CRC register values 2023-05-11 20:47:19 +02:00
jgromes
0c40aa7f85 [Pager] Added note about module pin 2023-05-08 20:12:51 +02:00
jgromes
54c1b30959 Added cleanup to test 2023-05-07 07:40:12 +01:00
jgromes
2a265251b1 Made test scripts executable 2023-05-07 07:23:25 +01:00
jgromes
a00e5bb6af [CI] Added autotest job 2023-05-07 08:20:31 +02:00
jgromes
9ce2581942 Added CI autotest file 2023-05-07 08:19:14 +02:00
jgromes
a797bef0d2 Fixed term order for RPi example 2023-05-07 07:17:47 +01:00
jgromes
f96881700f Fixed example path 2023-05-06 20:34:01 +02:00
jgromes
39948f6130 Added Rpi action 2023-05-06 20:32:18 +02:00
jgromes
32cef2699d Update Raspberry example 2023-05-06 18:34:41 +01:00
jgromes
a21cabf3e3 Make build scripts executable 2023-05-06 18:02:12 +01:00
jgromes
1889a1fe82 Update cmake to install 2023-05-06 18:00:58 +01:00
jgromes
b9e2ad1f73 Update gitignore 2023-05-06 17:59:55 +01:00
jgromes
89f909fc6e [SX126x] Added force wakeup to standby (#740) 2023-05-02 21:05:13 +02:00
jgromes
c451765602 [SX128x] Added force wakeup to standby 2023-05-02 21:04:49 +02:00
jgromes
bdc5bb0bba [SX126x] Wakeup device on standby() call (#740) 2023-05-02 18:59:33 +02:00
jgromes
84ebdddcaf [SX128x] Wakeup device on standby() call 2023-05-02 18:58:59 +02:00
Jan Gromeš
d1d07af00b
Merge pull request #739 from Mesteery/patch-1
improve build workflow for better flexibility
2023-05-01 11:45:20 +02:00
Mestery
28180af762
run build on platform choosen in workflow dispatch 2023-04-30 23:41:24 +02:00
Mestery
70eb488c1c
improve build workflow for better flexibility 2023-04-30 23:38:17 +02:00
jgromes
2eff7a358f [MOD] Removed redundant NSS pull 2023-04-30 22:11:05 +02:00
jgromes
e1853ddf04 Added CMake for NonArduino example 2023-04-30 22:10:48 +02:00
jgromes
a9eaf5f2fb Added CMakeLists 2023-04-30 22:10:12 +02:00
jgromes
4be3389587 Added missing headers 2023-04-30 11:37:38 +02:00
jgromes
adf2f3ba98 [Print] Removed redundant headers 2023-04-30 11:34:58 +02:00
jgromes
4f0c400bd7 [ITA2] Added missing header 2023-04-30 11:32:38 +02:00
jgromes
8f28b42d63 [Print] Moved include to header 2023-04-30 11:31:52 +02:00
jgromes
a4bf746e1f [Print] Added missing headers for non-Arduino builds 2023-04-30 11:30:20 +02:00
jgromes
3df9cb27ff [CC1101] Fixed non-Hal functions 2023-04-30 11:26:53 +02:00
jgromes
54c1255646 [Bell] Added Bell modem example 2023-04-30 10:18:50 +02:00
jgromes
f1a947c09d [Bell] Added missing return 2023-04-29 23:05:24 +02:00
jgromes
e8f94c25d1 [AX.25] Use Bell modem 2023-04-29 23:01:50 +02:00
jgromes
f1a8333591 [Bell] Added Bell-compatible modem 2023-04-29 23:01:23 +02:00
jgromes
8b73333a62 [Print] Added missing godmode guard 2023-04-29 22:57:32 +02:00
jgromes
99f1ad24b2 [AFSK] Added copy constructor 2023-04-29 22:55:27 +02:00
jgromes
24f714b914 [Hell] Use common print class 2023-04-29 22:55:04 +02:00
jgromes
0030a59028 [Morse] Use common print class 2023-04-29 22:54:43 +02:00
jgromes
d79ed24a26 [RTTY] Use common print class 2023-04-29 22:54:27 +02:00
jgromes
089a81faec [Print] Added common print class 2023-04-29 22:53:55 +02:00
jgromes
f0cf7ff912 [Print] Added standalone ITA2 2023-04-29 22:53:33 +02:00
jgromes
b2af390c14 Added nonvolatile pointer macro 2023-04-29 22:52:11 +02:00
jgromes
7f4ff61504 [SX128x] Fixed unused variable 2023-04-29 22:51:44 +02:00
jgromes
f244caa0bb Bump version to 6.0.0 2023-04-24 18:32:02 +02:00
jgromes
701d13b40f Added notes about non-Arduino environments 2023-04-24 18:30:53 +02:00
jgromes
044b4789b2 [MOD] Decreased default SPI timeout to 1000 ms 2023-04-24 18:25:42 +02:00
jgromes
a22a4df88f [MOD] Added debug message when BUSY pin times out 2023-04-24 18:25:09 +02:00
jgromes
cc8c8f2eed [SX127x] General reformatting 2023-04-23 22:42:13 +02:00
jgromes
76c654c0c1 [SX128x] General reformatting 2023-04-23 22:05:18 +02:00
jgromes
d4365a3b1e [SX126x] Fixed variable shadowing 2023-04-23 22:04:40 +02:00
jgromes
14529f36c7 [RF69] Fixed variable shadowing 2023-04-23 22:03:37 +02:00
jgromes
8a878e8fe9 [LLCC68] Fixed variable shadowing 2023-04-23 22:03:28 +02:00
jgromes
bda6e220b6 [CC1101] Fixed variable shadowing 2023-04-23 22:03:12 +02:00
jgromes
c5a3c4d361 [nRF24] Fixed variable shadowing 2023-04-23 22:02:33 +02:00
jgromes
674c37d00b [Si443x] General reformatting 2023-04-23 21:14:01 +02:00
jgromes
f1c9423035 [SX126x] Fixed typo 2023-04-23 21:11:27 +02:00
jgromes
14302537ee [SX1231] General reformatting 2023-04-23 19:44:07 +02:00
jgromes
9be1cdfa41 [RF69] General reformatting 2023-04-23 19:43:48 +02:00
jgromes
c62bb74f9d [CC1101] Fixed shadowed variable name 2023-04-23 19:40:56 +02:00
jgromes
bba644377a [nRF24] General reformatting 2023-04-23 19:19:11 +02:00
jgromes
a015e541f6 [SX126x] General reformatting 2023-04-23 19:06:45 +02:00
jgromes
cab358ff09 [CC1101] Fixed axtra brace 2023-04-23 09:57:50 +02:00
jgromes
5c6628b6eb [CC1101] General reformatting 2023-04-23 09:47:42 +02:00
jgromes
78a576df12 [PHY] Use compact Doxygen and stop using reserved format 2023-04-23 09:12:47 +02:00
jgromes
767a2b006a [Pager] Fixed deprecation warning for ESP 2023-04-22 20:37:42 +02:00
jgromes
61f6da0cb2 [MOD] Added missing stdarg include for some platforms 2023-04-22 20:19:36 +02:00
jgromes
255838ed44 [AFSK] Use compact Doxygen and stop using reserved format 2023-04-22 19:36:12 +02:00
jgromes
668ff4fb01 [APRS] Use compact Doxygen and stop using reserved format 2023-04-22 19:35:58 +02:00
jgromes
5da2a023fe [AX25] Use compact Doxygen and stop using reserved format 2023-04-22 19:35:51 +02:00
jgromes
c988f64921 [FSK4] Use compact Doxygen and stop using reserved format 2023-04-22 19:35:42 +02:00
jgromes
34e59605b5 [Hell] Use compact Doxygen and stop using reserved format 2023-04-22 19:35:33 +02:00
jgromes
bb4e6cf946 [Morse] Use compact Doxygen and stop using reserved format 2023-04-22 19:35:23 +02:00
jgromes
6bbd237fb3 [Pager] Use compact Doxygen and stop using reserved format 2023-04-22 19:35:14 +02:00
jgromes
8722231ace [PHY] Use compact Doxygen 2023-04-22 19:35:00 +02:00
jgromes
5ab24e05dd [RTTY] Use compact Doxygen and stop using reserved format 2023-04-22 19:34:38 +02:00
jgromes
47e759f322 [SSTV] Use compact Doxygen and stop using reserved format 2023-04-22 19:34:27 +02:00
jgromes
7a99aa0ef4 [HAL] Use compact Doxygen and stop using reserved format 2023-04-22 18:53:30 +02:00
jgromes
9749083573 [MOD] Use compact Doxygen and stop using reserved format 2023-04-22 18:50:12 +02:00
jgromes
7ff785eb00 [HAL] Trying Doxygen format 2023-04-22 18:33:21 +02:00
jgromes
876081958b [HAL] Doxygen comments fix 2023-04-22 18:22:46 +02:00
jgromes
09c3ac4f6b [HAL] Formatting cleanup, added doxygen comments 2023-04-22 18:11:00 +02:00
jgromes
37bb8af768 [HAL] Fixed formatting 2023-04-22 18:08:08 +02:00
jgromes
d5fe5e3e2d [HAL] Cleaned up example and added comments 2023-04-22 18:07:47 +02:00
jgromes
7e47910430 [HAL] Renamed Hal to RadioLibHal 2023-04-22 18:07:27 +02:00
Jan Gromeš
b76b819b12
Merge pull request #730 from Mesteery/new-hal
Improve hardware abstraction layer
2023-04-22 16:26:31 +02:00
Mestery
94050efb1b add example 2023-04-18 19:21:01 +02:00
jgromes
21f2ef6836 [SX128x] Fixed IQ inversion 2023-04-17 19:12:42 +02:00
jgromes
2e8d0ae8a3 [SX126x] Fixed IQ inversion not caching (#731) 2023-04-17 19:10:26 +02:00
Mestery
f20cc978a7 update interrupt action mode type 2023-04-16 21:45:39 +02:00
Mestery
9a68a3c901 use uint32 instead of uint8 for pin type 2023-04-16 21:39:00 +02:00
Mestery
6695133576 fix documentation 2023-04-16 21:10:57 +02:00
Mestery
e141f4f151 fix warnings 2023-04-16 21:02:00 +02:00
Mestery
0cf308be04 remove byte usage 2023-04-16 21:00:05 +02:00
Mestery
f37c0b55c0 try move include inside 2023-04-16 20:54:48 +02:00
Mestery
3d43a618e3 guard arduinohal include 2023-04-16 20:54:31 +02:00
Mestery
d8f0d36407
fix 2023-04-13 17:50:27 +02:00
Mestery
7faeb46ada im so stupid 2023-04-13 01:42:19 +02:00
Mestery
ec3d4eaf20 Improve hardware abstraction layer 2023-04-12 23:16:18 +02:00
Jan Gromeš
88549baf83
Merge pull request #728 from Mesteery/undef-macro
Undefine RADIOLIB_DEBUG_PRINT_BIN macro after use
2023-04-12 19:00:44 +02:00
Mestery
45e9fd44bb
nitpick 2023-04-12 18:44:12 +02:00
Mestery
27575b8c49
Remove RADIOLIB_DEBUG_PRINT_BIN 2023-04-12 18:43:43 +02:00
Mestery
09fc9290bb
Undefine RADIOLIB_DEBUG_PRINT_BIN macro after use 2023-04-12 16:50:05 +02:00
Jan Gromeš
9c019a58e7
Merge pull request #726 from Mesteery/fix-generic-build
Fix generic build
2023-04-10 17:25:40 +02:00
Mestery
17ae017f89
address changes 2023-04-10 14:51:07 +02:00
jgromes
cb385f5946 [SX126x] Remove standby before data read (#703) 2023-04-10 14:05:25 +02:00
jgromes
c8b28887ee [SX127x] Fixed comment 2023-04-10 14:03:37 +02:00
jgromes
0f5b31aa3a [SX127x] Removed standby before data read 2023-04-10 13:57:00 +02:00
jgromes
b9fb0893b3 [SX127x] Added missing explicit CRC configuration 2023-04-10 11:54:59 +02:00
jgromes
cccc9742bb [CI] Skip SSTV examples for Arduino Uno (not enough RAM) 2023-04-10 11:20:35 +02:00
Mestery
220b4dad7f
use printf in both build 2023-04-10 09:13:58 +00:00
Mestery
6456da188d
fix debug print 2023-04-10 09:13:58 +00:00
Mestery
67e4dd4815
fix delayMicroseconds 2023-04-10 09:13:58 +00:00
Mestery
2a45f71384
fix undef digitalread 2023-04-10 09:13:57 +00:00
Mestery
7b6fd24c8e
fix non arduino build 2023-04-10 09:13:57 +00:00
jgromes
390b425b39 [MOD] Fixed default Arduino callbacks for SPI (#725) 2023-04-10 11:11:17 +02:00
jgromes
7c0fc5305a [STM32WL] Fixed build for Platformio (#718) 2023-04-10 10:29:21 +02:00
jgromes
f59a69f5c4 [MOD] Removed references to Arduino SPI callbacks (#725) 2023-04-10 09:06:40 +02:00
jgromes
efc2e9f291 [nRF24] Removed references to Arduino SPI callbacks (#725) 2023-04-10 09:06:24 +02:00
jgromes
cdbb827091 [CC1101] Removed references to Arduino SPI callbacks (#725) 2023-04-10 09:06:08 +02:00
jgromes
9d36ae4bee [MOD] Fixed SPI callbacks on non-Arduino platforms (#725) 2023-04-09 22:37:36 +02:00
jgromes
8587f73bd9 [SX127x] Implemented fractional bit rate (#505) 2023-04-09 17:08:45 +02:00
jgromes
9d3a2bb72f [SX128x] Added IQ inversion (#724) 2023-04-08 21:45:15 +02:00
jgromes
9dde85598b [SX126x] Added IQ inversion 2023-04-08 21:44:51 +02:00
jgromes
13248b6eab [SX127x] Fixed comments 2023-04-08 21:44:14 +02:00
jgromes
696d628ce9 Fixed readme link 2023-04-07 09:12:25 +02:00
jgromes
8ddc80831d Updated readme 2023-04-07 09:11:44 +02:00
jgromes
5f0cfa9bf6 [SX126x] Improved RNG 2023-04-02 21:01:13 +02:00
jgromes
45c5859338 [SX128x] Fixed packet length in implicit mode (#716) 2023-03-31 22:02:58 +02:00
jgromes
ece2621a6f [SX126x] Fixed packet length in LoRa implicit mode 2023-03-31 22:02:35 +02:00
jgromes
0210e10a24 [MOD] Fixed swapped NSS/BUSY order (#716) 2023-03-30 23:17:34 +02:00
Jan Gromeš
d5b1521c54
Merge pull request #714 from gasagna/master
fix #709
2023-03-30 11:02:11 +02:00
Davide Lasagna
642cbd8bfd added link to original issue 2023-03-30 09:49:50 +01:00
Davide Lasagna
c400a1428e fix #709 2023-03-29 18:21:18 +01:00
Jan Gromeš
c2b40f088f
Merge pull request #711 from G4lile0/master
[SX1278] New getInstRSSI to get current RSSI
2023-03-27 23:28:18 +02:00
jgromes
f62f912c87 [SX127x] Unified getRSSI interface 2023-03-27 23:22:03 +02:00
jgromes
ab9cf0d528 [SX126x] Unified getRSSI interface 2023-03-27 23:21:37 +02:00
G4lile0
50318a6c60 bool packet miss on SX126x::getRSSI 2023-03-27 21:21:45 +02:00
G4lile0
09ab5f8073 [SX127x] & [SX126x] read current RSSI for getRSSI 2023-03-27 20:51:44 +02:00
jgromes
c10343e853 [SX126x] Added spectral scan in frequency 2023-03-27 18:48:32 +02:00
jgromes
ee7c1e7604 [SX128x] Added PHY startReceive (#700) 2023-03-26 22:20:19 +02:00
jgromes
5d365d4da7 [SX127x] Added PHY startReceive (#700) 2023-03-26 22:20:08 +02:00
jgromes
9dd401e4a1 [SX126x] Added PHY startReceive (#700) 2023-03-26 22:19:53 +02:00
jgromes
1d92f1d786 [Si443x] Added PHY startReceive (#700) 2023-03-26 22:18:28 +02:00
jgromes
b108686a0f [RF69] Added PHY startReceive (#700) 2023-03-26 22:18:16 +02:00
jgromes
a534f490b1 [nRF24] Added PHY startReceive (#700) 2023-03-26 22:18:08 +02:00
jgromes
87c1d04b42 [CC1101] Added PHY startReceive (#700) 2023-03-26 22:17:55 +02:00
jgromes
0c15424419 [PHY] Fixed startReceive compatibility (#700) 2023-03-26 22:17:19 +02:00
G4lile0
04e24ab9d1 [SX1278] New getInstRSSI to get current RSSI 2023-03-24 20:30:06 +01:00
jgromes
9dae818033 [SX126x] Explicitly enabled CRC (#706) 2023-03-23 19:07:04 +01:00
jgromes
c3de8b9099 [SX127x] Explicitly enabled CRC (#706) 2023-03-23 19:06:43 +01:00
jgromes
48d49aabba Merge branch 'master' of https://github.com/jgromes/RadioLib 2023-03-22 22:13:32 +01:00
jgromes
8bbcc908f5 [SX126x] Fixed frequency error calculation (#706) 2023-03-22 22:12:28 +01:00
Jan Gromeš
91386e9313
Merge pull request #708 from gasagna/master
fix for #705
2023-03-21 21:11:53 +01:00
Davide Lasagna
b7e12f5c71 fix for #705 2023-03-21 19:56:21 +00:00
jgromes
cd4575ebb0 [SX126x] Fixed chip id (#707) 2023-03-21 18:18:17 +01:00
jgromes
dc2eb523a9 [SX126x] Cleanup whitespaces 2023-03-20 21:59:07 +01:00
jgromes
9b9a34bd2c Fixed build options include order 2023-03-20 19:13:38 +01:00
jgromes
cfe6128656 [SX126x] Added frequency error reading 2023-03-18 10:56:00 +01:00
jgromes
b9b3171001 Added user build opt 2023-03-17 23:01:24 +01:00
Jan Gromeš
fb6bbee4fa
Merge pull request #700 from gasagna/master
add functions to PhysicalLayer interface
2023-03-16 22:57:20 +01:00
Davide Lasagna
9c94111e73 add functions to PhysicalLayer interface 2023-03-16 19:35:27 +00:00
jgromes
f809f17dc8 [Pager] Added missing exclude direct receive guards (#697) 2023-03-13 22:02:07 +01:00
jgromes
482b962f79 [CC1101] Added missing standby overload 2023-03-12 15:03:16 +01:00
jgromes
a4df77b76e [Si443x] Added missing standby overload 2023-03-12 15:02:23 +01:00
jgromes
874886b4cd [RF69] Added missing standby overload 2023-03-12 15:02:08 +01:00
jgromes
45826fb00d [nRF24] Added missing standby overload 2023-03-12 15:01:50 +01:00
jgromes
8ace6350cf [SX127x] Added missing standby for PhysicalLayer (#695) 2023-03-12 14:50:14 +01:00
jgromes
00bb31cb2e [SX126x] Added patch binary license 2023-03-11 22:52:14 +01:00
jgromes
0818230a7c [SX126x] Fixed incorrect variable names 2023-03-11 20:57:32 +01:00
jgromes
265847b82d Removed WIP include 2023-03-11 20:26:58 +01:00
jgromes
97ab0d357a [SX126x] Added spectral scan 2023-03-11 20:09:03 +01:00
jgromes
15d698c38d Added missing Platformio keywords 2023-03-06 19:03:06 +01:00
jgromes
ead59223fa [STM32WLx] Fixed end of table macro (CI_BUILD_ALL) 2023-03-05 20:33:27 +01:00
jgromes
ed4fc84a70 [SX126x] Fixed calibration order (#689) (CI_BUILD_ALL) 2023-03-05 19:30:20 +01:00
jgromes
02306bda91 Added further explanation of the -707 error code (#691) 2023-03-05 19:29:06 +01:00
jgromes
823c0ff82c [SX126x] Added missing XTAL check 2023-03-05 19:28:21 +01:00
jgromes
5ba6f41230 [MOD] Convert end of RF switch mode to macro (https://github.com/jgromes/RadioLib/actions/runs/4337180408) 2023-03-05 19:16:37 +01:00
jgromes
e920e1bf07 [MOD] Fixed some signed comparison warnings 2023-03-05 19:14:14 +01:00
jgromes
6677b15d93 Bump version to 5.7.0 2023-03-05 18:24:14 +01:00
jgromes
c761e1e7ca Added Platformio badge 2023-03-05 18:20:07 +01:00
jgromes
d1ab3cd9b0 [CI] Removed uncrustify action until dubious ownership error is fixed 2023-03-05 18:16:16 +01:00
jgromes
8392cea011 [SX126x] Added more LBT/scan registers (CI_FORCE_UNCRUST) 2023-03-05 18:08:14 +01:00
jgromes
0c84726f5e Added Platformio library JSON (#690) 2023-03-05 17:52:49 +01:00
jgromes
007d9ac2cb [SX126x] Set SX1262 to accept SX1261 device string (#683) 2023-03-05 16:42:48 +01:00
jgromes
7a8cadc639 [SX126x] Added more verbose calibration result check (#689) 2023-03-05 16:40:45 +01:00
jgromes
721962cacd [SX126x] Fixed bug in getDeviceErrors 2023-03-05 16:39:50 +01:00
jgromes
8bf15941c7 [SX126x] Added option to control XTAL/TCXO via member variable 2023-03-05 16:38:28 +01:00
Jan Gromeš
8174c58250
Merge pull request #684 from GUVWAF/irqFlagsMask
[SX126x/SX128x] Add user-configurable IRQ flags and mask to receive methods
2023-03-05 15:08:13 +01:00
jgromes
25a5f7443c [SX127x] Fixed invalid sync word value in example 2023-03-05 14:57:20 +01:00
Jan Gromeš
50574d6676
Merge pull request #688 from brghena/fix-SX12xx-settings-examples
Fix args to begin() in SX12xx settings examples
2023-03-05 14:56:21 +01:00
jgromes
59b7d7df92 [CI] Workaround for dubious ownership error 2023-03-05 14:44:53 +01:00
jgromes
1b039e501d [CI] Disable uncrustify action 2023-03-04 23:42:11 +01:00
Branden Ghena
7c083e0796 Fix args to begin() in SX12xx settings examples 2023-03-02 22:28:40 -06:00
jgromes
40450e699c Fixed typo 2023-03-02 21:34:36 +01:00
jgromes
3c92219488 [MOD] Fixed print format (#685) 2023-03-01 21:50:40 +01:00
GUVWAF
edc8877adb [SX128x] Add irqFlags and irqMask to startReceive 2023-02-26 13:34:22 +01:00
GUVWAF
f59bf4750c [SX126x] Add irqFlags and irqMask parameters to receive methods 2023-02-26 13:33:30 +01:00
jgromes
00998b5185 [MOD] Fixed incorrect default TCXO voltage 2023-02-25 13:47:54 +01:00
jgromes
32a42ee2c6 [MOD] Fixed format type 2023-02-25 13:28:52 +01:00
jgromes
3596f0f55b [SX126x] Removed WIP FHSS method 2023-02-25 13:25:16 +01:00
jgromes
b014a1f748 [MOD] Improved regdump and hexdump 2023-02-25 13:20:30 +01:00
jgromes
bd258380c8 [SX126x] Implemeted device type string check 2023-02-25 13:16:21 +01:00
jgromes
547a522826 [SX126x] Added undocumented registers 2023-02-25 13:14:11 +01:00
jgromes
2b2dc2925f [PHY] Fixed unused variable warning 2023-02-19 17:14:31 +01:00
jgromes
d8c50ae8ad [MOD] Remove default arguments from implementations 2023-02-19 17:12:05 +01:00
jgromes
02d6062f09 [SX126x] Fixed forgotten SPI write command 2023-02-19 17:11:36 +01:00
jgromes
60bd3d6440 [SX128x] Use Module stream read/write 2023-02-19 17:07:00 +01:00
jgromes
95083e32b1 [SX126x] Use module stream read/write 2023-02-19 17:02:51 +01:00
jgromes
6bf9cebc43 [MOD] Added SPI stream read/write 2023-02-19 16:59:03 +01:00
jgromes
7d286e32bc [SX128x] Use Module SPI stream 2023-02-19 16:23:08 +01:00
jgromes
299e5de3c4 [SX126x] Use Module SPI tream 2023-02-19 16:16:16 +01:00
jgromes
a8d35f7881 [MOD] Use SPI stream for register read/write 2023-02-19 14:22:30 +01:00
jgromes
308ad87320 [MOD] Port 16-bit address from ax5x43 dev 2023-02-19 12:41:49 +01:00
jgromes
e07d1d9dc1 [MOD] Added stream SPI transfer 2023-02-19 12:32:17 +01:00
jgromes
455ce12eed [AFSK] Added SX126x to examples 2023-02-11 14:12:55 +01:00
jgromes
dc050df8d9 [SX126x] Added support for AFSK transmission 2023-02-11 14:11:44 +01:00
Jan Gromeš
526adc7431
Merge pull request #678 from matthijskooijman/remove-constexpr
[MOD] Remove constexpr usage
2023-02-04 15:49:21 +01:00
Matthijs Kooijman
4c712c1f2c [MOD] Remove constexpr usage
This was introduced when STM32WL support was added. Using constexpr for
the END_OF_MODE_TABLE constant allows it to be initialized in the class
declaration, but this needs C++11. This moves the initialization out of
the class declaration to the .cpp file, which does not need constexpr.
It also lets STM32WLx::END_OF_MODE_TABLE define its value directly
(instead of aliasing Module::END_OF_MODE_TABLE) to prevent reduce
runtime overhead (see below).

The downside of this change is that the value of the END_OF_MODE_TABLE
is no longer visible in other compilation units and thus cannot be
inlined into the rfswitch_table (if used).

For example, on STM32, this means that instead of having a pre-cooked
rfswitch_table that lives in the .rodata section (so can be read
directly from flash), the table lives in RAM and is initialized at
runtime (the actual modes and pins are copied from flash to RAM by the
standard startup loop that copies all of the .data section, and the
END_OF_MODE_TABLE value is copied by a bit of new generated code). This
means a little more runtime overhead, but the cost is mostly in RAM size
(80 bytes for the SMT32WL sketches, 16 per mode plus 16 for the
END_OF_MODE_TABLE).

In a first attempt at this commit, STM32WLx::END_OF_MODE_TABLE was still
initialized using the Module::END_OF_MODE_TABLE value, but since the
latter is also not available at compiletime, this meant initialization
of the former also needed to happen at runtime, adding even more code
overhead (and possibly leading to ordering issues as well). To avoid
this, the STM32WLx::END_OF_MODE_TABLE initialization now just duplicates
that of Module::END_OF_MODE_TABLE.

On AVR, the impact is not so much: Since AVR cannot address flash
directly, the table was already copied from flash to RAM at startup, so
the extra RAM usage is just 4 bytes because END_OF_MODE_TABLE is now
also present in RAM, to be copied into rfswitch_table at startup.

Options for avoiding this overhead (not implemented in this commit)
could be (in no particular order):

1. Use a macro instead of a constant. Downside is that these cannot be
   scoped inside the Module/STM32WLx classes like now, so this requires
   changes to sketches that use a rfswitch_table (and reduced scoping
   and using macros adds more opportunity for conflicts and weird
   errors).
2. Apply the change in this commit only when C++11 is not available.
   Downside is that the initialization value of these constants must be
   duplicated in the .h and .cpp file for C++ and older versions
   respectively.
3. Let sketches just use `{Module::MODE_END_OF_TABLE, {}}` explicitly
   instead of `Module::END_OF_MODE_TABLE`. Downside of this is that this
   requires sketches to be modified and that it lets the sketch encode
   more of the table structure, potentially making future API changes
   harder (but it probably does not really matter in practice).
4. Turn END_OF_MODE_TABLE into a static method, which *can* then be
   defined in the class declaration and inlined. The method can then be
   conditionally marked as constexpr, which allows C++11 compilers to
   completely resolve the rfswitch_table value at compiletime, producing
   a binary identical to before this commit. When constexpr is omitted
   (e.g. on older compilers), some runtime overhead is added (pretty
   much the same as the result from this commit).  Downside is that
   sketches must be modified, and the `END_OF_MODE_TABLE` "constant"
   must now be called, e.g.  `END_OF_MODE_TABLE()` which might be a bit
   unexpected syntax.
2023-02-03 12:42:49 +01:00
jgromes
1afa947030 [CI] Temporarily disable uncrustify action 2023-01-29 18:31:01 +01:00
jgromes
773b3e10aa [CI] Another attempt at dubious ownership fix (CI_FORCE_UNCRUST) 2023-01-29 18:28:01 +01:00
jgromes
0c2d40fda7 [CI] Fix dubious ownership error 2023-01-29 18:23:46 +01:00
Jan Gromeš
929b7d7179
Merge pull request #676 from jgromes/uncrustify
Added Uncrustify
2023-01-29 18:12:02 +01:00
Jan Gromeš
1a0daa6eb5
Go back to the original action 2023-01-29 17:37:11 +01:00
Jan Gromeš
ef85c5f476
Merge pull request #674 from andrew-moroz/sx126x-rx-gain-persist
sx126x-rx-gain-persist: add ability to persist Rx gain setting when calling SX126x::setRxBoostedGainMode
2023-01-29 16:53:55 +01:00
Andrew Moroz
5f3fb5fa0d sx126x-rx-gain-persist: add ability to persist Rx gain setting when calling SX126x::setRxBoostedGainMode 2023-01-28 18:09:39 -05:00
jgromes
dc3fb2d303 [CI] Use patched action 2023-01-22 19:55:59 +01:00
jgromes
ec2da7dc3e [CI] Added option to force check CI_FORCE_UNCRUST 2023-01-22 19:45:51 +01:00
jgromes
67e52ed27a [CI] Added uncrustify workflow 2023-01-22 19:33:36 +01:00
jgromes
e353844afe Added uncrustify config file 2023-01-22 19:13:06 +01:00
jgromes
18ff62890a [SX127x] Fixed packet length not proagating correctly (#666) 2023-01-18 22:00:26 +01:00
jgromes
91d42ebf0e [SX127x] Set minimum bit rate to 0.5 kbps (#665) 2023-01-18 18:58:52 +01:00
jgromes
0a0f6979dd [RF69] Set minimum bit rate to 0.5 kbps 2023-01-18 18:58:26 +01:00
Jan Gromeš
7a25b27c31
Merge pull request #663 from andrew-moroz/andrew-moroz/sx126x-rx-boosted-gain
[SX126x] Add method to support SX126x Rx Boosted Gain mode
2023-01-16 23:08:37 +01:00
Andrew Moroz
35ed685c8a andrew-moroz/sx126x-rx-boosted-gain: Add method to support SX126x Rx Boosted Gain mode 2023-01-16 16:37:14 -05:00
jgromes
b78693b8fb [CI] Fixed options (CI_BUILD_ALL) 2023-01-16 18:58:50 +01:00
jgromes
39aac172a4 [CI] Fixed missing colon (CI_BUILD_ALL) 2023-01-16 18:55:28 +01:00
jgromes
230fd3376a [CI] Fixed remaining output variables (CI_BUILD_ALL) 2023-01-16 18:52:28 +01:00
jgromes
c478d9db20 [CI] Remove extra quotes (esp32:esp32:esp32) 2023-01-16 18:45:37 +01:00
jgromes
143571e0a1 [CI] Try to fix broken index URLs (esp32:esp32:esp32) 2023-01-16 18:43:45 +01:00
jgromes
3da909ec3d [CI] Fixed deprecation warnings (CI_BUILD_ALL) 2023-01-16 18:12:56 +01:00
jgromes
eaaac36f28 Bump version to 5.6.0 2023-01-15 17:42:44 +01:00
jgromes
30489ba010 Added note about STM32WL to readme 2023-01-15 09:50:05 +01:00
jgromes
5b96340332 [CC1101] Fixed setPromiscuousMode(true) always failing 2023-01-14 23:20:27 +01:00
jgromes
2c8b63e038 [Hell] Fixed timing issues on SX126x with TCXO (#659) 2023-01-14 23:13:58 +01:00
jgromes
5ca2c8533c [PHY] Added standby types abstraction 2023-01-14 23:13:27 +01:00
Jan Gromeš
7267e5ffc9
Merge pull request #649 from matthijskooijman/add-stm32wl
Add support for STM32WL integrated transceivers
2023-01-14 18:52:37 +01:00
jgromes
ba05317b72 Added new keywords 2023-01-10 18:09:55 +01:00
Matthijs Kooijman
6531ce7400 [CI]: Set up CI for STM32WLx (CI_BUILD_ALL)
This adds a build for the Nucleo WL55JC1 board, and ensures that
the STM32WLx examples are skipped on all other boards.

To slightly generalize the list of boards, this pushes the pnum option
for the black pill into the boards list, instead of setting it into the
options variable (even though it is technically a board option and not
the board itself, conceptually it is part of the selected board and
these values are just concatenated, so it can go in either place).

Co-Authored-By: jgromes <jan.gromes@gmail.com>
2023-01-10 18:09:55 +01:00
Matthijs Kooijman
e116a20d89 [STM32WLx] Add examples
Co-Authored-By: jgromes <jan.gromes@gmail.com>
2023-01-10 18:09:55 +01:00
Matthijs Kooijman
e52ffb0a69 [STM32WLx] Only build on compatible STM32 boards
This checks for some system macros to be set, but also includes the
doxygen build to generate documentation.

This reuses the RADIOLIB_EXCLUDE_STM32WLX that the code already checks
for to prevent having to duplicate this macro check in four places.

To detect running inside doxygen, this configures doxygen to predefine
a DOXYGEN macro (it seems no such macros are defined by default by
doxygen).
2023-01-10 18:09:55 +01:00
Matthijs Kooijman
3e2810cfbb [STM32WLx] Make reading IRQ flag more reliable
Now that clearIrqStatus also clears the pending flag, reading the IRQ
flag no longer has to, making this more reliable.
2023-01-10 18:09:55 +01:00
Matthijs Kooijman
cd138dd6c7 [STM32WLx] Apply PA clamp workaround for HP only
This modifies SX1262::begin and beginFSK to call setOutputPower after
applying the workaround, so that can undo the workaround if needed.
2023-01-10 18:09:55 +01:00
Matthijs Kooijman
9252cf53d3 [STM32WLx] Implement setDio1Action / interrupts
Because this interrupt is not connected to a GPIO or even the EXTI unit,
but directly to the MCU NVIC, the regular attachInterrupt flow cannot be
used.

Instead, this lets STM32WLx override the setDio1Action() and
clearDio1Action() methods to register the radio IRQ directly. Note that
it would have been nicer to implement this by overriding attachInterrupt
in STM32WLx_Module, but that is never called for virtual pins (because
the STM32Duino digitalPinToInterrupt() macro does not work for virtual
pins).

In addition, because the NVIC is level-sensitive and the code expects
edge-sensitive interrupts (for GPIO, the EXTI module in front of the
NVIC makes the interrupts edge-sensitive), this adds some additional
handling around the user-registered interrupt callback. To prevent the
ISR from triggering over and over again (and also to not require SPI
transactions in the ISR to clear the IRQ flags inside the radio), the
interrupt is disabled in the NVIC whenever it is trigered. Then,
whenever the IRQ flags *are* cleared in the radio, the IRQ is enabled in
the NVIC again. This requires making the SX126x::clearIrqStatus() method
virtual so STM32WLx can override it.
2023-01-10 18:09:55 +01:00
Matthijs Kooijman
5e47d94418 [STM32WLx] Add module for STM32WL MCUs with integrated radio (#588)
This is a nearly complete implementation, except that the Dio1 interrupt
is not yet supported (this will be added in a subsequent commit to
simplify review).

This fixes #588.
2023-01-10 18:09:55 +01:00
Matthijs Kooijman
da6c3f6a6b [SX126x] Allow subclasses to change the TX mode used
This prepares for adding a STM32WLx subclass later.
2023-01-09 10:26:28 +01:00
Matthijs Kooijman
52ec165643 Update radios to use new setRfSwitchState
This removes the compatibility wrapper and applies the following
replacements:

    sed -i 's/setRfSwitchState(LOW, LOW)/setRfSwitchState(Module::MODE_IDLE)/' src/modules/*/*.cpp
    sed -i 's/setRfSwitchState(HIGH, LOW)/setRfSwitchState(Module::MODE_RX)/' src/modules/*/*.cpp
    sed -i 's/setRfSwitchState(LOW, HIGH)/setRfSwitchState(Module::MODE_TX)/' src/modules/*/*.cpp
2023-01-09 10:26:28 +01:00
Matthijs Kooijman
3779faf600 Add setRfSwitchTable() wrapper methods
This gives all radios that use an rfswitch (i.e. have
a setRfSwitchPins() wrapper already) a wrapper method for
setRfSwitchTable() too. This wrapper just calls the same method on
Module, to make it easier for sketches to use it.
2023-01-09 10:26:27 +01:00
Matthijs Kooijman
83ff964b66 [MOD] Generalize rfswitch pin handling
This defines operation modes (IDLE, RX and TX) and allows defining up to
to three pins to be controlled. For each mode a value can be specified
for each pin a table.

Compared to the previous handling, this:
 - Allows up to three pins instead of only two.
 - Gives more control over output pin values (e.g. to simply change
   polarity or support more complex control logic).

In addition, the modes are treated as opaque by the Module code,
allowing radio classes to define their own modes if needed.

Some notes regarding the implementation:
 - The number of pins is limited at three, since most boards seem to need
   only two pins and only the Nucleo STM32WL55 board needs three. If
   more pins are needed in the future, the setRfSwitchTable()
   can be overloaded to accept either a 3-element or e.g. 4-element pins
   array, to allow new and old code to work as-is.

   Note that there is a RFSWITCH_MAX_PINS constant defined, but it is
   not recommended for sketches to use this constant when defining
   a rfswitch pins array, to prevent issues when this value is ever
   increased and such an array gets extra zero elements (that will be
   interpreted as pin 0).

   Note that this is not a problem for the RfSwitchMode_t values array,
   since any extra values in there will only be used if a valid pin was
   set in the pins array.

 - The pins array is passed by reference, so the compiler complains if
   the array passed is not the expected size. Since a reference to an
   array without a length is not supported (at least not by the gcc
   7 used by the AVR core - gcc 10 for STM32 seems to accept it), the
   table array is passed as a pointer instead (but because arrays and
   pointers are reasonably interchangeable, the caller does not see the
   difference).

 - The existing setRfSwitchPins() method is still supported as before.
   Internally it creates a table with the right values and pins and
   passes those to setRfSwitchTable.

 - For easier review, this commit does not modify all calls to
   setRfSwitchState() in all radio modules yet, but has a compatibility
   wrapper to delay this change until the next commit. Similarly, the
   setRfSwitchTable() method is now defined on Module only, a wrapper
   for it will be defined in all radios that already have the
   setRfSwitchPins() wrapper in another commit.

 - To allow future radios to define any number of modes, the modes table
   does not have a fixed length, but instead is terminated by a special
   value. This is a bit fragile (if the terminator is omitted, the code
   will read past the end of the array), but rather flexible. One
   alternative to this approach would be to make setRfSwitchTable
   a template that deduces the array size from a template argument and
   then stores the size explicitly, but using templates probably reduces
   code clarity.
2023-01-09 09:46:39 +01:00
Matthijs Kooijman
90b28d7722 Remove duplicated setRfSwitchPins documentation
All radios that support RfSwitch define this method that simply forwards
to the `Module::setRfSwitchPins()` method. Previously, all these methods
duplicated the documentation as well, but this uses the doxygen \copydoc
to remove this duplication.
2023-01-09 09:46:31 +01:00
jgromes
139a68dfd4 [EXT] Added support for external radios (646) 2023-01-08 15:12:49 +01:00
jgromes
02de83f941 [PHY] Made virtual overloads non-pure 2023-01-08 15:10:48 +01:00
jgromes
27c1eb715a Removed remaining enable interrupt (#657) 2023-01-07 22:31:20 +01:00
jgromes
6666060d52 Removed unnecessary interrupt enable (#657) 2023-01-07 22:21:16 +01:00
jgromes
0cd9dd2983 [SX126x] Added note about allowed OCP range (#654) 2023-01-04 10:22:06 +01:00
jgromes
3a34594b5b [SX126x] Fixed incorrect OCP step in documentation (#654) 2023-01-03 20:20:58 +01:00
jgromes
a0884bf120 [SX128x] Added option to set custom ranging calibration (#293) 2023-01-01 18:31:03 +01:00
jgromes
088207df4c [SX1280] Only check ranging address on slave 2023-01-01 18:03:48 +01:00
jgromes
395844922c [Stream] Cleaned up transmit example 2022-12-22 18:19:54 +01:00
jgromes
8b8c6614aa Added VS code to gitignore 2022-12-22 18:18:55 +01:00
jgromes
0144faf02a [RF69] Fixed stream mode (#651) 2022-12-22 18:18:16 +01:00
jgromes
18fefc0ca9 [SX127x] Removed unnecessary volatile 2022-12-22 18:17:41 +01:00
Jan Gromeš
8d02fda5a1
Merge pull request #651 from notsleep196/master
[SX127x] Fix FSK Stream mode TX and RX
2022-12-22 17:33:26 +01:00
jgromes
607ae1035c [Pager] Fixed inversion logic (#641) 2022-12-22 16:19:10 +01:00
jgromes
81c5504260 [PHY] Added debug direct mode output 2022-12-22 16:18:50 +01:00
Mitrokhin Anton
e073da15da Fix FSK Stream mode TX and RX 2022-12-22 12:21:01 +07:00
Jan Gromeš
674f25faa4
Merge pull request #648 from matthijskooijman/sx126x-fixes
[SX126x] Fix comments & Dio2 for FSK
2022-12-21 10:37:57 +01:00
Matthijs Kooijman
dfbe6934bb [SX126x] Set DIO2 to RF switch by default for FSK too
In commit a1f94d9f ([SX126x] Set DIO2 to RF switch by default), this was
changed for LoRa modulation in begin(), but since this is really
a board-specific attribute, independent of the modulation used, there is
no reason to have a different default for FSK (so this was probably just
forgotten).
2022-12-20 23:33:02 +01:00
Matthijs Kooijman
47163f4398 [SX126x] Make begin parameter docs consistent
This:
 - Updates syncWord comments after changing it from uint16_t to uint8_t
   in commit 55aff74a ([SX126x] Changed pin mapping, added reset,
   changed LoRa sync word to 1B).
 - Adds missing useRegulatorLDO comments forgoten in commit ea85a663
   ([SX126x] Pass useRegulatorLDO to SX1262/SX1261/SX1268).
 - Makes useRegulatorLDO comments the same in all places (using the more
   explicit version).
 - Fixes a typo in the doxygen \parma -> \param command.
2022-12-20 23:33:02 +01:00
jgromes
132c2b3b82 Fixed inversion logic and inverted frame sync word (#641) 2022-12-15 17:37:41 +01:00
jgromes
c1674fba82 Added unofficial RP2040 to list of supported platforms (CI_BUILD_ALL) 2022-12-14 22:42:07 +01:00
jgromes
947ff48df6 Added support for unofficial Raspberry Pi Pico core (#643) 2022-12-14 22:37:25 +01:00
jgromes
f66a31c4f4 [CI] Removed old skip patterns 2022-12-14 22:35:02 +01:00
jgromes
60b73d5ccd [Pager] Implemented inversion for receive (#641) 2022-12-12 21:07:35 +01:00
Jan Gromeš
b57e7275fd
Merge pull request #632 from caveman99/master
SX128x: Access getIrqStatus() without Godmode
2022-12-06 07:58:24 +01:00
Thomas Göttgens
0aa59f6abc Fix coding style 2022-12-06 07:53:14 +01:00
Thomas Göttgens
08de95e15e Access getIrqStatus() without Godmode and change the flag setting like SX126x handles it. 2022-12-05 11:17:59 +01:00
jgromes
aa8330cf57 [Si443x] Added GFSK with BT 0.5 (#625) 2022-12-04 10:19:42 +01:00
Jan Gromeš
ac5f719633
Merge pull request #631 from rfquack/master
[RF69] Missing 1000.0 multipler in
2022-12-04 10:09:55 +01:00
Federico Maggi
7b4c27b702
[RF69] Missing 1000.0 multipler in 2022-12-04 00:21:22 +01:00
Jan Gromeš
e054172f7a
Merge pull request #627 from rfquack/master
[RF69/CC1101] Fixed corner case in `setPromiscuousMode(false)`
2022-12-01 18:22:37 +01:00
Jan Gromeš
73752ec88a
Merge pull request #629 from IhorNehrutsa/excludes
Fix RADIOLIB_EXCLUDE_APRS, RADIOLIB_EXCLUDE_PAGER
2022-12-01 18:20:39 +01:00
Ihor Nehrutsa
9abb3fd396 Update Pager.cpp 2022-12-01 17:47:42 +02:00
Ihor Nehrutsa
ee32b3d82a Update APRS.cpp 2022-12-01 17:47:34 +02:00
Federico Maggi
09669eeb26
[CC1101] Fix setPromiscuousMode(false) bug
Signed-off-by: Federico Maggi <federico.maggi@gmail.com>
2022-12-01 13:32:47 +01:00
Federico Maggi
894e912252
[RF69] Fixed setPromiscuousMode(false) corner case
Signed-off-by: Federico Maggi <federico.maggi@gmail.com>
2022-12-01 13:24:42 +01:00
jgromes
7295e9731e [Pager] Fixed default example pins 2022-11-27 20:47:18 +01:00
jgromes
f51229ef9a [Pager] Added option to invert frequencies (#7) 2022-11-27 20:47:01 +01:00
Jan Gromeš
b9a7116113
Merge pull request #623 from rfquack/master
No bound checks on frequency deviation if ~OOK
2022-11-27 18:36:29 +01:00
Federico Maggi
9422723bb7
[CC1101] Validate freq-dev unless special value 0
Signed-off-by: Federico Maggi <federico.maggi@gmail.com>
2022-11-27 10:20:29 +01:00
Federico Maggi
befba28629
No bound checks on frequency deviation if ~FSK 2022-11-26 19:38:36 +01:00
Jan Gromeš
8c37da0720
Merge pull request #614 from rfquack/master
[RF69 & CC1101] Reworked cached parameters into getters
2022-11-21 16:14:05 +01:00
Federico Maggi
05217c095b
- Defined new RADIOLIB_ERR_NULL_POINTER
- all `begin()` now use macros for init values
- addressed other styling comments as per PR#612 review

Signed-off-by: Federico Maggi <federico.maggi@gmail.com>
2022-11-21 09:09:56 +01:00
Federico Maggi
1322796542
[RF69 & CC1101] Reworked cached parameters into getters
Signed-off-by: Federico Maggi <federico.maggi@gmail.com>
2022-11-20 01:35:08 +01:00
jgromes
3fa34b433a Bump version to 5.5.0 2022-11-19 14:20:14 +01:00
jgromes
72ce5dfd93 Reworked macro reporting in debug mode 2022-11-19 14:19:57 +01:00
jgromes
328a3bfedc Merge branch 'master' of https://github.com/jgromes/RadioLib 2022-11-18 18:06:07 +01:00
jgromes
2f0dac1bb7 [SSTV] Added support for interrupt-based timing (#596) 2022-11-18 18:05:42 +01:00
jgromes
f69723b96c [Morse] Added support for interrupt-based timing 2022-11-18 17:55:08 +01:00
jgromes
e1c217305f [Hell] Added support for interrupt-based timing 2022-11-18 17:39:18 +01:00
jgromes
2bf5297b32 [FSK4] ADded support for interrupt-based timing 2022-11-18 17:24:20 +01:00
jgromes
abc7cf179a [AX25] Added support for interrupt-based timing 2022-11-18 17:24:01 +01:00
jgromes
3e64e819c7 [RTTY] Added support for interrupt-based timing 2022-11-18 17:07:01 +01:00
jgromes
5327952af5 Added links to interrupt-based wiki page 2022-11-18 17:06:38 +01:00
jgromes
c3d6700e76 [PHY] Added support for interrupt-based timing 2022-11-18 17:04:52 +01:00
jgromes
04357cb306 [MOD] Added support for interrupt-based timing 2022-11-18 17:03:34 +01:00
Jan Gromeš
02619b9c06
Merge pull request #613 from CCChelios/master
Update CC1101_Settings.ino
2022-11-18 15:44:39 +01:00
CCChelios
53f954a179
Update CC1101_Settings.ino 2022-11-18 16:28:42 +03:00
jgromes
355446c43a [FSK4] Added correction method 2022-11-18 13:56:40 +01:00
jgromes
29813352d4 [SSTV] Moved correction factor to its own method 2022-11-18 13:54:12 +01:00
jgromes
f942ccaec7 [SX126x] Added option to specify custom CAD parameters 2022-11-18 13:39:51 +01:00
jgromes
e02b3f2ce0 [SX126x] Added missing Rx write arguments 2022-11-18 11:35:32 +01:00
Jan Gromeš
555f0216c1
Merge pull request #612 from Amalinda/master
Update SX126x.cpp to configure CAD based on set SF
2022-11-18 11:31:10 +01:00
Amalinda Gamage
a7e56800a8
Update SX126x.cpp 2022-11-18 16:08:57 +08:00
Jan Gromeš
5c22c72bd3
Merge pull request #611 from fpistm/cast_issue
fix: wrong cast
2022-11-17 17:51:13 +01:00
Frederic Pillon
1fc9b3a142 fix: wrong cast
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
2022-11-17 16:06:19 +01:00
jgromes
feb9aaa227 [SX127x] Added option to keep received data despite CRC error (#610) 2022-11-16 19:21:55 +01:00
jgromes
f68bef2877 [PHY] Added option to keep received data despite CRC error 2022-11-16 19:21:52 +01:00
Jan Gromeš
63208f1e89
Merge pull request #609 from caveman99/master
add Portduino as a platform
2022-11-15 14:45:25 +01:00
jgromes
a848cf281b [Pager] Added option to retrieve matched address on reception 2022-11-14 21:19:16 +01:00
jgromes
00fc7cd5b9 [Pager] Added optional custom frequnecy shift 2022-11-14 21:18:42 +01:00
Thomas Göttgens
58d744ae7a
Portduino is simulating an UNO WIFI
the same definition works now.
2022-11-14 12:58:46 +01:00
jgromes
4667c26448 [SX128x] Removed slowdown macro (#158) 2022-11-13 22:12:34 +01:00
jgromes
b11deda33d [SX126x] Removed slowdown macro (#158) 2022-11-13 22:12:04 +01:00
jgromes
a28aff7971 Moved callback generators to the end of Module declaration (#605) 2022-11-13 11:03:05 +01:00
jgromes
5efdeedd67 [SX1262] Fixed allowed output power range (-9 dBm minimum). 2022-11-06 22:51:21 +01:00
jgromes
df7d1a99fe [SX126x] Fixed incorrect method called from derived class (#599) 2022-10-31 20:17:05 +01:00
jgromes
c9e11d4f37 Fixed some typos 2022-10-28 21:03:20 +02:00
jgromes
1227ea4cd1 [SX127x] Added CAD receive example 2022-10-23 20:41:04 +02:00
jgromes
c3fa027108 [SX127x] Fixed CAD interrupt example 2022-10-23 20:40:13 +02:00
jgromes
1316a805f3 [SX127x] Added option to specify interrupt direction for DIO 2022-10-23 20:39:15 +02:00
jgromes
d80f87410e [SX127x] Removed redundant IRQ clear 2022-10-23 20:38:36 +02:00
jgromes
9497cd3af1 [SX127x] Minor formatting fixes 2022-10-23 20:38:11 +02:00
jgromes
67937f4f46 [AX25] Added option to modify tone length for AFSK mode 2022-10-23 10:18:49 +02:00
jgromes
b903ddabc6 [Pager] Added missing IRAM_ATTR for ESP platforms 2022-10-22 23:49:13 +02:00
jgromes
edc04f16bd [Pager] Added missing input pinmode 2022-10-22 23:48:57 +02:00
jgromes
45e65a2811 [SX127x] Removed comment suggesting setGain only available on LoRa mode 2022-10-22 23:48:37 +02:00
jgromes
baf2a78981 [SX127x] Added missing GPIO input configuration in FSK mode 2022-10-22 23:48:17 +02:00
jgromes
88f528a789 [PHY] Added method to manually drop synchronization in direct mode 2022-10-19 18:10:45 +02:00
jgromes
39489aeae6 [AX25] Added override for Arduino String class transmit 2022-10-16 17:47:58 +02:00
jgromes
6eeee45968 [CC1101] Use GDO2 for transmit interrupt (#357) 2022-10-09 19:21:39 +02:00
jgromes
ae64ec1911 [CC1101] Fixed incorrect GPIO NC check logic 2022-10-09 19:14:07 +02:00
jgromes
0b1a421863 [SX126x] Fixed receive always failing after timeout 2022-10-06 19:30:13 +02:00
jgromes
ee7cf446e2 Bump version to 5.4.1 2022-10-04 19:42:36 +02:00
jgromes
170ce9752b [SX126x] Skip SPI verification during block calibration (#583) 2022-10-04 18:19:54 +02:00
jgromes
f6e5d02481 [Pager] Reworked logic to workaround linker error on MegaCore (CI_BUILD_ALL) 2022-10-02 12:19:33 +02:00
jgromes
1382e56508 [SX126x] Removed extra newline (CI_BUILD_ALL) 2022-10-02 00:02:17 +02:00
jgromes
ae04d3dbb3 [Pager] Fixed strncpy length 2022-10-02 00:00:50 +02:00
jgromes
0e43ee0efa Fixed pulseIn on mbed platforms (CI_BUILD_ALL) 2022-10-01 23:55:50 +02:00
jgromes
37f3f138ea Bump version to 5.4.0 2022-10-01 23:01:45 +02:00
jgromes
9a55aa8494 Added missing keyword 2022-10-01 23:01:05 +02:00
jgromes
fc3a85abf9 [SX128x] Added post-transaction error checking 2022-10-01 22:54:36 +02:00
jgromes
e31bcd315b [SX126x] Fixed RTC control register address (#575) 2022-10-01 22:46:50 +02:00
jgromes
3bdc8963a4 [SX126x] Added post-transaction error checking (#575) 2022-10-01 22:46:17 +02:00
jgromes
3baa4bd80f [Pager] Fixed narrow type comparison 2022-10-01 16:11:07 +02:00
jgromes
afcbfa9a21 Added missing link 2022-10-01 16:08:28 +02:00
jgromes
09c418ab43 Added POCSAG to the list of supported protocols 2022-10-01 16:04:24 +02:00
jgromes
1507933475 [nRF24] Fixed interface for PhysicalLayer 2022-10-01 15:29:29 +02:00
jgromes
e5fe82f334 [SX128x] Fixed setBitRate compatibility with PhysicalLayer 2022-10-01 15:16:01 +02:00
jgromes
972e651f4f [SX126x] Added missing setFrequency implementation for PhysicalLayer 2022-10-01 15:06:09 +02:00
jgromes
1f75ee0cc1 [Pager] Implemented POCSAG (#7) 2022-10-01 14:56:37 +02:00
jgromes
2980d8dbf1 [MOD] Fixed signed/unsigned comparison warning 2022-09-18 16:20:16 +02:00
jgromes
a1aa52cbea [PHY] Suppress unused arguments 2022-09-18 16:18:56 +02:00
jgromes
0b5cd51828 [SX128x] Added finishTransmit 2022-09-18 16:15:07 +02:00
jgromes
8a81a7c827 [RF69] Added finishTransmit 2022-09-18 16:14:42 +02:00
jgromes
598982c782 [nRF24] Added finishTransmit 2022-09-18 16:14:19 +02:00
jgromes
733835e9ba [Si443x] Added finishTransmit 2022-09-18 16:14:04 +02:00
jgromes
0d72dd2ac3 [SX127x] Added finishTransmit (#571) 2022-09-18 16:13:39 +02:00
jgromes
0ae6eae4d9 [SX126x] Added finishTransmit 2022-09-18 16:12:53 +02:00
jgromes
9dff4e709e [CC1101] Added finishTransmit 2022-09-18 16:12:03 +02:00
jgromes
9db64292c4 [PHY] Added finishTransmit 2022-09-18 16:10:54 +02:00
jgromes
e1d4c2094b [SX127x] Fixed software timeout logic 2022-09-18 15:42:06 +02:00
jgromes
cb5fd16710 [SX127x] Added software timeout when using blocking receive without DIO1 (#566) 2022-09-18 15:07:57 +02:00
jgromes
ffb2c15a50 [SX127x] Definition fixes suggested by @MrSniffer 2022-09-17 19:47:09 +02:00
Jan Gromeš
1bd9409bcf
Merge pull request #561 from obones/setRSSIThreshold
Introduce the setRSSIThreshold method
2022-08-25 19:28:20 +02:00
obones
40599baef1 Use the RADIOLIB_CHECK_RANGE macro along with proper lower value (it has to be negative) 2022-08-25 10:39:21 +02:00
obones
a7b42b61b2 Use a better name for the parameter so that it is clear that it's dBm that are expected here 2022-08-24 15:38:12 +02:00
obones
9a76aa1c84 Introduce setRSSIThreshold on SX127x modules 2022-08-24 15:05:20 +02:00
OBones
fd3b165bf0 Introduce setRSSIThreshold on RF69 modules 2022-08-23 17:41:37 +02:00
jgromes
bedbf7bb94 [RFM9x] Fixed missing default argument for beginFSK (#553) 2022-08-20 19:01:24 +02:00
jgromes
30cb7c8dd4 [APRS] Added Mic-E (#430) 2022-08-20 18:14:13 +02:00
jgromes
a8c079f85e [MOD] Fixed hexdump printing when length is not divisible by 16 2022-08-18 20:48:51 +02:00
jgromes
da0993a6ed Added RADIOLIB_EXCLUDE_DIRECT_RECEIVE exclusion macro (#557) 2022-08-15 19:19:59 +02:00
jgromes
ec94177c2a [MOD] Cache tone value on ESP32 (#553) 2022-08-09 20:20:19 +02:00
jgromes
4a637b44f1 [Morse] Fixed bug in decoder logic 2022-08-07 10:21:07 +02:00
jgromes
655dfaae45 Added missing pulsein callback set 2022-08-07 09:57:41 +02:00
Jan Gromeš
4a4e6f89a3
Merge pull request #554 from majbthrd/noarduino
remedy Module when RADIOLIB_BUILD_ARDUINO is not defined
2022-08-06 11:38:06 +02:00
Peter Lawrence
4bdec52f88 remedy Module when RADIOLIB_BUILD_ARDUINO is not defined 2022-08-04 17:46:58 -05:00
jgromes
8675f13e5d [Morse] Added basic Morse receive support (#545) CI_BUILD_ALL 2022-07-30 08:53:57 +02:00
jgromes
8768900767 [Morse] Added Morse transmit AM example 2022-07-30 08:52:09 +02:00
jgromes
7735cffb62 [Morse] Reworked example naming 2022-07-30 08:51:44 +02:00
jgromes
356f1ef2fd Fixed compatibility with STM32 core >2.0.0 (#549) 2022-07-24 19:59:14 +02:00
jgromes
ae7065da7b Bump version to 5.3.0 2022-07-17 10:14:24 +02:00
Jan Gromeš
80950a1c22
Merge pull request #546 from NorthernMan54/master
Tweaks for async direct mode usage with rtl_433_ESP
2022-07-17 10:12:41 +02:00
Northern Man
a74c0536b8 Tweaks for async direct mode usage with rtl_433_ESP 2022-07-16 21:50:33 -04:00
Jan Gromeš
96f2e34e09
Merge pull request #542 from obones/setDIOMapping
Introduce the setDIOMapping method
2022-07-13 23:04:48 +02:00
obones
0b2238a0a4 The SX127x family of chips shares the same DIO pin functions, so move all the support code in the base SX127x class 2022-07-13 10:05:45 +02:00
jgromes
60aa0098b3 [RF69][SX1231] Added Stream support (#201) 2022-07-10 20:41:11 +02:00
jgromes
31da00649c [SX127x] Added missing cast 2022-07-10 20:35:49 +02:00
jgromes
d8c11fa8c9 [SX127x] Added missing Doxygen comments 2022-07-10 19:54:57 +02:00
jgromes
ce26892567 [SX127x] Fixed FSK maximum packet length 2022-07-10 19:48:56 +02:00
jgromes
9836e57616 [Stream] Added Stream mode support for SX127x (#201) (#403) 2022-07-10 17:43:51 +02:00
obones
f9ab9d80d5 SX1231 has slightly different DIO mapping tables from the RF69 ones 2022-07-07 15:36:26 +02:00
obones
bdb14b9e9d Implement setDIOMapping for RF69 family 2022-07-07 15:36:26 +02:00
obones
069428a9f6 Implement setDIOMapping for SX1278 family 2022-07-07 15:36:26 +02:00
obones
e1412108c1 Implement setDIOMapping for CC1101 2022-07-07 15:36:26 +02:00
obones
e421ab4272 Introduce setDIOMapping on the PhysicalLayer class which, by default, returns "not implemented" 2022-07-07 15:36:25 +02:00
jgromes
8ae092ac81 [MOD] Added regdump function 2022-07-04 15:30:37 +02:00
jgromes
907de02a79 [PHY] getMod moved to private and only acessible to friend classes 2022-07-04 15:28:26 +02:00
jgromes
701e2c4a21 [SX127x] Formatting fixes 2022-07-04 15:17:41 +02:00
jgromes
756125cd8b Merge branch 'master' of https://github.com/jgromes/RadioLib 2022-07-03 11:06:46 +02:00
jgromes
f8f73d2ccb [MOD] Added helper hexdump function 2022-07-03 11:05:56 +02:00
Jan Gromeš
f5d48770cd
Merge pull request #540 from Jaimi5/master
RadioLib - getTimeOnAir for SX127x modules
2022-07-02 08:33:40 +02:00
Jaimi5
46919cb249 RadioLib - FSK getTimeOnAir, crc bits and packet length configuration fixed 2022-07-01 17:03:02 +02:00
Jaimi5
3b305591d2 RadioLib - syncWord to bits 2022-06-26 23:49:15 +02:00
Jaimi5
de84410e69 RadioLib - type of packet length FSK mode getter changed. 2022-06-26 23:39:44 +02:00
Jaimi5
314fcb2d6e RadioLib - getTimeOnAir for FSK mode in module SX127x 2022-06-26 23:33:05 +02:00
Jaimi5
19715ef204 RadioLib - Now getTimeOnAir returns microseconds 2022-06-25 14:04:44 +02:00
Jaimi5
298dbe8e5c RadioLib - getTimeOnAir for SX127x modules 2022-06-24 17:38:31 +02:00
jgromes
e5e8947e94 [SX127x] Fixed incorrect packet length check in FSK mode 2022-06-19 16:10:33 +02:00
335 changed files with 123780 additions and 14149 deletions

3
.gitattributes vendored Normal file
View file

@ -0,0 +1,3 @@
# exclude binary patch files from language detection
src/modules/SX126x/patches/*.h linguist-detectable=false
src/modules/LR11x0/firmware/*.h linguist-detectable=false

View file

@ -7,14 +7,34 @@ assignees: ''
---
**IMPORTANT: Check the wiki**
Before submitting new issue, please check the [Wiki](https://github.com/jgromes/RadioLib/wiki) and the [API documentation](https://jgromes.github.io/RadioLib/). You might find a solution to your issue there.
**IMPORTANT: Check the docs**
Before submitting new issue, please check the [Troubleshooting Guide](https://github.com/jgromes/RadioLib/wiki/Troubleshooting-Guide) Wiki page and the [API documentation](https://jgromes.github.io/RadioLib/). If you are seeing an error code, we have [online status code decoder](https://radiolib-org.github.io/status_decoder/decode.html).
**Describe the bug**
A clear and concise description of what the bug is. When applicable, please include [debug mode output](https://github.com/jgromes/RadioLib/wiki/Debug-mode).
A clear and concise description of what the bug is. When applicable, please include [debug mode output](https://github.com/jgromes/RadioLib/wiki/Debug-mode) **using the appropriate debug mode**.
<details><summary>Debug mode output</summary>
<p>
```
paste the debug output here
```
</p>
</details>
**To Reproduce**
Minimal Arduino sketch to reproduce the behavior. Please user Markdown to style the code to make it readable (see [Markdown Cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code)).
Minimal Arduino sketch to reproduce the behavior. Please use Markdown to style the code to make it readable (see [Markdown Cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code)).
<details><summary>Sketch that is causing the module fail</summary>
<p>
```c++
paste the sketch here, even if it is an unmodified example code
```
</p>
</details>
**Expected behavior**
A clear and concise description of what you expected to happen.
@ -27,4 +47,4 @@ If applicable, add screenshots to help explain your problem.
- Link to Arduino core: [e.g. https://github.com/stm32duino/Arduino_Core_STM32 when using official STM32 core. See readme for links to all supported cores]
- Wireless module type [e.g. CC1101, SX1268, etc.]
- Arduino IDE version [e.g. 1.8.5]
- Library version [e.g. 3.0.0]
- Library version [e.g. 3.0.0 or git hash]

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View file

@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: RadioLib Discussions
url: https://github.com/jgromes/RadioLib/discussions
about: Please ask generic questions here.

View file

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

View file

@ -9,26 +9,40 @@ assignees: ''
**IMPORTANT: Before submitting an issue, please check the following:**
1. **Read [CONTRIBUTING.md](https://github.com/jgromes/RadioLib/blob/master/CONTRIBUTING.md)!** Issues that do not follow this document will be closed/locked/deleted/ignored.
2. RadioLib has a [Wiki](https://github.com/jgromes/RadioLib/wiki) and an extensive [API documentation](https://jgromes.github.io/RadioLib/). You might find a solution to your issue there.
2. RadioLib has a [Troubleshooting Guide](https://github.com/jgromes/RadioLib/wiki/Troubleshooting-Guide) Wiki page and an extensive [API documentation](https://jgromes.github.io/RadioLib/). If you are seeing an error code, we have [online status code decoder](https://radiolib-org.github.io/status_decoder/decode.html).
3. Make sure you're using the latest release of the library! Releases can be found [here](https://github.com/jgromes/RadioLib/releases).
4. Use [Arduino forums](https://forum.arduino.cc/) to ask generic questions about wireless modules, wiring, usage, etc. Only create issues for problems specific to RadioLib!
5. Error codes, their meaning and how to fix them can be found on [this page](https://jgromes.github.io/RadioLib/group__status__codes.html).
**Sketch that is causing the module fail**
<details><summary>Sketch that is causing the module fail</summary>
<p>
```c++
paste the sketch here, even if it is an unmodified example code
```
</p>
</details>
**Hardware setup**
Wiring diagram, schematic, pictures etc.
**Debug mode output**
Enable all [debug levels](https://github.com/jgromes/RadioLib/wiki/Debug-mode) and paste the Serial monitor output here.
Enable the appropriate [debug levels](https://github.com/jgromes/RadioLib/wiki/Debug-mode) and paste the Serial monitor output here. For debugging protocols, enable `RADIOLIB_DEBUG_PROTOCOL`. For debugging issues with the radio module itself, enable `RADIOLIB_DEBUG_SPI`.
<details><summary>Debug mode output</summary>
<p>
```
paste the debug output here
```
</p>
</details>
**Additional info (please complete):**
- MCU: [e.g. Arduino Uno, ESP8266 etc.]
- Link to Arduino core: [e.g. https://github.com/stm32duino/Arduino_Core_STM32 when using official STM32 core. See readme for links to all supported cores]
- Wireless module type [e.g. CC1101, SX1268, etc.]
- Arduino IDE version [e.g. 1.8.5]
- Library version [e.g. 3.0.0]
- Library version [e.g. 3.0.0 or git hash]

View file

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

14
.github/pull_request_template.md vendored Normal file
View file

@ -0,0 +1,14 @@
## Pull request template
Thank you for taking the time to contribute to RadioLib development!
To keep this library organized, please follow these rules.
1. Make sure the the code in your PR is tested and that you understand all its impacts.
2. Ensure that all CI actions pass - PRs with failed CI will not be merged. CI actions run automatically for every commit pushed to the PR and test the following:
a. Compilation for Arduino, ESP-IDF and on Raspberry Pi
b. Runtime test on Raspberry Pi
c. GitHub CodeQL check
d. Cppcheck static code scan
3. Follow code style guidelines in [CONTRIBUTING.md](https://github.com/jgromes/RadioLib/blob/master/CONTRIBUTING.md)
4. Heads up - all PRs undergo review, during which you may be asked to correct or change some things. The purpose of this review is to keep regressions and bugs at the minimum, and to keep consistent coding style. Please take them as constructive criticism from people who may have a different point-of-view than you do.
After addressing/accepting the points above, delete the contents of this template and replace it with text explaining what is the goal of your PR, why you want to add it to the upstream and what are the foreseen impacts. Once again, thank you for taking the time to contribute!

View file

@ -5,11 +5,14 @@ on:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
security-events: write
strategy:
fail-fast: false
@ -18,20 +21,11 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
@ -60,7 +54,7 @@ jobs:
- name: Build example
run:
arduino-cli compile --libraries /home/runner/work/RadioLib --fqbn arduino:avr:uno $PWD/examples/SX126x/SX126x_Transmit/SX126x_Transmit.ino --warnings=all
arduino-cli compile --libraries /home/runner/work/RadioLib --fqbn arduino:avr:uno $PWD/examples/SX123x/SX123x_Transmit_Blocking/SX123x_Transmit_Blocking.ino --warnings=all
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v3

25
.github/workflows/cppcheck.yml vendored Normal file
View file

@ -0,0 +1,25 @@
name: "Cppcheck"
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
jobs:
check:
name: Perform static code check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install cppcheck
run: |
sudo apt-get update
sudo apt-get install -y cppcheck
- name: Run cppcheck
run: ./extras/cppcheck/cppcheck.sh

View file

@ -13,7 +13,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y doxygen
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Generate docs
run: doxygen Doxyfile

View file

@ -6,16 +6,16 @@ on:
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
strategy:
matrix:
board:
- arduino:avr:uno
inputs:
id:
description: The ID of the platform on which the build is run
required: true
default: arduino:avr:mega
type: choice
options:
- all
- none
- arduino:avr:mega
- arduino:avr:leonardo
- arduino:mbed:nano33ble
- arduino:mbed:envie_m4
- arduino:megaavr:uno2018
@ -26,21 +26,114 @@ jobs:
- esp32:esp32:esp32
- esp8266:esp8266:generic
- Intel:arc32:arduino_101
- SparkFun:apollo3:sfe_artemis
- STM32:stm32:GenF3
- STMicroelectronics:stm32:GenF3:pnum=BLACKPILL_F303CC
- STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_WL55JC1
- stm32duino:STM32F1:mapleMini
- MegaCoreX:megaavr:4809
- arduino:mbed_rp2040:pico
- rp2040:rp2040:rpipico
- CubeCell:CubeCell:CubeCell-Board
- MegaCore:avr:1281
- teensy:avr:teensy41
- arduino:renesas_uno:minima
- SiliconLabs:silabs:xg24explorerkit
jobs:
build:
strategy:
matrix:
# platform-dependent settings - extra board options, board index URLs, skip patterns etc.
include:
- id: arduino:avr:mega
run: |
echo "options=':cpu=atmega2560'" >> $GITHUB_OUTPUT
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
- id: arduino:mbed:nano33ble
- id: arduino:mbed:envie_m4
- id: arduino:megaavr:uno2018
run: |
echo "options=':mode=on'" >> $GITHUB_OUTPUT
echo "skip-pattern=(STM32WL|LoRaWAN|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
- id: arduino:sam:arduino_due_x
- id: arduino:samd:arduino_zero_native
run: |
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
- id: adafruit:samd:adafruit_feather_m0
run: |
echo "options=':usbstack=arduino,debug=off'" >> $GITHUB_OUTPUT
echo "index-url=--additional-urls https://adafruit.github.io/arduino-board-index/package_adafruit_index.json" >> $GITHUB_OUTPUT
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
- id: adafruit:nrf52:feather52832
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-pip python3-setuptools
pip3 install wheel
pip3 install --user adafruit-nrfutil
echo "/home/runner/.local/bin" >> $GITHUB_PATH
echo "options=':softdevice=s132v6,debug=l0'" >> $GITHUB_OUTPUT
echo "index-url=--additional-urls https://adafruit.github.io/arduino-board-index/package_adafruit_index.json" >> $GITHUB_OUTPUT
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
- id: esp32:esp32:esp32
run: |
python -m pip install pyserial
echo "version=2.0.17" >> $GITHUB_OUTPUT
echo "index-url=--additional-urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" >> $GITHUB_OUTPUT
- id: esp8266:esp8266:generic
run: |
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
echo "options=':xtal=80,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=qio,eesz=512K'" >> $GITHUB_OUTPUT
echo "index-url=--additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json" >> $GITHUB_OUTPUT
- id: STMicroelectronics:stm32:GenF3
run: |
echo "options=':pnum=BLACKPILL_F303CC'" >> $GITHUB_OUTPUT
echo "index-url=--additional-urls https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json" >> $GITHUB_OUTPUT
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
- id: STMicroelectronics:stm32:Nucleo_64
run: |
echo "options=':pnum=NUCLEO_WL55JC1'" >> $GITHUB_OUTPUT
# Do *not* skip STM32WL examples
echo "skip-pattern=(LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
echo "index-url=--additional-urls https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json" >> $GITHUB_OUTPUT
- id: stm32duino:STM32F1:mapleMini
run: |
echo "options=':bootloader_version=original,cpu_speed=speed_72mhz'" >> $GITHUB_OUTPUT
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
echo "index-url=--additional-urls http://dan.drown.org/stm32duino/package_STM32duino_index.json" >> $GITHUB_OUTPUT
- id: MegaCoreX:megaavr:4809
run: |
echo "index-url=--additional-urls https://mcudude.github.io/MegaCoreX/package_MCUdude_MegaCoreX_index.json" >> $GITHUB_OUTPUT
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update|LoRaWAN)" >> $GITHUB_OUTPUT
- id: arduino:mbed_rp2040:pico
- id: rp2040:rp2040:rpipico
run: echo "index-url=--additional-urls https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json" >> $GITHUB_OUTPUT
- id: CubeCell:CubeCell:CubeCell-Board
run: |
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
echo "index-url=--additional-urls https://resource.heltec.cn/download/package_CubeCell_index.json" >> $GITHUB_OUTPUT
- id: MegaCore:avr:1281
run: |
echo "index-url=--additional-urls https://mcudude.github.io/MegaCore/package_MCUdude_MegaCore_index.json" >> $GITHUB_OUTPUT
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
- id: teensy:avr:teensy41
run: |
echo "skip-pattern=(STM32WL|LoRaWAN)" >> $GITHUB_OUTPUT
echo "index-url=--additional-urls https://www.pjrc.com/teensy/package_teensy_index.json" >> $GITHUB_OUTPUT
- id: arduino:renesas_uno:minima
run: |
echo "skip-pattern=(STM32WL|LoRaWAN|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
- id: SiliconLabs:silabs:xg24explorerkit
run: |
echo "index-url=--additional-urls https://siliconlabs.github.io/arduino/package_arduinosilabs_index.json" >> $GITHUB_OUTPUT
runs-on: ubuntu-latest
name: ${{ matrix.board }}
name: ${{ matrix.id }}
env:
run-build: ${{ (matrix.board == '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.board)) }}
run-build: ${{ (inputs.id != 'none' && matrix.id == 'arduino:avr:mega') || contains(github.event.head_commit.message, 'CI_BUILD_ALL') || contains(github.event.head_commit.message, 'Bump version to') || contains(github.event.head_commit.message, format('{0}', matrix.id)) || inputs.id == 'all' || inputs.id == matrix.id }}
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
- name: Install arduino-cli
if: ${{ env.run-build == 'true' }}
run:
@ -54,7 +147,7 @@ jobs:
uses: jungwinter/split@v1
id: split
with:
msg: ${{ matrix.board }}
msg: ${{ matrix.id }}
seperator: ':'
- name: Prepare platform-specific settings
@ -62,117 +155,207 @@ jobs:
id: prep
run:
|
# common settings - no extra options, skip nothing, all warnings
echo "::set-output name=options::"
echo "::set-output name=skip-pattern::''"
echo "::set-output name=warnings::'all'"
# common settings - no extra options, skip STM32WL examples, all warnings
echo "options=''" >> $GITHUB_OUTPUT
echo "skip-pattern=STM32WL" >> $GITHUB_OUTPUT
echo "warnings=all" >> $GITHUB_OUTPUT
# platform-dependent settings - extra board options, board index URLs, skip patterns etc.
if [[ "${{ contains(matrix.board, 'arduino:avr:mega') }}" == "true" ]]; then
# Arduino Mega
echo "::set-output name=options:::cpu=atmega2560"
elif [[ "${{ contains(matrix.board, 'arduino:mbed') }}" == "true" ]]; then
# Arduino Nano 33 BLE
echo "::set-output name=skip-pattern::(HTTP|MQTT).*ino"
elif [[ "${{ contains(matrix.board, 'arduino-beta:mbed') }}" == "true" ]]; then
# Arduino Portenta H7
echo "::set-output name=skip-pattern::(HTTP|MQTT).*ino"
elif [[ "${{ contains(matrix.board, 'arduino:megaavr:uno2018') }}" == "true" ]]; then
# Arduino Uno WiFi
echo "::set-output name=options:::mode=on"
elif [[ "${{ contains(matrix.board, 'adafruit:samd') }}" == "true" ]]; then
# Adafruit SAMD
echo "::set-output name=options:::usbstack=arduino,debug=off"
echo "::set-output name=index-url::--additional-urls https://adafruit.github.io/arduino-board-index/package_adafruit_index.json"
elif [[ "${{ contains(matrix.board, 'adafruit:nrf52') }}" == "true" ]]; then
# Adafruit Feather nRF52
sudo apt-get update
sudo apt-get install -y python3 python3-pip python3-setuptools
pip3 install wheel
pip3 install --user adafruit-nrfutil
echo "/home/runner/.local/bin" >> $GITHUB_PATH
echo "::set-output name=options:::softdevice=s132v6,debug=l0"
echo "::set-output name=index-url::--additional-urls https://adafruit.github.io/arduino-board-index/package_adafruit_index.json"
elif [[ "${{ contains(matrix.board, 'esp32:esp32') }}" == "true" ]]; then
# ESP32
python -m pip install pyserial
echo "::set-output name=index-url::--additional-urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json"
elif [[ "${{ contains(matrix.board, 'esp8266:esp8266') }}" == "true" ]]; then
# ESP8266
echo "::set-output name=options:::xtal=80,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=qio,eesz=512K"
echo "::set-output name=index-url::--additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json"
echo "::set-output name=skip-pattern::(HTTP|MQTT).*ino"
elif [[ "${{ contains(matrix.board, 'SparkFun:apollo3') }}" == "true" ]]; then
# SparkFun Apollo
echo "::set-output name=index-url::--additional-urls https://raw.githubusercontent.com/sparkfun/Arduino_Apollo3/master/package_sparkfun_apollo3_index.json"
echo "::set-output name=warnings::'none'"
echo "::set-output name=skip-pattern::(HTTP|MQTT).*ino"
elif [[ "${{ contains(matrix.board, 'STM32:stm32') }}" == "true" ]]; then
# STM32 (official core)
echo "::set-output name=options:::pnum=BLACKPILL_F303CC"
echo "::set-output name=index-url::--additional-urls https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json"
elif [[ "${{ contains(matrix.board, 'stm32duino:STM32F1') }}" == "true" ]]; then
# STM32 (unofficial core)
echo "::set-output name=options:::bootloader_version=original,cpu_speed=speed_72mhz"
echo "::set-output name=index-url::--additional-urls http://dan.drown.org/stm32duino/package_STM32duino_index.json"
elif [[ "${{ contains(matrix.board, 'MegaCoreX:megaavr') }}" == "true" ]]; then
# MegaCoreX
echo "::set-output name=index-url::--additional-urls https://mcudude.github.io/MegaCoreX/package_MCUdude_MegaCoreX_index.json"
elif [[ "${{ contains(matrix.board, 'CubeCell:CubeCell') }}" == "true" ]]; then
# CubeCell
echo "::set-output name=index-url::--additional-urls https://resource.heltec.cn/download/package_CubeCell_index.json"
elif [[ "${{ contains(matrix.board, 'MegaCore:avr') }}" == "true" ]]; then
# MegaCore
echo "::set-output name=index-url::--additional-urls https://mcudude.github.io/MegaCore/package_MCUdude_MegaCore_index.json"
elif [[ "${{ contains(matrix.board, 'teensy:avr') }}" == "true" ]]; then
# Teensy
echo "::set-output name=index-url::--additional-urls https://www.pjrc.com/teensy/td_156/package_teensy_index.json"
fi
# run platform-dependent scripts defined in matrix
${{ matrix.run }}
- name: Install platform
if: ${{ env.run-build == 'true' }}
run:
|
arduino-cli core update-index ${{ format('{0}', steps.prep.outputs.index-url) }}
arduino-cli core install ${{ format('{0}:{1} {2}', steps.split.outputs._0, steps.split.outputs._1, steps.prep.outputs.index-url) }}
if [ -z '${{ steps.prep.outputs.version }}' ]; then
arduino-cli core install ${{ format('{0}:{1} {2}', steps.split.outputs._0, steps.split.outputs._1, steps.prep.outputs.index-url) }}
else
arduino-cli core install ${{ format('{0}:{1}@{3} {2}', steps.split.outputs._0, steps.split.outputs._1, steps.prep.outputs.index-url, steps.prep.outputs.version) }}
fi
- name: Checkout repository
if: ${{ env.run-build == 'true' }}
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Build examples
if: ${{ env.run-build == 'true' }}
run:
|
for example in $(find $PWD/examples -name '*.ino' | sort); do
# check whether to skip this sketch
if [ ! -z '${{ steps.prep.outputs.skip-pattern }}' ] && [[ ${example} =~ ${{ steps.prep.outputs.skip-pattern }} ]]; then
# skip sketch
echo -e "\n\033[1;33mSkipped ${example##*/} (matched with ${{ steps.prep.outputs.skip-pattern }})\033[0m";
else
# build sketch
echo -e "\n\033[1;33mBuilding ${example##*/} ... \033[0m";
arduino-cli compile --libraries /home/runner/work/RadioLib --fqbn ${{ matrix.board }}${{ steps.prep.outputs.options }} $example --warnings=${{ steps.prep.outputs.warnings }}
if [ $? -ne 0 ]; then
echo -e "\033[1;31m${example##*/} build FAILED\033[0m\n";
exit 1;
else
echo -e "\033[1;32m${example##*/} build PASSED\033[0m\n";
fi
fi
done
cd $PWD/extras/test/ci
./build_examples.sh ${{ matrix.id }} "${{ steps.prep.outputs.skip-pattern }}" ${{ steps.prep.outputs.options }}
- name: Extract short commit hash
id: short-hash
run: echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
- name: Parse sizes
if: ${{ env.run-build == 'true' }}
run:
|
cd $PWD/extras/test/ci
./parse_size.sh ${{ matrix.id }}
cat size_${{ steps.short-hash.outputs.short_sha }}_${{ steps.split.outputs._0 }}-${{ steps.split.outputs._1 }}-${{ steps.split.outputs._2 }}.csv
- name: Upload size report as artifact
uses: actions/upload-artifact@v4
with:
name: size-file-${{ steps.split.outputs._0 }}-${{ steps.split.outputs._1 }}-${{ steps.split.outputs._2 }}
path: extras/test/ci/size_${{ steps.short-hash.outputs.short_sha }}_${{ steps.split.outputs._0 }}-${{ steps.split.outputs._1 }}-${{ steps.split.outputs._2 }}.csv
metrics:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master'
steps:
- name: Set up SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.ACTIONS_METRICS_DEPLOY_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Clone artifact repo
run:
|
cd $PWD/..
git clone git@github.com:radiolib-org/artifacts.git
cd artifacts
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Download size artifacts
uses: actions/download-artifact@v4
with:
path: aggregated-sizes
- name: Push size files
run:
|
ls -R aggregated-sizes
mkdir -p $PWD/../artifacts/radiolib-ci/l0
cp aggregated-sizes/*/size_*.csv $PWD/../artifacts/radiolib-ci/l0/.
cd $PWD/../artifacts/radiolib-ci
git add .
COMMIT_URL="https://github.com/jgromes/RadioLib/commit/$GITHUB_SHA"
git commit -m "Push artifacts from $COMMIT_URL"
git push origin main
esp-build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
- name: Clone ESP-IDF
run: |
mkdir -p ~/esp
cd ~/esp
git clone --recursive https://github.com/espressif/esp-idf.git
- name: Install ESP-IDF
run: |
cd ~/esp/esp-idf
./install.sh esp32
- name: Build the example
run: |
cd $PWD/examples/NonArduino/ESP-IDF
. ~/esp/esp-idf/export.sh
idf.py build
tock-build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: |
sudo apt-get install -y gcc-arm-none-eabi gcc-riscv64-unknown-elf
cargo install elf2tab
- name: Build the example
run: |
cd $PWD/examples/NonArduino/Tock
git clone https://github.com/tock/libtock-c.git
cd libtock-c; git checkout c0202f9ab78da4a6e95f136cf5250701e3778f63; cd ../
LIBTOCK_C_DIRECTORY="$(pwd)/libtock-c" ./build.sh
rpi-build:
if: false # self-hosted runner temporarily disabled
runs-on: [self-hosted, ARM64]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake wget swig python-dev python3-dev python-setuptools python3-setuptools
wget http://abyz.me.uk/lg/lg.zip
unzip lg.zip
cd lg
make
sudo make install
cd ..
sudo rm -rf lg
- name: Install the library
run: |
cd $PWD
mkdir build
cd build
cmake ..
sudo make install
- name: Build the example
run: |
cd $PWD/examples/NonArduino/Raspberry
./build.sh
rpi-test:
if: false # self-hosted runner temporarily disabled
needs: rpi-build
runs-on: [self-hosted, ARM64]
steps:
- name: SX126x test
run: |
cd $PWD/extras/test/SX126x
./clean.sh
./build.sh
sudo ./build/rpi-sx1261
rpi-pico-build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt update
sudo apt install git cmake gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib
- name: Clone the SDK
run: |
mkdir -p ~/rpi-pico
cd ~/rpi-pico
git clone https://github.com/raspberrypi/pico-sdk.git
cd pico-sdk && git checkout 1.5.1
- name: Build the example
run: |
export PICO_SDK_PATH=~/rpi-pico/pico-sdk
cd $PWD/examples/NonArduino/Pico
./build.sh

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

13
.gitignore vendored
View file

@ -5,12 +5,17 @@
*.tags
*.tags1
# VS Code
.vscode
# Jetbrain IDEs
.idea
# Debug decoder
extras/decoder/log.txt
extras/decoder/out.txt
# PlatformIO
.pio*
# cmake
build/
# Compote build output
dist

51
CMakeLists.txt Normal file
View file

@ -0,0 +1,51 @@
cmake_minimum_required(VERSION 3.13)
if(ESP_PLATFORM)
# Build RadioLib as an ESP-IDF component
# required because ESP-IDF runs cmake in script mode
# and needs idf_component_register()
file(GLOB_RECURSE RADIOLIB_ESP_SOURCES
"src/*.*"
)
idf_component_register(
SRCS ${RADIOLIB_ESP_SOURCES}
INCLUDE_DIRS . src
)
return()
endif()
if(CMAKE_SCRIPT_MODE_FILE)
message(FATAL_ERROR "Attempted to build RadioLib in script mode")
endif()
project(radiolib)
file(GLOB_RECURSE RADIOLIB_SOURCES
"src/*.cpp"
)
add_library(RadioLib ${RADIOLIB_SOURCES})
target_include_directories(RadioLib
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
# use c++20 standard
set_property(TARGET RadioLib PROPERTY CXX_STANDARD 20)
# enable most warnings
target_compile_options(RadioLib PRIVATE -Wall -Wextra -Wpedantic -Wdouble-promotion)
include(GNUInstallDirs)
install(TARGETS RadioLib
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/RadioLib
FILES_MATCHING PATTERN "*.h"
)

View file

@ -2172,7 +2172,8 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED = protected=private
PREDEFINED = protected=private \
DOXYGEN
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The

View file

@ -1,50 +1,65 @@
# RadioLib ![Build Status](https://github.com/jgromes/RadioLib/workflows/CI/badge.svg)
# RadioLib ![Build Status](https://github.com/jgromes/RadioLib/workflows/CI/badge.svg) [![PlatformIO Registry](https://badges.registry.platformio.org/packages/jgromes/library/RadioLib.svg)](https://registry.platformio.org/libraries/jgromes/RadioLib) [![Component Registry](https://components.espressif.com/components/jgromes/radiolib/badge.svg)](https://components.espressif.com/components/jgromes/radiolib)
### _One radio library to rule them all!_
## Universal wireless communication library for embedded devices
## See the [Wiki](https://github.com/jgromes/RadioLib/wiki) for further information. See the [GitHub Pages](https://jgromes.github.io/RadioLib) for detailed and up-to-date API reference.
RadioLib allows its users to integrate all sorts of different wireless communication modules, protocols and even digital modes into a single consistent system.
Want to add a Bluetooth interface to your LoRa network? Sure thing! Do you just want to go really old-school and play around with radio teletype, slow-scan TV, or even Hellschreiber using nothing but a cheap radio module? Why not!
RadioLib natively supports Arduino, but can run in non-Arduino environments as well! See [this Wiki page](https://github.com/jgromes/RadioLib/wiki/Porting-to-non-Arduino-Platforms) and [examples/NonArduino](https://github.com/jgromes/RadioLib/tree/master/examples/NonArduino).
RadioLib was originally created as a driver for [__RadioShield__](https://github.com/jgromes/RadioShield), but it can be used to control as many different wireless modules as you like - or at least as many as your microcontroller can handle!
### Quick links:
* [__Wiki__](https://github.com/jgromes/RadioLib/wiki) - contains useful general information on using this library
* [__FAQ__](https://github.com/jgromes/RadioLib/wiki/Frequently-Asked-Questions) - frequently asked questions, and answers
* [__API Reference__](https://jgromes.github.io/RadioLib) - full API reference, automatically generated from the source code
* [__Status Code Decoder__](https://radiolib-org.github.io/status_decoder/decode.html) - decoder for status codes returned by RadioLib methods
* [__Debug Log Decoder__](https://radiolib-org.github.io/debug_decoder/decode.html) - decoder for RadioLib SPI debug logs
### Supported modules:
* __CC1101__ FSK radio module
* __LLCC68__ LoRa module
* __LR11x0__ series LoRa/GFSK modules (LR1110, LR1120, LR1121)
* __nRF24L01__ 2.4 GHz module
* __RF69__ FSK/OOK radio module
* __RFM2x__ series FSK modules (RFM22, RM23)
* __RFM9x__ series LoRa modules (RFM95, RM96, RFM97, RFM98)
* __Si443x__ series FSK modules (Si4430, Si4431, Si4432)
* __STM32WL__ integrated microcontroller/LoRa module
* __SX126x__ series LoRa modules (SX1261, SX1262, SX1268)
* __SX127x__ series LoRa modules (SX1272, SX1273, SX1276, SX1277, SX1278, SX1279)
* __SX128x__ series LoRa/GFSK/BLE/FLRC modules (SX1280, SX1281, SX1282)
* __SX1231__ FSK/OOK radio module
* __SX123x__ FSK/OOK radio modules (SX1231, SX1233)
### Supported protocols and digital modes:
* __AX.25__ using 2-FSK or AFSK for modules:
SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, RFM2x and Si443x
* [__AX.25__](https://www.sigidwiki.com/wiki/PACKET) using 2-FSK or AFSK for modules:
SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, RFM2x, Si443x, LR11x0 and SX128x
* [__RTTY__](https://www.sigidwiki.com/wiki/RTTY) using 2-FSK or AFSK for modules:
SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x and SX128x
SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x, LR11x0 and SX128x
* [__Morse Code__](https://www.sigidwiki.com/wiki/Morse_Code_(CW)) using 2-FSK or AFSK for modules:
SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x and SX128x
SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x, LR11x0 and SX128x
* [__SSTV__](https://www.sigidwiki.com/wiki/SSTV) using 2-FSK or AFSK for modules:
SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, RFM2x and Si443x
* [__Hellschreiber__](https://www.sigidwiki.com/wiki/Hellschreiber) using 2-FSK or AFSK for modules:
SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x and SX128x
SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x, LR11x0 and SX128x
* [__APRS__](https://www.sigidwiki.com/wiki/APRS) using AFSK for modules:
SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x and SX128x
* [__POCSAG__](https://www.sigidwiki.com/wiki/POCSAG) using 2-FSK for modules:
SX127x, RFM9x, RF69, SX1231, CC1101, nRF24L01, RFM2x and Si443x
* [__LoRaWAN__](https://lora-alliance.org/) using LoRa and FSK for modules:
SX127x, RFM9x, SX126x, LR11x0 and SX128x
### Supported Arduino platforms:
* __Arduino__
* [__AVR__](https://github.com/arduino/ArduinoCore-avr) - Arduino Uno, Mega, Leonardo, Pro Mini, Nano etc.
* NOTE: Arduino boards based on ATmega328 (Uno, Pro Mini, Nano etc.) and smaller are NOT recommended. This is because the ATmega328 MCU is very constrained in terms of program and memory size, so the library will end up taking most of the space available.
* [__mbed__](https://github.com/arduino/ArduinoCore-mbed) - Arduino Nano 33 BLE and Arduino Portenta H7
* [__megaAVR__](https://github.com/arduino/ArduinoCore-megaavr) - Arduino Uno WiFi Rev.2 and Nano Every
* [__SAM__](https://github.com/arduino/ArduinoCore-sam) - Arduino Due
* [__SAMD__](https://github.com/arduino/ArduinoCore-samd) - Arduino Zero, MKR boards, M0 Pro etc.
* [__Renesas__](https://github.com/arduino/ArduinoCore-renesas) - Arduino Uno R4
* __Adafruit__
* [__SAMD__](https://github.com/adafruit/ArduinoCore-samd) - Adafruit Feather M0 and M4 boards (Feather, Metro, Gemma, Trinket etc.)
@ -69,7 +84,8 @@ SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x and SX128x
* [__MegaCore__](https://github.com/MCUdude/MegaCore) - AVR (ATmega1281, ATmega640 etc.)
* __Raspberry Pi__
* [__RP2040__](https://github.com/arduino/ArduinoCore-mbed) - Raspberry Pi Pico and Arduino Nano RP2040 Connect
* [__RP2040__ (official core)](https://github.com/arduino/ArduinoCore-mbed) - Raspberry Pi Pico and Arduino Nano RP2040 Connect
* [__RP2040__ (unofficial core)](https://github.com/earlephilhower/arduino-pico) - Raspberry Pi Pico/RP2040-based boards
* [__Raspberry Pi__](https://github.com/me-no-dev/RasPiArduino) - Arduino framework for RaspberryPI
* __Heltec__
@ -78,20 +94,7 @@ SX127x, RFM9x, SX126x, RF69, SX1231, CC1101, nRF24L01, RFM2x, Si443x and SX128x
* __PJRC__
* [__Teensy__](https://github.com/PaulStoffregen/cores) - Teensy 2.x, 3.x and 4.x 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.
* __Silicon Labs__
* [__EFR32__](https://github.com/SiliconLabs/arduino) - Silicon Labs xG24, xG27 and other boards
### In development:
* __AX5243__ FSK module
* __LoRaWAN__ protocol for SX127x, RFM9x and SX126x modules
* ___and more!___
## Frequently Asked Questions
### Where should I start?
First of all, take a look at the [examples](https://github.com/jgromes/RadioLib/tree/master/examples) and the [Wiki](https://github.com/jgromes/RadioLib/wiki) - especially the [Basics](https://github.com/jgromes/RadioLib/wiki/Basics) page. There's a lot of useful information over there. If something isn't working as expected, try searching the [issues](https://github.com/jgromes/RadioLib/issues/).
### Help, my module isn't working!
The fastest way to get help is by creating an [issue](https://github.com/jgromes/RadioLib/issues/new/choose) using the appropriate template. It is also highly recommended to try running the examples first - their functionality is tested from time to time and they should work. Finally, RadioLib is still under development, which means that sometimes, backwards-incompatible changes might be introduced. Though these are kept at minimum, sometimes it is unavoidable. You can check the [release changelog](https://github.com/jgromes/RadioLib/releases) to find out if there's been such a major change recently.
### RadioLib doesn't support my module! What should I do?
Start by creating new issue (if it doesn't exist yet). If you have some experience with microcontrollers and C/C++ in general, you can try to add the support yourself! Use the template files in `/extras/` folder to get started. This is by far the fastest way to implement new modules into RadioLib, since I can't be working on everything all the time. If you don't trust your programming skills enough to have a go at it yourself, don't worry. I will try to implement all requested modules, but it will take me a while.
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

@ -0,0 +1,94 @@
/*
RadioLib AFSK External Radio example
This example shows how to use your Arduino
as modulator for an external analogue FM radio.
The example sends APRS position reports with
audio modulated as AFSK at 1200 baud using
Bell 202 tones. However, any other AFSK
protocol (RTTY, SSTV, etc.) may be used as well.
DO NOT transmit in APRS bands unless
you have a ham radio license!
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// create a dummy radio module
ExternalRadio radio;
// create AFSK client instance using the external radio
// pin 5 is connected to the radio sound input
AFSKClient audio(&radio, 5);
// create AX.25 client instance using the AFSK instance
AX25Client ax25(&audio);
// create APRS client instance using the AX.25 client
APRSClient aprs(&ax25);
void setup() {
Serial.begin(9600);
// initialize AX.25 client
Serial.print(F("[AX.25] Initializing ... "));
// source station callsign: "N7LEM"
// source station SSID: 0
// preamble length: 8 bytes
int16_t state = ax25.begin("N7LEM");
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// initialize APRS client
Serial.print(F("[APRS] Initializing ... "));
// symbol: '>' (car)
state = aprs.begin('>');
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
}
void loop() {
Serial.print(F("[APRS] Sending position ... "));
// send a location without message or timestamp
char destination[] = "N0CALL";
char latitude[] = "4911.67N";
char longitude[] = "01635.96E";
int state = aprs.sendPosition(destination, 0, latitude, longitude);
delay(500);
// send a location with message and without timestamp
char message[] = "I'm here!";
state |= aprs.sendPosition(destination, 0, latitude, longitude, message);
delay(500);
// send a location with message and timestamp
char timestamp[] = "093045z";
state |= aprs.sendPosition(destination, 0, latitude, longitude, message, timestamp);
delay(500);
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
}
// wait one minute before transmitting again
delay(60000);
}

View file

@ -1,20 +1,21 @@
/*
RadioLib AFSK Imperial March Example
RadioLib AFSK Imperial March Example
This example shows how to EXECUTE ORDER 66
This example shows how to EXECUTE ORDER 66
Other modules that can be used for AFSK:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
Other modules that can be used for AFSK:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
- SX126x/LLCC68
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -38,6 +39,7 @@ SX1278 radio = new Module(10, 2, 9, 3);
// SX1231: DIO2
// CC1101: GDO2
// Si443x/RFM2x: GPIO
// SX126x/LLCC68: DIO2
AFSKClient audio(&radio, 5);
void setup() {
@ -56,7 +58,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize AFSK client
@ -67,7 +69,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}

View file

@ -1,7 +1,7 @@
/*
Note definitions, melody and melody-related functions
adapted from https://github.com/robsoncouto/arduino-songs
by Robson Couto, 2019
Note definitions, melody and melody-related functions
adapted from https://github.com/robsoncouto/arduino-songs
by Robson Couto, 2019
*/
#define NOTE_B0 31
@ -95,16 +95,16 @@
#define NOTE_DS8 4978
#define REST 0
// notes of the moledy followed by the duration.
// notes of the melody followed by the duration.
// a 4 means a quarter note, 8 an eighteenth , 16 sixteenth, so on
// !!negative numbers are used to represent dotted notes,
// so -4 means a dotted quarter note, that is, a quarter plus an eighteenth!!
int melody[] = {
// Darth Vader theme (Imperial March) - Star wars
// Darth Vader theme (Imperial March) - Star wars
// Score available at https://musescore.com/user/202909/scores/1141521
// The tenor saxophone part was used
NOTE_A4,-4, NOTE_A4,-4, NOTE_A4,16, NOTE_A4,16, NOTE_A4,16, NOTE_A4,16, NOTE_F4,8, REST,8,
NOTE_A4,-4, NOTE_A4,-4, NOTE_A4,16, NOTE_A4,16, NOTE_A4,16, NOTE_A4,16, NOTE_F4,8, REST,8,
NOTE_A4,4, NOTE_A4,4, NOTE_A4,4, NOTE_F4,-8, NOTE_C5,16,
@ -112,17 +112,17 @@ int melody[] = {
NOTE_A4,4, NOTE_F4,-8, NOTE_C5,16, NOTE_A4,2,//4
NOTE_E5,4, NOTE_E5,4, NOTE_E5,4, NOTE_F5,-8, NOTE_C5,16,
NOTE_A4,4, NOTE_F4,-8, NOTE_C5,16, NOTE_A4,2,
NOTE_A5,4, NOTE_A4,-8, NOTE_A4,16, NOTE_A5,4, NOTE_GS5,-8, NOTE_G5,16, //7
NOTE_A5,4, NOTE_A4,-8, NOTE_A4,16, NOTE_A5,4, NOTE_GS5,-8, NOTE_G5,16, //7
NOTE_DS5,16, NOTE_D5,16, NOTE_DS5,8, REST,8, NOTE_A4,8, NOTE_DS5,4, NOTE_D5,-8, NOTE_CS5,16,
NOTE_C5,16, NOTE_B4,16, NOTE_C5,16, REST,8, NOTE_F4,8, NOTE_GS4,4, NOTE_F4,-8, NOTE_A4,-16,//9
NOTE_C5,4, NOTE_A4,-8, NOTE_C5,16, NOTE_E5,2,
NOTE_A5,4, NOTE_A4,-8, NOTE_A4,16, NOTE_A5,4, NOTE_GS5,-8, NOTE_G5,16, //7
NOTE_A5,4, NOTE_A4,-8, NOTE_A4,16, NOTE_A5,4, NOTE_GS5,-8, NOTE_G5,16, //7
NOTE_DS5,16, NOTE_D5,16, NOTE_DS5,8, REST,8, NOTE_A4,8, NOTE_DS5,4, NOTE_D5,-8, NOTE_CS5,16,
NOTE_C5,16, NOTE_B4,16, NOTE_C5,16, REST,8, NOTE_F4,8, NOTE_GS4,4, NOTE_F4,-8, NOTE_A4,-16,//9
NOTE_A4,4, NOTE_F4,-8, NOTE_C5,16, NOTE_A4,2,
};

View file

@ -1,21 +1,22 @@
/*
RadioLib AFSK Example
RadioLib AFSK Example
This example shows hot to send audio FSK tones
using SX1278's FSK modem.
This example shows hot to send audio FSK tones
using SX1278's FSK modem.
Other modules that can be used for AFSK:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
Other modules that can be used for AFSK:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
- SX126x/LLCC68
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -36,6 +37,7 @@ SX1278 radio = new Module(10, 2, 9, 3);
// SX1231: DIO2
// CC1101: GDO2
// Si443x/RFM2x: GPIO
// SX126x/LLCC68: DIO2
AFSKClient audio(&radio, 5);
void setup() {
@ -54,7 +56,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize AFSK client
@ -65,7 +67,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}

View file

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

View file

@ -0,0 +1,123 @@
/*
RadioLib APRS Mic-E Example
This example sends APRS position reports
encoded in the Mic-E format using SX1278's
FSK modem. The data is modulated as AFSK
at 1200 baud using Bell 202 tones.
DO NOT transmit in APRS bands unless
you have a ham radio license!
Other modules that can be used for APRS:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- nRF24
- Si443x/RFM2x
- SX126x/LLCC68
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// SX1278 has the following connections:
// NSS pin: 10
// DIO0 pin: 2
// RESET pin: 9
// DIO1 pin: 3
SX1278 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();
*/
// create AFSK client instance using the FSK module
// this requires connection to the module direct
// input pin, here connected to Arduino pin 5
// SX127x/RFM9x: DIO2
// RF69: DIO2
// SX1231: DIO2
// CC1101: GDO2
// Si443x/RFM2x: GPIO
// SX126x/LLCC68: DIO2
AFSKClient audio(&radio, 5);
// create AX.25 client instance using the AFSK instance
AX25Client ax25(&audio);
// create APRS client instance using the AX.25 client
APRSClient aprs(&ax25);
void setup() {
Serial.begin(9600);
// initialize SX1278
// NOTE: moved to ISM band on purpose
// DO NOT transmit in APRS bands without ham radio license!
Serial.print(F("[SX1278] Initializing ... "));
int state = radio.beginFSK();
// when using one of the non-LoRa modules for AX.25
// (RF69, CC1101, Si4432 etc.), use the basic begin() method
// int state = radio.begin();
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// initialize AX.25 client
Serial.print(F("[AX.25] Initializing ... "));
// source station callsign: "N7LEM"
// source station SSID: 0
// preamble length: 8 bytes
state = ax25.begin("N7LEM");
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// initialize APRS client
Serial.print(F("[APRS] Initializing ... "));
// symbol: '>' (car)
state = aprs.begin('>');
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
}
void loop() {
Serial.print(F("[APRS] Sending Mic-E position ... "));
int state = aprs.sendMicE(49.1945, 16.6000, 120, 10, RADIOLIB_APRS_MIC_E_TYPE_EN_ROUTE);
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
}
// wait one minute before transmitting again
delay(60000);
}

View file

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

View file

@ -0,0 +1,106 @@
/*
RadioLib APRS Position over LoRa Example
This example sends APRS position reports
using SX1278's LoRa modem.
Other modules that can be used for APRS:
- SX127x/RFM9x
- SX126x/LLCC68
- SX128x
- LR11x0
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// SX1278 has the following connections:
// NSS pin: 10
// DIO0 pin: 2
// RESET pin: 9
// DIO1 pin: 3
SX1278 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();
*/
// create APRS client instance using the LoRa radio
APRSClient aprs(&radio);
void setup() {
Serial.begin(9600);
// initialize SX1278 with the settings necessary for LoRa iGates
Serial.print(F("[SX1278] Initializing ... "));
// frequency: 433.775 MHz
// bandwidth: 125 kHz
// spreading factor: 12
// coding rate: 4/5
int state = radio.begin(433.775, 125, 12, 5);
// when using one of the non-LoRa modules for AX.25
// (RF69, CC1101, Si4432 etc.), use the basic begin() method
// int state = radio.begin();
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// initialize APRS client
Serial.print(F("[APRS] Initializing ... "));
// symbol: '>' (car)
// callsign "N7LEM"
// SSID 1
char source[] = "N7LEM";
state = aprs.begin('>', source, 1);
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
}
void loop() {
Serial.print(F("[APRS] Sending position ... "));
// send a location with message and timestamp
// SSID is set to 1, as APRS over LoRa uses WIDE1-1 path by default
char destination[] = "GPS";
char latitude[] = "4911.67N";
char longitude[] = "01635.96E";
char message[] = "I'm here!";
char timestamp[] = "093045z";
int state = aprs.sendPosition(destination, 1, latitude, longitude, message, timestamp);
delay(500);
// you can also send Mic-E encoded messages
state |= state = aprs.sendMicE(49.1945, 16.6000, 120, 10, RADIOLIB_APRS_MIC_E_TYPE_EN_ROUTE);
delay(500);
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
}
// wait one minute before transmitting again
delay(60000);
}

View file

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

View file

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

View file

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

View file

@ -0,0 +1,116 @@
/*
RadioLib Bell Modem Transmit Example
This example shows how to transmit binary data
using audio Bell 202 tones.
Other implemented Bell modems
- Bell 101
- Bell 103
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// SX1278 has the following connections:
// NSS pin: 10
// DIO0 pin: 2
// RESET pin: 9
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// create Bell modem instance using the FSK module
// this requires connection to the module direct
// input pin, here connected to Arduino pin 5
// SX127x/RFM9x: DIO2
// RF69: DIO2
// SX1231: DIO2
// CC1101: GDO2
// Si443x/RFM2x: GPIO
// SX126x/LLCC68: DIO2
BellClient bell(&radio, 5);
void setup() {
Serial.begin(9600);
// initialize SX1278 with default settings
Serial.print(F("[SX1278] Initializing ... "));
int state = radio.beginFSK();
// when using one of the non-LoRa modules for AFSK
// (RF69, CC1101, Si4432 etc.), use the basic begin() method
// int state = radio.begin();
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// initialize Bell 202 modem
Serial.print(F("[Bell 202] Initializing ... "));
state = bell.begin(Bell202);
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
}
void loop() {
Serial.print(F("[Bell 202] Sending data ... "));
// send out idle condition for 500 ms
bell.idle();
delay(500);
// BellClient supports all methods of the Serial class
// Arduino String class
String aStr = "Arduino String";
bell.println(aStr);
// character array (C-String)
bell.println("C-String");
// string saved in flash
bell.println(F("Flash String"));
// character
bell.println('c');
// byte
// formatting DEC/HEX/OCT/BIN is supported for
// any integer type (byte/int/long)
bell.println(255, HEX);
// integer number
int i = 1000;
bell.println(i);
// floating point number
float f = -3.1415;
bell.println(f, 3);
// ITA2-encoded string
ITA2String str("HELLO WORLD!");
bell.print(str);
// turn the transmitter off
bell.standby();
Serial.println(F("done!"));
// wait for a second before transmitting again
delay(1000);
}

View file

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

View file

@ -1,19 +1,24 @@
/*
RadioLib CC1101 Receive Example
RadioLib CC1101 Blocking Receive Example
This example receives packets using CC1101 FSK radio module.
To successfully receive data, the following settings have to be the same
on both transmitter and receiver:
- carrier frequency
- bit rate
- frequency deviation
- sync word
This example receives packets using CC1101 FSK radio module.
To successfully receive data, the following settings have to be the same
on both transmitter and receiver:
- carrier frequency
- bit rate
- frequency deviation
- sync word
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
Using blocking receive is not recommended, as it will lead
to significant amount of timeouts, inefficient use of processor
time and can some miss packets!
Instead, interrupt receive is recommended.
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -26,9 +31,13 @@
// GDO2 pin: 3 (optional)
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//CC1101 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() {
Serial.begin(9600);
@ -41,7 +50,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
}

View file

@ -1,22 +1,22 @@
/*
RadioLib CC1101 Receive with Interrupts Example
RadioLib CC1101 Receive with Interrupts Example
This example listens for FSK transmissions and tries to
receive them. Once a packet is received, an interrupt is
triggered.
This example listens for FSK transmissions and tries to
receive them. Once a packet is received, an interrupt is
triggered.
To successfully receive data, the following settings have to be the same
on both transmitter and receiver:
- carrier frequency
- bit rate
- frequency deviation
- sync word
To successfully receive data, the following settings have to be the same
on both transmitter and receiver:
- carrier frequency
- bit rate
- frequency deviation
- sync word
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -29,9 +29,28 @@
// GDO2 pin: 3 (optional)
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//CC1101 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// 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() {
Serial.begin(9600);
@ -44,12 +63,12 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set the function that will be called
// when new packet is received
radio.setGdo0Action(setFlag);
radio.setPacketReceivedAction(setFlag);
// start listening for packets
Serial.print(F("[CC1101] Starting to listen ... "));
@ -59,7 +78,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// if needed, 'listen' mode can be disabled by calling
@ -72,36 +91,9 @@ void setup() {
// radio.readData();
}
// flag to indicate that a packet was received
volatile bool receivedFlag = false;
// disable interrupt when it's not needed
volatile bool enableInterrupt = true;
// 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) {
// check if the interrupt is enabled
if(!enableInterrupt) {
return;
}
// we got a packet, set the flag
receivedFlag = true;
}
void loop() {
// check if the flag is set
if(receivedFlag) {
// disable the interrupt service routine while
// processing the data
enableInterrupt = false;
// reset flag
receivedFlag = false;
@ -112,7 +104,8 @@ void loop() {
// you can also read received data as byte array
/*
byte byteArr[8];
int state = radio.readData(byteArr, 8);
int numBytes = radio.getPacketLength();
int state = radio.readData(byteArr, numBytes);
*/
if (state == RADIOLIB_ERR_NONE) {
@ -147,10 +140,6 @@ void loop() {
// put module back to listen mode
radio.startReceive();
// we're ready to receive more packets,
// enable interrupt service routine
enableInterrupt = true;
}
}

View file

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

View file

@ -1,75 +0,0 @@
/*
RadioLib CC1101 Transmit Example
This example transmits packets using CC1101 FSK radio module.
Each packet contains up to 64 bytes of data, in the form of:
- Arduino String
- null-terminated char array (C-string)
- arbitrary binary data (byte array)
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// CC1101 has the following connections:
// CS pin: 10
// GDO0 pin: 2
// RST pin: unused
// GDO2 pin: 3 (optional)
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//CC1101 radio = RadioShield.ModuleA;
void setup() {
Serial.begin(9600);
// initialize CC1101 with default settings
Serial.print(F("[CC1101] Initializing ... "));
int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
}
}
void loop() {
Serial.print(F("[CC1101] Transmitting packet ... "));
// you can transmit C-string or Arduino string up to 63 characters long
int state = radio.transmit("Hello World!");
// you can also transmit byte array up to 63 bytes long
/*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
int state = radio.transmit(byteArr, 8);
*/
if (state == RADIOLIB_ERR_NONE) {
// the packet was successfully transmitted
Serial.println(F("success!"));
} else if (state == RADIOLIB_ERR_PACKET_TOO_LONG) {
// the supplied packet was longer than 64 bytes
Serial.println(F("too long!"));
} else {
// some other error occurred
Serial.print(F("failed, code "));
Serial.println(state);
}
// wait for a second before transmitting again
delay(1000);
}

View file

@ -1,17 +1,17 @@
/*
RadioLib CC1101 Transmit to Address Example
RadioLib CC1101 Transmit to Address Example
This example transmits packets using CC1101 FSK radio
module. Packets can have 1-byte address of the
destination node. After setting node address, this node
will automatically filter out any packets that do not
contain either node address or broadcast addresses.
This example transmits packets using CC1101 FSK radio
module. Packets can have 1-byte address of the
destination node. After setting node address, this node
will automatically filter out any packets that do not
contain either node address or broadcast addresses.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -24,9 +24,13 @@
// GDO2 pin: 3 (optional)
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//CC1101 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() {
Serial.begin(9600);
@ -39,7 +43,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set node address
@ -56,7 +60,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// address filtering can also be disabled
@ -70,7 +74,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
*/
}
@ -78,10 +82,11 @@ void setup() {
void loop() {
Serial.print(F("[CC1101] Transmitting packet ... "));
// you can transmit C-string or Arduino string up to 63 characters long
// you can transmit C-string or Arduino string up to 255 characters long
int state = radio.transmit("Hello World!");
// you can also transmit byte array up to 63 bytes long
// you can also transmit byte array up to 255 bytes long
// With some limitations see here: https://github.com/jgromes/RadioLib/discussions/1138
/*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
int state = radio.transmit(byteArr, 8);

View file

@ -0,0 +1,87 @@
/*
RadioLib CC1101 Blocking Transmit Example
This example transmits packets using CC1101 FSK radio module.
Each packet contains up to 255 bytes of data with some limitations (https://github.com/jgromes/RadioLib/discussions/1138), in the form of:
- Arduino String
- null-terminated char array (C-string)
- arbitrary binary data (byte array)
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#cc1101
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// CC1101 has the following connections:
// CS pin: 10
// GDO0 pin: 2
// RST pin: unused
// GDO2 pin: 3
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 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();
*/
void setup() {
Serial.begin(9600);
// initialize CC1101 with default settings
Serial.print(F("[CC1101] Initializing ... "));
int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
}
// counter to keep track of transmitted packets
int count = 0;
void loop() {
Serial.print(F("[CC1101] Transmitting packet ... "));
// you can transmit C-string or Arduino string up to 255 characters long
String str = "Hello World! #" + String(count++);
int state = radio.transmit(str);
// you can also transmit byte array up to 255 bytes long with some limitations; https://github.com/jgromes/RadioLib/discussions/1138
/*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
int state = radio.transmit(byteArr, 8);
*/
if (state == RADIOLIB_ERR_NONE) {
// the packet was successfully transmitted
Serial.println(F("success!"));
} else if (state == RADIOLIB_ERR_PACKET_TOO_LONG) {
// the supplied packet was longer than 255 bytes
Serial.println(F("too long!"));
} else {
// some other error occurred
Serial.print(F("failed, code "));
Serial.println(state);
}
// wait for a second before transmitting again
delay(1000);
}

View file

@ -1,18 +1,18 @@
/*
RadioLib CC1101 Transmit with Interrupts Example
RadioLib CC1101 Transmit with Interrupts Example
This example transmits packets using CC1101 FSK radio module.
Once a packet is transmitted, an interrupt is triggered.
Each packet contains up to 64 bytes of data, in the form of:
- Arduino String
- null-terminated char array (C-string)
- arbitrary binary data (byte array)
This example transmits packets using CC1101 FSK radio module.
Once a packet is transmitted, an interrupt is triggered.
Each packet contains up to 255 bytes of data with some limitations (https://github.com/jgromes/RadioLib/discussions/1138), in the form of:
- Arduino String
- null-terminated char array (C-string)
- arbitrary binary data (byte array)
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#cc1101
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -22,16 +22,35 @@
// CS pin: 10
// GDO0 pin: 2
// RST pin: unused
// GDO2 pin: 3 (optional)
// GDO2 pin: 3
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//CC1101 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// save transmission state between loops
int transmissionState = RADIOLIB_ERR_NONE;
// flag to indicate that a packet was sent
volatile bool transmittedFlag = false;
// this function is called when a complete packet
// is transmitted by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we sent a packet, set the flag
transmittedFlag = true;
}
void setup() {
Serial.begin(9600);
@ -43,21 +62,23 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
// set the function that will be called
// when packet transmission is finished
radio.setGdo0Action(setFlag);
radio.setPacketSentAction(setFlag);
// start transmitting the first packet
Serial.print(F("[CC1101] Sending first packet ... "));
// you can transmit C-string or Arduino string up to
// 64 characters long
// 255 characters long
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,
0x78, 0xAB, 0xCD, 0xEF};
@ -65,36 +86,12 @@ void setup() {
*/
}
// flag to indicate that a packet was sent
volatile bool transmittedFlag = false;
// disable interrupt when it's not needed
volatile bool enableInterrupt = true;
// 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) {
// check if the interrupt is enabled
if(!enableInterrupt) {
return;
}
// we sent a packet, set the flag
transmittedFlag = true;
}
// counter to keep track of transmitted packets
int count = 0;
void loop() {
// check if the previous transmission finished
if(transmittedFlag) {
// disable the interrupt service routine while
// processing the data
enableInterrupt = false;
// reset flag
transmittedFlag = false;
@ -112,6 +109,11 @@ void loop() {
}
// 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);
@ -119,18 +121,15 @@ void loop() {
Serial.print(F("[CC1101] Sending another packet ... "));
// you can transmit C-string or Arduino string up to
// 256 characters long
transmissionState = radio.startTransmit("Hello World!");
// 255 characters long
String str = "Hello World! #" + String(count++);
transmissionState = radio.startTransmit(str);
// you can also transmit byte array up to 256 bytes long
// you can also transmit byte array up to 255 bytes long with limitations https://github.com/jgromes/RadioLib/discussions/1138
/*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF};
int state = radio.startTransmit(byteArr, 8);
*/
// we're ready to send more packets,
// enable interrupt service routine
enableInterrupt = true;
}
}

View file

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

View file

@ -1,24 +1,25 @@
/*
RadioLib FSK4 Transmit AFSK Example
RadioLib FSK4 Transmit AFSK Example
This example sends an example FSK-4 'Horus Binary' message
using SX1278's FSK modem. The data is modulated as AFSK.
This example sends an example FSK-4 'Horus Binary' message
using SX1278's FSK modem. The data is modulated as AFSK.
This signal can be demodulated using an FM demodulator (SDR or otherwise),
and horusdemodlib: https://github.com/projecthorus/horusdemodlib/wiki
This signal can be demodulated using an FM demodulator (SDR or otherwise),
and horusdemodlib: https://github.com/projecthorus/horusdemodlib/wiki
Other modules that can be used for FSK4:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
Other modules that can be used for FSK4:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
- SX126x/LLCC68
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -31,12 +32,23 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module
// pin 5 is connected to SX1278 DIO2
// this requires connection to the module direct
// input pin, here connected to Arduino pin 5
// SX127x/RFM9x: DIO2
// RF69: DIO2
// SX1231: DIO2
// CC1101: GDO2
// Si443x/RFM2x: GPIO
// SX126x/LLCC68: DIO2
AFSKClient audio(&radio, 5);
// create FSK4 client instance using the AFSK instance
@ -74,14 +86,14 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize FSK4 client
// NOTE: Unlike FSK FSK4, AFSK requires no rounding of
// the frequency shift.
Serial.print(F("[FSK4] Initializing ... "));
// low ("space") frequency: 434.0 MHz
// lowest ("space") frequency: 400 Hz
// frequency shift: 270 Hz
// baud rate: 100 baud
state = fsk4.begin(400, 270, 100);
@ -90,8 +102,25 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// sometimes, it may be needed to set some manual corrections
// this can be done for tone frequencies,
// as well as tone lengths
/*
// set audio tone offsets to -10, 20, 0 and 5 Hz and decrease tone length to 95%
int offsets[4] = { -10, 20, 0, 5 };
Serial.print(F("[FSK4] Setting corrections ... "));
state = fsk4.setCorrection(offsets, 0.95);
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
*/
}
void loop() {

View file

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

View file

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

View file

@ -0,0 +1,106 @@
/*
RadioLib LR11x0 Blocking Channel Activity Detection Example
This example uses LR1110 to scan the current LoRa
channel and detect ongoing LoRa transmissions.
Unlike SX127x CAD, LR11x0 can detect any part
of LoRa transmission, not just the preamble.
Other modules from LR11x0 family can also be used.
This example assumes Seeed Studio Wio WM1110 is used.
For other LR11x0 modules, some configuration such as
RF switch control may have to be adjusted.
Using blocking CAD is not recommended, as it will lead
to significant amount of timeouts, inefficient use of processor
time and can some miss packets!
Instead, interrupt CAD is recommended.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// LR1110 has the following connections:
// NSS pin: 10
// IRQ pin: 2
// NRST pin: 3
// BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different!
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6
{ LR11x0::MODE_STBY, { LOW, LOW } },
{ LR11x0::MODE_RX, { HIGH, LOW } },
{ LR11x0::MODE_TX, { HIGH, HIGH } },
{ LR11x0::MODE_TX_HP, { LOW, HIGH } },
{ LR11x0::MODE_TX_HF, { LOW, LOW } },
{ LR11x0::MODE_GNSS, { LOW, LOW } },
{ LR11x0::MODE_WIFI, { LOW, LOW } },
END_OF_MODE_TABLE,
};
void setup() {
Serial.begin(9600);
// initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
}
void loop() {
Serial.print(F("[LR1110] Scanning channel for LoRa transmission ... "));
// start scanning current channel
int state = radio.scanChannel();
if (state == RADIOLIB_LORA_DETECTED) {
// LoRa preamble was detected
Serial.println(F("detected!"));
} else if (state == RADIOLIB_CHANNEL_FREE) {
// no preamble was detected, channel is free
Serial.println(F("channel is free!"));
} else {
// some other error occurred
Serial.print(F("failed, code "));
Serial.println(state);
}
// wait 100 ms before new scan
delay(100);
}

View file

@ -0,0 +1,141 @@
/*
RadioLib LR11x0 Channel Activity Detection Example
This example uses LR1110 to scan the current LoRa
channel and detect ongoing LoRa transmissions.
Unlike SX127x CAD, LR11x0 can detect any part
of LoRa transmission, not just the preamble.
Other modules from LR11x0 family can also be used.
This example assumes Seeed Studio Wio WM1110 is used.
For other LR11x0 modules, some configuration such as
RF switch control may have to be adjusted.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// LR1110 has the following connections:
// NSS pin: 10
// IRQ pin: 2
// NRST pin: 3
// BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different!
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6
{ LR11x0::MODE_STBY, { LOW, LOW } },
{ LR11x0::MODE_RX, { HIGH, LOW } },
{ LR11x0::MODE_TX, { HIGH, HIGH } },
{ LR11x0::MODE_TX_HP, { LOW, HIGH } },
{ LR11x0::MODE_TX_HF, { LOW, LOW } },
{ LR11x0::MODE_GNSS, { LOW, LOW } },
{ LR11x0::MODE_WIFI, { LOW, LOW } },
END_OF_MODE_TABLE,
};
// flag to indicate that a packet was detected or CAD timed out
volatile bool scanFlag = false;
// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// something happened, set the flag
scanFlag = true;
}
void setup() {
Serial.begin(9600);
// initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// set the function that will be called
// when LoRa packet or timeout is detected
radio.setIrqAction(setFlag);
// start scanning the channel
Serial.print(F("[LR1110] Starting scan for LoRa preamble ... "));
state = radio.startChannelScan();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
}
}
void loop() {
// check if the flag is set
if(scanFlag) {
// reset flag
scanFlag = false;
// check CAD result
int state = radio.getChannelScanResult();
if (state == RADIOLIB_LORA_DETECTED) {
// LoRa packet was detected
Serial.println(F("[LR1110] Packet detected!"));
} else if (state == RADIOLIB_CHANNEL_FREE) {
// channel is free
Serial.println(F("[LR1110] Channel is free!"));
} else {
// some other error occurred
Serial.print(F("[LR1110] Failed, code "));
Serial.println(state);
}
// start scanning the channel again
Serial.print(F("[LR1110] Starting scan for LoRa preamble ... "));
state = radio.startChannelScan();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
}
}
}

View file

@ -0,0 +1,136 @@
/*
RadioLib LR11x0 Firmware Update Example
This example updates the internal LR1110 firmware.
Newer versions of the firmware introduce fixes
and possibly even new features, so it is recommended
to use the latest available firmware version
when possible.
Other modules from LR11x0 family can also be used.
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// select the firmware image you want to upload
// WARNING: Make sure you select the correct firmware
// for your device! Uploading incorrect firmware
// (e.g. LR1110 firmware to LR1120 device)
// may damage your hardware!
//#define RADIOLIB_LR1110_FIRMWARE_0303
//#define RADIOLIB_LR1110_FIRMWARE_0304
//#define RADIOLIB_LR1110_FIRMWARE_0305
//#define RADIOLIB_LR1110_FIRMWARE_0306
//#define RADIOLIB_LR1110_FIRMWARE_0307
#define RADIOLIB_LR1110_FIRMWARE_0401
//#define RADIOLIB_LR1120_FIRMWARE_0101
//#define RADIOLIB_LR1120_FIRMWARE_0102
//#define RADIOLIB_LR1120_FIRMWARE_0201
//#define RADIOLIB_LR1121_FIRMWARE_0102
//#define RADIOLIB_LR1121_FIRMWARE_0103
// enable this macro if you want to store the image in host
// MCU RAM instead of Flash.
// NOTE: the firmware images are very large, up to 240 kB!
//#define RADIOLIB_LR1110_FIRMWARE_IN_RAM
// include the firmware image
#include <modules/LR11x0/LR11x0_firmware.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();
*/
void setup() {
Serial.begin(9600);
// initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// print the firmware versions before the update
printVersions();
// prompt the user
Serial.println(F("[LR1110] Send any character to start the update"));
while(!Serial.available()) { delay(1); }
// upload update into LR11x0 non-volatile memory
Serial.print(F("[LR1110] Updating firmware, this may take several seconds ... "));
state = radio.updateFirmware(lr11xx_firmware_image, RADIOLIB_LR11X0_FIRMWARE_IMAGE_SIZE);
/*
use the following if you enabled RADIOLIB_LR1110_FIRMWARE_IN_RAM
state = radio.updateFirmware(lr11xx_firmware_image, RADIOLIB_LR11X0_FIRMWARE_IMAGE_SIZE, false);
*/
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// print the firmware versions after the update
printVersions();
}
void printVersions() {
LR11x0VersionInfo_t version;
Serial.print(F("[LR1110] Reading firmware versions ... "));
int16_t state = radio.getVersionInfo(&version);
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
Serial.print(F("[LR1110] Device: "));
Serial.println(version.device);
Serial.print(F("[LR1110] Base firmware: "));
Serial.print(version.fwMajor);
Serial.print('.');
Serial.println(version.fwMinor);
Serial.print(F("[LR1110] WiFi firmware: "));
Serial.print(version.fwMajorWiFi);
Serial.print('.');
Serial.println(version.fwMinorWiFi);
Serial.print(F("[LR1110] GNSS firmware: "));
Serial.print(version.fwGNSS);
Serial.print('.');
Serial.println(version.almanacGNSS);
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
}
void loop() {
}

View file

@ -0,0 +1,157 @@
/*
RadioLib LR11x0 GFSK Modem Example
This example shows how to use GFSK modem in LR11x0 chips.
NOTE: The sketch below is just a guide on how to use
GFSK modem, so this code should not be run directly!
Instead, modify the other examples to use GFSK
modem and use the appropriate configuration
methods.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---gfsk-modem
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
// IRQ pin: 2
// NRST pin: 3
// BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() {
Serial.begin(9600);
// initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.beginGFSK();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// if needed, you can switch between any of the modems
//
// radio.begin() start LoRa modem (and disable GFSK)
// radio.beginGFSK() start GFSK modem (and disable LoRa)
// the following settings can also
// be modified at run-time
state = radio.setFrequency(433.5);
state = radio.setBitRate(100.0);
state = radio.setFrequencyDeviation(10.0);
state = radio.setRxBandwidth(250.0);
state = radio.setOutputPower(10.0);
state = radio.setDataShaping(RADIOLIB_SHAPING_1_0);
uint8_t syncWord[] = {0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF};
state = radio.setSyncWord(syncWord, 8);
if (state != RADIOLIB_ERR_NONE) {
Serial.print(F("Unable to set configuration, code "));
Serial.println(state);
while (true) { delay(10); }
}
// GFSK modem on LR11x0 can handle the sync word setting in bits, not just
// whole bytes. The value used is left-justified.
// This makes same result as radio.setSyncWord(syncWord, 8):
state = radio.setSyncBits(syncWord, 64);
// This will use 0x012 as sync word (12 bits only):
state = radio.setSyncBits(syncWord, 12);
// GFSK modem allows advanced CRC configuration
// Default is CCIT CRC16 (2 bytes, initial 0x1D0F, polynomial 0x1021, inverted)
// Set CRC to IBM CRC (2 bytes, initial 0xFFFF, polynomial 0x8005, non-inverted)
state = radio.setCRC(2, 0xFFFF, 0x8005, false);
// set CRC length to 0 to disable CRC
#warning "This sketch is just an API guide! Read the note at line 6."
}
void loop() {
// GFSK modem can use the same transmit/receive methods
// as the LoRa modem, even their interrupt-driven versions
// transmit GFSK packet
int state = radio.transmit("Hello World!");
/*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF};
int state = radio.transmit(byteArr, 8);
*/
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("[LR1110] Packet transmitted successfully!"));
} else if (state == RADIOLIB_ERR_PACKET_TOO_LONG) {
Serial.println(F("[LR1110] Packet too long!"));
} else if (state == RADIOLIB_ERR_TX_TIMEOUT) {
Serial.println(F("[LR1110] Timed out while transmitting!"));
} else {
Serial.println(F("[LR1110] Failed to transmit packet, code "));
Serial.println(state);
}
// receive GFSK packet
String str;
state = radio.receive(str);
/*
byte byteArr[8];
int state = radio.receive(byteArr, 8);
*/
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("[LR1110] Received packet!"));
Serial.print(F("[LR1110] Data:\t"));
Serial.println(str);
} else if (state == RADIOLIB_ERR_RX_TIMEOUT) {
Serial.println(F("[LR1110] Timed out while waiting for packet!"));
} else {
Serial.print(F("[LR1110] Failed to receive packet, code "));
Serial.println(state);
}
// GFSK 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("[LR1110] 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,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

@ -0,0 +1,96 @@
/*
RadioLib LR11x0 LR-FHSS Modem Example
This example shows how to use LR-FHSS modem in LR11x0 chips.
This modem can only transmit data, and is not able to receive.
NOTE: The sketch below is just a guide on how to use
LR-FHSS modem, so this code should not be run directly!
Instead, modify the other examples to use LR-FHSS
modem and use the appropriate configuration
methods.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lr-fhss-modem
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
// IRQ pin: 2
// NRST pin: 3
// BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() {
Serial.begin(9600);
// initialize LR1110 with default settings
Serial.print(F("[LR1110] 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); }
}
// if needed, you can switch between any of the modems
//
// radio.begin() start LoRa modem (and disable LR-FHSS)
// radio.beginLRFHSS() start LR-FHSS modem (and disable LoRa)
// the following settings can also
// be modified at run-time
state = radio.setFrequency(433.5);
state = radio.setLrFhssConfig(RADIOLIB_LR11X0_LR_FHSS_BW_1523_4, // bandwidth
RADIOLIB_LR11X0_LR_FHSS_CR_1_2, // coding rate
3, // header count
0x13A); // hopping sequence seed
state = radio.setOutputPower(10.0);
uint8_t syncWord[] = {0x01, 0x23, 0x45, 0x67};
state = radio.setSyncWord(syncWord, 4);
if (state != RADIOLIB_ERR_NONE) {
Serial.print(F("Unable to set configuration, code "));
Serial.println(state);
while (true) { delay(10); }
}
#warning "This sketch is just an API guide! Read the note at line 6."
}
void loop() {
// LR-FHSS modem can only transmit!
// transmit LR-FHSS packet
int state = radio.transmit("Hello World!");
/*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF};
int state = radio.transmit(byteArr, 8);
*/
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("[LR1110] Packet transmitted successfully!"));
} else if (state == RADIOLIB_ERR_PACKET_TOO_LONG) {
Serial.println(F("[LR1110] Packet too long!"));
} else if (state == RADIOLIB_ERR_TX_TIMEOUT) {
Serial.println(F("[LR1110] Timed out while transmitting!"));
} else {
Serial.println(F("[LR1110] Failed to transmit packet, code "));
Serial.println(state);
}
}

View file

@ -0,0 +1,173 @@
/*
RadioLib LR11x0 Ping-Pong Example
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// uncomment the following only on one
// of the nodes to initiate the pings
//#define INITIATING_NODE
// LR1110 has the following connections:
// NSS pin: 10
// IRQ pin: 2
// NRST pin: 3
// BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different!
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6
{ LR11x0::MODE_STBY, { LOW, LOW } },
{ LR11x0::MODE_RX, { HIGH, LOW } },
{ LR11x0::MODE_TX, { HIGH, HIGH } },
{ LR11x0::MODE_TX_HP, { LOW, HIGH } },
{ LR11x0::MODE_TX_HF, { LOW, LOW } },
{ LR11x0::MODE_GNSS, { LOW, LOW } },
{ LR11x0::MODE_WIFI, { LOW, LOW } },
END_OF_MODE_TABLE,
};
// save transmission states between loops
int transmissionState = RADIOLIB_ERR_NONE;
// flag to indicate transmission or reception state
bool transmitFlag = false;
// flag to indicate that a packet was sent or received
volatile bool operationDone = false;
// this function is called when a complete packet
// is transmitted or received by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we sent or received a packet, set the flag
operationDone = true;
}
void setup() {
Serial.begin(9600);
// initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// set the function that will be called
// when new packet is received
radio.setIrqAction(setFlag);
#if defined(INITIATING_NODE)
// send the first packet on this node
Serial.print(F("[LR1110] Sending first packet ... "));
transmissionState = radio.startTransmit("Hello World!");
transmitFlag = true;
#else
// start listening for LoRa packets on this node
Serial.print(F("[LR1110] Starting to listen ... "));
state = radio.startReceive();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
#endif
}
void loop() {
// check if the previous operation finished
if(operationDone) {
// reset flag
operationDone = false;
if(transmitFlag) {
// the previous operation was transmission, listen for response
// print the result
if (transmissionState == RADIOLIB_ERR_NONE) {
// packet was successfully sent
Serial.println(F("transmission finished!"));
} else {
Serial.print(F("failed, code "));
Serial.println(transmissionState);
}
// listen for response
radio.startReceive();
transmitFlag = false;
} else {
// the previous operation was reception
// print data and send another packet
String str;
int state = radio.readData(str);
if (state == RADIOLIB_ERR_NONE) {
// packet was successfully received
Serial.println(F("[LR1110] Received packet!"));
// print data of the packet
Serial.print(F("[LR1110] Data:\t\t"));
Serial.println(str);
// print RSSI (Received Signal Strength Indicator)
Serial.print(F("[LR1110] RSSI:\t\t"));
Serial.print(radio.getRSSI());
Serial.println(F(" dBm"));
// print SNR (Signal-to-Noise Ratio)
Serial.print(F("[LR1110] SNR:\t\t"));
Serial.print(radio.getSNR());
Serial.println(F(" dB"));
}
// wait a second before transmitting again
delay(1000);
// send another one
Serial.print(F("[LR1110] Sending another packet ... "));
transmissionState = radio.startTransmit("Hello World!");
transmitFlag = true;
}
}
}

View file

@ -0,0 +1,135 @@
/*
RadioLib LR11x0 Blocking Receive Example
This example listens for LoRa transmissions using LR11x0 Lora modules.
To successfully receive data, the following settings have to be the same
on both transmitter and receiver:
- carrier frequency
- bandwidth
- spreading factor
- coding rate
- sync word
- preamble length
Other modules from LR11x0 family can also be used.
This example assumes Seeed Studio Wio WM1110 is used.
For other LR11x0 modules, some configuration such as
RF switch control may have to be adjusted.
Using blocking receive is not recommended, as it will lead
to significant amount of timeouts, inefficient use of processor
time and can some miss packets!
Instead, interrupt receive is recommended.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// LR1110 has the following connections:
// NSS pin: 10
// IRQ pin: 2
// NRST pin: 3
// BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different!
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6
{ LR11x0::MODE_STBY, { LOW, LOW } },
{ LR11x0::MODE_RX, { HIGH, LOW } },
{ LR11x0::MODE_TX, { HIGH, HIGH } },
{ LR11x0::MODE_TX_HP, { LOW, HIGH } },
{ LR11x0::MODE_TX_HF, { LOW, LOW } },
{ LR11x0::MODE_GNSS, { LOW, LOW } },
{ LR11x0::MODE_WIFI, { LOW, LOW } },
END_OF_MODE_TABLE,
};
void setup() {
Serial.begin(9600);
// initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
}
void loop() {
Serial.print(F("[LR1110] Waiting for incoming transmission ... "));
// you can receive data as an Arduino String
String str;
int state = radio.receive(str);
// you can also receive data as byte array
/*
byte byteArr[8];
int state = radio.receive(byteArr, 8);
*/
if (state == RADIOLIB_ERR_NONE) {
// packet was successfully received
Serial.println(F("success!"));
// print the data of the packet
Serial.print(F("[LR1110] Data:\t\t"));
Serial.println(str);
// print the RSSI (Received Signal Strength Indicator)
// of the last received packet
Serial.print(F("[LR1110] RSSI:\t\t"));
Serial.print(radio.getRSSI());
Serial.println(F(" dBm"));
// print the SNR (Signal-to-Noise Ratio)
// of the last received packet
Serial.print(F("[LR1110] SNR:\t\t"));
Serial.print(radio.getSNR());
Serial.println(F(" dB"));
} else if (state == RADIOLIB_ERR_RX_TIMEOUT) {
// timeout occurred while waiting for a packet
Serial.println(F("timeout!"));
} else if (state == RADIOLIB_ERR_CRC_MISMATCH) {
// packet was received, but is malformed
Serial.println(F("CRC error!"));
} else {
// some other error occurred
Serial.print(F("failed, code "));
Serial.println(state);
}
}

View file

@ -0,0 +1,169 @@
/*
RadioLib LR11x0 Receive with Interrupts Example
This example listens for LoRa transmissions and tries to
receive them. Once a packet is received, an interrupt is
triggered. To successfully receive data, the following
settings have to be the same on both transmitter
and receiver:
- carrier frequency
- bandwidth
- spreading factor
- coding rate
- sync word
Other modules from LR11x0 family can also be used.
This example assumes Seeed Studio Wio WM1110 is used.
For other LR11x0 modules, some configuration such as
RF switch control may have to be adjusted.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// LR1110 has the following connections:
// NSS pin: 10
// IRQ pin: 2
// NRST pin: 3
// BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different!
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6
{ LR11x0::MODE_STBY, { LOW, LOW } },
{ LR11x0::MODE_RX, { HIGH, LOW } },
{ LR11x0::MODE_TX, { HIGH, HIGH } },
{ LR11x0::MODE_TX_HP, { LOW, HIGH } },
{ LR11x0::MODE_TX_HF, { LOW, LOW } },
{ LR11x0::MODE_GNSS, { LOW, LOW } },
{ LR11x0::MODE_WIFI, { LOW, LOW } },
END_OF_MODE_TABLE,
};
// 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() {
Serial.begin(9600);
// initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// set the function that will be called
// when new packet is received
radio.setPacketReceivedAction(setFlag);
// start listening for LoRa packets
Serial.print(F("[LR1110] Starting to listen ... "));
state = radio.startReceive();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// if needed, 'listen' mode can be disabled by calling
// any of the following methods:
//
// radio.standby()
// radio.sleep()
// radio.transmit();
// radio.receive();
// radio.scanChannel();
}
void loop() {
// check if the flag is set
if(receivedFlag) {
// reset flag
receivedFlag = false;
// you can read received data as an Arduino String
String str;
int state = radio.readData(str);
// you can also read received data as byte array
/*
byte byteArr[8];
int numBytes = radio.getPacketLength();
int state = radio.readData(byteArr, numBytes);
*/
if (state == RADIOLIB_ERR_NONE) {
// packet was successfully received
Serial.println(F("[LR1110] Received packet!"));
// print data of the packet
Serial.print(F("[LR1110] Data:\t\t"));
Serial.println(str);
// print RSSI (Received Signal Strength Indicator)
Serial.print(F("[LR1110] RSSI:\t\t"));
Serial.print(radio.getRSSI());
Serial.println(F(" dBm"));
// print SNR (Signal-to-Noise Ratio)
Serial.print(F("[LR1110] SNR:\t\t"));
Serial.print(radio.getSNR());
Serial.println(F(" dB"));
} else if (state == RADIOLIB_ERR_CRC_MISMATCH) {
// packet was received, but is malformed
Serial.println(F("CRC error!"));
} else {
// some other error occurred
Serial.print(F("failed, code "));
Serial.println(state);
}
}
}

View file

@ -0,0 +1,126 @@
/*
RadioLib LR11x0 Blocking Transmit Example
This example transmits packets using LR1110 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 LR11x0 family can also be used.
This example assumes Seeed Studio Wio WM1110 is used.
For other LR11x0 modules, some configuration such as
RF switch control may have to be adjusted.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// LR1110 has the following connections:
// NSS pin: 10
// IRQ pin: 2
// NRST pin: 3
// BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different!
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6
{ LR11x0::MODE_STBY, { LOW, LOW } },
{ LR11x0::MODE_RX, { HIGH, LOW } },
{ LR11x0::MODE_TX, { HIGH, HIGH } },
{ LR11x0::MODE_TX_HP, { LOW, HIGH } },
{ LR11x0::MODE_TX_HF, { LOW, LOW } },
{ LR11x0::MODE_GNSS, { LOW, LOW } },
{ LR11x0::MODE_WIFI, { LOW, LOW } },
END_OF_MODE_TABLE,
};
void setup() {
Serial.begin(9600);
// initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
delay(1000);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
}
// counter to keep track of transmitted packets
int count = 0;
void loop() {
Serial.print(F("[LR1110] Transmitting packet ... "));
// you can transmit C-string or Arduino string up to
// 256 characters long
// NOTE: transmit() is a blocking method!
// See example LR11x0_Transmit_Interrupt for details
// on non-blocking transmission method.
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("[LR1110] 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 occured 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,162 @@
/*
RadioLib LR11x0 Transmit with Interrupts Example
This example transmits LoRa packets with one second delays
between them. 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 LR11x0 family can also be used.
This example assumes Seeed Studio Wio WM1110 is used.
For other LR11x0 modules, some configuration such as
RF switch control may have to be adjusted.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// LR1110 has the following connections:
// NSS pin: 10
// IRQ pin: 2
// NRST pin: 3
// BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// set RF switch configuration for Wio WM1110
// Wio WM1110 uses DIO5 and DIO6 for RF switching
// NOTE: other boards may be different!
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6
{ LR11x0::MODE_STBY, { LOW, LOW } },
{ LR11x0::MODE_RX, { HIGH, LOW } },
{ LR11x0::MODE_TX, { HIGH, HIGH } },
{ LR11x0::MODE_TX_HP, { LOW, HIGH } },
{ LR11x0::MODE_TX_HF, { LOW, LOW } },
{ LR11x0::MODE_GNSS, { LOW, LOW } },
{ LR11x0::MODE_WIFI, { LOW, LOW } },
END_OF_MODE_TABLE,
};
// save transmission state between loops
int transmissionState = RADIOLIB_ERR_NONE;
// flag to indicate that a packet was sent
volatile bool transmittedFlag = false;
// this function is called when a complete packet
// is transmitted by the module
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// we sent a packet, set the flag
transmittedFlag = true;
}
void setup() {
Serial.begin(9600);
// initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// set the function that will be called
// when packet transmission is finished
radio.setPacketSentAction(setFlag);
// start transmitting the first packet
Serial.print(F("[LR1110] 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() {
// check if the previous transmission finished
if(transmittedFlag) {
// reset flag
transmittedFlag = false;
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("[LR1110] 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

@ -0,0 +1,143 @@
/*
RadioLib LR11x0 WiFi scan Blocking Example
This example performs a passive scan of WiFi networks.
The scan shows basic information about the networks,
such as the frequency, country code and SSID.
Other modules from LR11x0 family can also be used.
This example assumes Seeed Studio Wio WM1110 is used.
For other LR11x0 modules, some configuration such as
RF switch control may have to be adjusted.
Using blocking scan is not recommended, as depending
on the scan settings, the program may be blocked
for several seconds! Instead, interrupt scan is recommended.
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,
};
void setup() {
Serial.begin(9600);
// initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
}
void loop() {
Serial.print(F("[LR1110] Running WiFi scan ... "));
// scan all WiFi signals with default scan configuration
uint8_t count = 0;
int state = radio.wifiScan('*', &count);
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
// print the table header
Serial.print(F("[LR1110] Reading "));
Serial.print(count);
Serial.println(F(" scan results:"));
Serial.println(F(" # | WiFi type\t| Frequency\t| MAC Address\t | Country\t| RSSI [dBm]\t| SSID"));
// read all results one by one
// this result type contains the most information, including the SSID
LR11x0WifiResultExtended_t result;
for(int i = 0; i < count; i++) {
if(i < 10) { Serial.print(" "); } Serial.print(i); Serial.print(" | ");
state = radio.getWifiScanResult(&result, i);
if(state != RADIOLIB_ERR_NONE) {
Serial.print(F("Failed to read result, code "));
Serial.println(state);
continue;
}
// print the basic information
Serial.print(F("802.11")); Serial.print(result.type); Serial.print("\t| ");
Serial.print(result.channelFreq); Serial.print(" MHz\t| ");
// print MAC address
for(int j = 0; j < 6; j++) {
if(result.mac[j] < 0x10) { Serial.print("0"); }
Serial.print(result.mac[j], HEX);
if(j < 5) { Serial.print(":"); }
}
Serial.print(" | ");
// print the two-letter country code
String country = result.countryCode;
Serial.print(country);
Serial.print(" \t| ");
// print the RSSI
Serial.print(result.rssi);
Serial.print("\t| ");
// print the network SSID
Serial.println((char*)result.ssid);
}
} else {
// some other error occurred
Serial.print(F("failed, code "));
Serial.println(state);
}
// wait for a second before scanning again
delay(1000);
}

View file

@ -0,0 +1,181 @@
/*
RadioLib LR11x0 WiFi scan Interrupt Example
This example performs a passive scan of WiFi networks.
The scan shows basic information about the networks,
such as the frequency, country code and SSID.
Other modules from LR11x0 family can also be used.
This example assumes Seeed Studio Wio WM1110 is used.
For other LR11x0 modules, some configuration such as
RF switch control may have to be adjusted.
Using blocking scan is not recommended, as depending
on the scan settings, the program may be blocked
for several seconds! Instead, interrupt scan is recommended.
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,
};
// flag to indicate that a scan was completed
volatile bool scanFlag = false;
// this function is called when a scan is completed
// IMPORTANT: this function MUST be 'void' type
// and MUST NOT have any arguments!
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
void setFlag(void) {
// scan is complete, set the flag
scanFlag = true;
}
void setup() {
Serial.begin(9600);
// initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// set RF switch control configuration
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// set the function that will be called
// when WiFi scan is complete
radio.setIrqAction(setFlag);
// scan all WiFi signals with default scan configuration
Serial.print(F("[LR1110] Starting passive WiFi scan ... "));
state = radio.startWifiScan('*');
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
}
}
void loop() {
// check if the flag is set
if(scanFlag) {
// reset flag
scanFlag = false;
// get the number of scan results
uint8_t count = 0;
Serial.print(F("[LR1110] Reading WiFi scan results ... "));
int state = radio.getWifiScanResultsCount(&count);
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
// print the table header
Serial.print(F("[LR1110] Reading "));
Serial.print(count);
Serial.println(F(" scan results:"));
Serial.println(F(" # | WiFi type\t| Frequency\t| MAC Address\t | Country\t| RSSI [dBm]\t| SSID"));
// read all results one by one
// this result type contains the most information, including the SSID
LR11x0WifiResultExtended_t result;
for(int i = 0; i < count; i++) {
if(i < 10) { Serial.print(" "); } Serial.print(i); Serial.print(" | ");
state = radio.getWifiScanResult(&result, i);
if(state != RADIOLIB_ERR_NONE) {
Serial.print(F("Failed to read result, code "));
Serial.println(state);
continue;
}
// print the basic information
Serial.print(F("802.11")); Serial.print(result.type); Serial.print("\t| ");
Serial.print(result.channelFreq); Serial.print(" MHz\t| ");
// print MAC address
for(int j = 0; j < 6; j++) {
if(result.mac[j] < 0x10) { Serial.print("0"); }
Serial.print(result.mac[j], HEX);
if(j < 5) { Serial.print(":"); }
}
Serial.print(" | ");
// print the two-letter country code
String country = result.countryCode;
Serial.print(country);
Serial.print(" \t| ");
// print the RSSI
Serial.print(result.rssi);
Serial.print("\t| ");
// print the network SSID
Serial.println((char*)result.ssid);
}
} else {
// some other error occurred
Serial.print(F("failed, code "));
Serial.println(state);
}
// start scanning again
Serial.print(F("[LR1110] Starting passive WiFi scan ... "));
state = radio.startWifiScan('*');
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
}
}
}

View file

@ -0,0 +1,85 @@
/*
RadioLib LoRaWAN ABP Example
ABP = Activation by Personalisation, an alternative
to OTAA (Over the Air Activation). OTAA is preferable.
This example will send uplink packets to a LoRaWAN network.
Before you start, you will have to register your device at
https://www.thethingsnetwork.org/
After your device is registered, you can run this example.
The device will join the network and start uploading data.
LoRaWAN v1.0.4/v1.1 requires the use of persistent storage.
As this example does not use persistent storage, running this
examples REQUIRES you to check "Resets frame counters"
on your LoRaWAN dashboard. Refer to the notes or the
network's documentation on how to do this.
To comply with LoRaWAN's persistent storage, refer to
https://github.com/radiolib-org/radiolib-persistence
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For LoRaWAN details, see the wiki page
https://github.com/jgromes/RadioLib/wiki/LoRaWAN
*/
#include "configABP.h"
void setup() {
Serial.begin(115200);
while(!Serial);
delay(5000); // Give time to switch to the serial monitor
Serial.println(F("\nSetup ... "));
Serial.println(F("Initialise the radio"));
int state = radio.begin();
debug(state != RADIOLIB_ERR_NONE, F("Initialise radio failed"), state, true);
Serial.println(F("Initialise LoRaWAN Network credentials"));
node.beginABP(devAddr, fNwkSIntKey, sNwkSIntKey, nwkSEncKey, appSKey);
node.activateABP();
debug(state != RADIOLIB_ERR_NONE, F("Activate ABP failed"), state, true);
Serial.println(F("Ready!\n"));
}
void loop() {
Serial.println(F("Sending uplink"));
// This is the place to gather the sensor inputs
// Instead of reading any real sensor, we just generate some random numbers as example
uint8_t value1 = radio.random(100);
uint16_t value2 = radio.random(2000);
// Build payload byte array
uint8_t uplinkPayload[3];
uplinkPayload[0] = value1;
uplinkPayload[1] = highByte(value2); // See notes for high/lowByte functions
uplinkPayload[2] = lowByte(value2);
// Perform an uplink
int state = node.sendReceive(uplinkPayload, sizeof(uplinkPayload));
debug(state < RADIOLIB_ERR_NONE, F("Error in sendReceive"), state, false);
// Check if a downlink was received
// (state 0 = no downlink, state 1/2 = downlink in window Rx1/Rx2)
if(state > 0) {
Serial.println(F("Received a downlink"));
} else {
Serial.println(F("No downlink received"));
}
Serial.print(F("Next uplink in "));
Serial.print(uplinkIntervalSeconds);
Serial.println(F(" seconds\n"));
// Wait until next uplink - observing legal & TTN FUP constraints
delay(uplinkIntervalSeconds * 1000UL); // delay needs milli-seconds
}

View file

@ -0,0 +1,152 @@
#ifndef _RADIOLIB_EX_LORAWAN_CONFIG_H
#define _RADIOLIB_EX_LORAWAN_CONFIG_H
#include <RadioLib.h>
// first you have to set your radio model and pin configuration
// this is provided just as a default example
SX1278 radio = new Module(10, 2, 9, 3);
// if you have RadioBoards (https://github.com/radiolib-org/RadioBoards)
// and are using one of the supported boards, you can do the following:
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// how often to send an uplink - consider legal & FUP constraints - see notes
const uint32_t uplinkIntervalSeconds = 5UL * 60UL; // minutes x seconds
// device address - either a development address or one assigned
// to the LoRaWAN Service Provider - TTN will generate one for you
#ifndef RADIOLIB_LORAWAN_DEV_ADDR // Replace with your DevAddr
#define RADIOLIB_LORAWAN_DEV_ADDR 0x------
#endif
#ifndef RADIOLIB_LORAWAN_FNWKSINT_KEY // Replace with your FNwkSInt Key
#define RADIOLIB_LORAWAN_FNWKSINT_KEY 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--
#endif
#ifndef RADIOLIB_LORAWAN_SNWKSINT_KEY // Replace with your SNwkSInt Key
#define RADIOLIB_LORAWAN_SNWKSINT_KEY 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--
#endif
#ifndef RADIOLIB_LORAWAN_NWKSENC_KEY // Replace with your NwkSEnc Key
#define RADIOLIB_LORAWAN_NWKSENC_KEY 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--
#endif
#ifndef RADIOLIB_LORAWAN_APPS_KEY // Replace with your AppS Key
#define RADIOLIB_LORAWAN_APPS_KEY 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--
#endif
// for the curious, the #ifndef blocks allow for automated testing &/or you can
// put your EUI & keys in to your platformio.ini - see wiki for more tips
// regional choices: EU868, US915, AU915, AS923, AS923_2, AS923_3, AS923_4, IN865, KR920, CN470
const LoRaWANBand_t Region = EU868;
// 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 ...
// copy over the keys in to the something that will not compile if incorrectly formatted
uint32_t devAddr = RADIOLIB_LORAWAN_DEV_ADDR;
uint8_t fNwkSIntKey[] = { RADIOLIB_LORAWAN_FNWKSINT_KEY };
uint8_t sNwkSIntKey[] = { RADIOLIB_LORAWAN_SNWKSINT_KEY };
uint8_t nwkSEncKey[] = { RADIOLIB_LORAWAN_NWKSENC_KEY };
uint8_t appSKey[] = { RADIOLIB_LORAWAN_APPS_KEY };
// create the LoRaWAN node
LoRaWANNode node(&radio, &Region, subBand);
// result code to text - these are error codes that can be raised when using LoRaWAN
// however, RadioLib has many more - see https://jgromes.github.io/RadioLib/group__status__codes.html for a complete list
String stateDecode(const int16_t result) {
switch (result) {
case RADIOLIB_ERR_NONE:
return "ERR_NONE";
case RADIOLIB_ERR_CHIP_NOT_FOUND:
return "ERR_CHIP_NOT_FOUND";
case RADIOLIB_ERR_PACKET_TOO_LONG:
return "ERR_PACKET_TOO_LONG";
case RADIOLIB_ERR_RX_TIMEOUT:
return "ERR_RX_TIMEOUT";
case RADIOLIB_ERR_CRC_MISMATCH:
return "ERR_CRC_MISMATCH";
case RADIOLIB_ERR_INVALID_BANDWIDTH:
return "ERR_INVALID_BANDWIDTH";
case RADIOLIB_ERR_INVALID_SPREADING_FACTOR:
return "ERR_INVALID_SPREADING_FACTOR";
case RADIOLIB_ERR_INVALID_CODING_RATE:
return "ERR_INVALID_CODING_RATE";
case RADIOLIB_ERR_INVALID_FREQUENCY:
return "ERR_INVALID_FREQUENCY";
case RADIOLIB_ERR_INVALID_OUTPUT_POWER:
return "ERR_INVALID_OUTPUT_POWER";
case RADIOLIB_ERR_NETWORK_NOT_JOINED:
return "RADIOLIB_ERR_NETWORK_NOT_JOINED";
case RADIOLIB_ERR_DOWNLINK_MALFORMED:
return "RADIOLIB_ERR_DOWNLINK_MALFORMED";
case RADIOLIB_ERR_INVALID_REVISION:
return "RADIOLIB_ERR_INVALID_REVISION";
case RADIOLIB_ERR_INVALID_PORT:
return "RADIOLIB_ERR_INVALID_PORT";
case RADIOLIB_ERR_NO_RX_WINDOW:
return "RADIOLIB_ERR_NO_RX_WINDOW";
case RADIOLIB_ERR_INVALID_CID:
return "RADIOLIB_ERR_INVALID_CID";
case RADIOLIB_ERR_UPLINK_UNAVAILABLE:
return "RADIOLIB_ERR_UPLINK_UNAVAILABLE";
case RADIOLIB_ERR_COMMAND_QUEUE_FULL:
return "RADIOLIB_ERR_COMMAND_QUEUE_FULL";
case RADIOLIB_ERR_COMMAND_QUEUE_ITEM_NOT_FOUND:
return "RADIOLIB_ERR_COMMAND_QUEUE_ITEM_NOT_FOUND";
case RADIOLIB_ERR_JOIN_NONCE_INVALID:
return "RADIOLIB_ERR_JOIN_NONCE_INVALID";
case RADIOLIB_ERR_N_FCNT_DOWN_INVALID:
return "RADIOLIB_ERR_N_FCNT_DOWN_INVALID";
case RADIOLIB_ERR_A_FCNT_DOWN_INVALID:
return "RADIOLIB_ERR_A_FCNT_DOWN_INVALID";
case RADIOLIB_ERR_DWELL_TIME_EXCEEDED:
return "RADIOLIB_ERR_DWELL_TIME_EXCEEDED";
case RADIOLIB_ERR_CHECKSUM_MISMATCH:
return "RADIOLIB_ERR_CHECKSUM_MISMATCH";
case RADIOLIB_ERR_NO_JOIN_ACCEPT:
return "RADIOLIB_ERR_NO_JOIN_ACCEPT";
case RADIOLIB_LORAWAN_SESSION_RESTORED:
return "RADIOLIB_LORAWAN_SESSION_RESTORED";
case RADIOLIB_LORAWAN_NEW_SESSION:
return "RADIOLIB_LORAWAN_NEW_SESSION";
case RADIOLIB_ERR_NONCES_DISCARDED:
return "RADIOLIB_ERR_NONCES_DISCARDED";
case RADIOLIB_ERR_SESSION_DISCARDED:
return "RADIOLIB_ERR_SESSION_DISCARDED";
}
return "See https://jgromes.github.io/RadioLib/group__status__codes.html";
}
// helper function to display any issues
void debug(bool failed, const __FlashStringHelper* message, int state, bool halt) {
if(failed) {
Serial.print(message);
Serial.print(" - ");
Serial.print(stateDecode(state));
Serial.print(" (");
Serial.print(state);
Serial.println(")");
while(halt) { delay(1); }
}
}
// helper function to display a byte array
void arrayDump(uint8_t *buffer, uint16_t len) {
for(uint16_t c = 0; c < len; c++) {
char b = buffer[c];
if(b < 0x10) { Serial.print('0'); }
Serial.print(b, HEX);
}
Serial.println();
}
#endif

View file

@ -0,0 +1,204 @@
/*
RadioLib LoRaWAN End Device Reference Example
This example joins a LoRaWAN network and will send
uplink packets. Before you start, you will have to
register your device at https://www.thethingsnetwork.org/
After your device is registered, you can run this example.
The device will join the network and start uploading data.
Also, most of the possible and available functions are
shown here for reference.
LoRaWAN v1.0.4/v1.1 requires the use of EEPROM (persistent storage).
Running this examples REQUIRES you to check "Resets DevNonces"
on your LoRaWAN dashboard. Refer to the notes or the
network's documentation on how to do this.
To comply with LoRaWAN's persistent storage, refer to
https://github.com/radiolib-org/radiolib-persistence
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For LoRaWAN details, see the wiki page
https://github.com/jgromes/RadioLib/wiki/LoRaWAN
*/
#include "config.h"
// include the library
#include <RadioLib.h>
void setup() {
Serial.begin(115200);
while(!Serial); // Wait for serial to be initialised
delay(5000); // Give time to switch to the serial monitor
Serial.println(F("\nSetup"));
int16_t state = 0; // return value for calls to RadioLib
Serial.println(F("Initialise the radio"));
state = radio.begin();
debug(state != RADIOLIB_ERR_NONE, F("Initialise radio failed"), state, true);
// Override the default join rate
uint8_t joinDR = 4;
// Optionally provide a custom sleep function - see config.h
//node.setSleepFunction(customDelay);
// Setup the OTAA session information
node.beginOTAA(joinEUI, devEUI, nwkKey, appKey);
Serial.println(F("Join ('login') the LoRaWAN Network"));
state = node.activateOTAA(joinDR);
debug(state != RADIOLIB_LORAWAN_NEW_SESSION, F("Join failed"), state, true);
// Print the DevAddr
Serial.print("[LoRaWAN] DevAddr: ");
Serial.println((unsigned long)node.getDevAddr(), HEX);
// Enable the ADR algorithm (on by default which is preferable)
node.setADR(true);
// Set a datarate to start off with
node.setDatarate(5);
// Manages uplink intervals to the TTN Fair Use Policy
node.setDutyCycle(true, 1250);
// Update dwell time limits - 400ms is the limit for the US
node.setDwellTime(true, 400);
Serial.println(F("Ready!\n"));
}
void loop() {
int16_t state = RADIOLIB_ERR_NONE;
// set battery fill level - the LoRaWAN network server
// may periodically request this information
// 0 = external power source
// 1 = lowest (empty battery)
// 254 = highest (full battery)
// 255 = unable to measure
uint8_t battLevel = 146;
node.setDeviceStatus(battLevel);
// This is the place to gather the sensor inputs
// Instead of reading any real sensor, we just generate some random numbers as example
uint8_t value1 = radio.random(100);
uint16_t value2 = radio.random(2000);
// Build payload byte array
uint8_t uplinkPayload[3];
uplinkPayload[0] = value1;
uplinkPayload[1] = highByte(value2); // See notes for high/lowByte functions
uplinkPayload[2] = lowByte(value2);
uint8_t downlinkPayload[10]; // Make sure this fits your plans!
size_t downlinkSize; // To hold the actual payload size received
// you can also retrieve additional information about an uplink or
// downlink by passing a reference to LoRaWANEvent_t structure
LoRaWANEvent_t uplinkDetails;
LoRaWANEvent_t downlinkDetails;
uint8_t fPort = 10;
// Retrieve the last uplink frame counter
uint32_t fCntUp = node.getFCntUp();
// Send a confirmed uplink on the second uplink
// and also request the LinkCheck and DeviceTime MAC commands
Serial.println(F("Sending uplink"));
if(fCntUp == 1) {
Serial.println(F("and requesting LinkCheck and DeviceTime"));
node.sendMacCommandReq(RADIOLIB_LORAWAN_MAC_LINK_CHECK);
node.sendMacCommandReq(RADIOLIB_LORAWAN_MAC_DEVICE_TIME);
state = node.sendReceive(uplinkPayload, sizeof(uplinkPayload), fPort, downlinkPayload, &downlinkSize, true, &uplinkDetails, &downlinkDetails);
} else {
state = node.sendReceive(uplinkPayload, sizeof(uplinkPayload), fPort, downlinkPayload, &downlinkSize, false, &uplinkDetails, &downlinkDetails);
}
debug(state < RADIOLIB_ERR_NONE, F("Error in sendReceive"), state, false);
// Check if a downlink was received
// (state 0 = no downlink, state 1/2 = downlink in window Rx1/Rx2)
if(state > 0) {
Serial.println(F("Received a downlink"));
// Did we get a downlink with data for us
if(downlinkSize > 0) {
Serial.println(F("Downlink data: "));
arrayDump(downlinkPayload, downlinkSize);
} else {
Serial.println(F("<MAC commands only>"));
}
// print RSSI (Received Signal Strength Indicator)
Serial.print(F("[LoRaWAN] RSSI:\t\t"));
Serial.print(radio.getRSSI());
Serial.println(F(" dBm"));
// print SNR (Signal-to-Noise Ratio)
Serial.print(F("[LoRaWAN] SNR:\t\t"));
Serial.print(radio.getSNR());
Serial.println(F(" dB"));
// print extra information about the event
Serial.println(F("[LoRaWAN] Event information:"));
Serial.print(F("[LoRaWAN] Confirmed:\t"));
Serial.println(downlinkDetails.confirmed);
Serial.print(F("[LoRaWAN] Confirming:\t"));
Serial.println(downlinkDetails.confirming);
Serial.print(F("[LoRaWAN] Datarate:\t"));
Serial.println(downlinkDetails.datarate);
Serial.print(F("[LoRaWAN] Frequency:\t"));
Serial.print(downlinkDetails.freq, 3);
Serial.println(F(" MHz"));
Serial.print(F("[LoRaWAN] Frame count:\t"));
Serial.println(downlinkDetails.fCnt);
Serial.print(F("[LoRaWAN] Port:\t\t"));
Serial.println(downlinkDetails.fPort);
Serial.print(F("[LoRaWAN] Time-on-air: \t"));
Serial.print(node.getLastToA());
Serial.println(F(" ms"));
Serial.print(F("[LoRaWAN] Rx window: \t"));
Serial.println(state);
uint8_t margin = 0;
uint8_t gwCnt = 0;
if(node.getMacLinkCheckAns(&margin, &gwCnt) == RADIOLIB_ERR_NONE) {
Serial.print(F("[LoRaWAN] LinkCheck margin:\t"));
Serial.println(margin);
Serial.print(F("[LoRaWAN] LinkCheck count:\t"));
Serial.println(gwCnt);
}
uint32_t networkTime = 0;
uint8_t fracSecond = 0;
if(node.getMacDeviceTimeAns(&networkTime, &fracSecond, true) == RADIOLIB_ERR_NONE) {
Serial.print(F("[LoRaWAN] DeviceTime Unix:\t"));
Serial.println(networkTime);
Serial.print(F("[LoRaWAN] DeviceTime second:\t1/"));
Serial.println(fracSecond);
}
} else {
Serial.println(F("[LoRaWAN] No downlink received"));
}
// wait before sending another packet
uint32_t minimumDelay = uplinkIntervalSeconds * 1000UL;
uint32_t interval = node.timeUntilUplink(); // calculate minimum duty cycle delay (per FUP & law!)
uint32_t delayMs = max(interval, minimumDelay); // cannot send faster than duty cycle allows
Serial.print(F("[LoRaWAN] Next uplink in "));
Serial.print(delayMs/1000);
Serial.println(F(" seconds\n"));
delay(delayMs);
}

View file

@ -0,0 +1,162 @@
#ifndef _RADIOLIB_EX_LORAWAN_CONFIG_H
#define _RADIOLIB_EX_LORAWAN_CONFIG_H
#include <RadioLib.h>
// first you have to set your radio model and pin configuration
// this is provided just as a default example
SX1278 radio = new Module(10, 2, 9, 3);
// if you have RadioBoards (https://github.com/radiolib-org/RadioBoards)
// and are using one of the supported boards, you can do the following:
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// how often to send an uplink - consider legal & FUP constraints - see notes
const uint32_t uplinkIntervalSeconds = 5UL * 60UL; // minutes x seconds
// joinEUI - previous versions of LoRaWAN called this AppEUI
// for development purposes you can use all zeros - see wiki for details
#define RADIOLIB_LORAWAN_JOIN_EUI 0x0000000000000000
// the Device EUI & two keys can be generated on the TTN console
#ifndef RADIOLIB_LORAWAN_DEV_EUI // Replace with your Device EUI
#define RADIOLIB_LORAWAN_DEV_EUI 0x---------------
#endif
#ifndef RADIOLIB_LORAWAN_APP_KEY // Replace with your App Key
#define RADIOLIB_LORAWAN_APP_KEY 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--
#endif
#ifndef RADIOLIB_LORAWAN_NWK_KEY // Put your Nwk Key here
#define RADIOLIB_LORAWAN_NWK_KEY 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--
#endif
// for the curious, the #ifndef blocks allow for automated testing &/or you can
// put your EUI & keys in to your platformio.ini - see wiki for more tips
// regional choices: EU868, US915, AU915, AS923, AS923_2, AS923_3, AS923_4, IN865, KR920, CN470
const LoRaWANBand_t Region = EU868;
// 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 ...
// copy over the EUI's & keys in to the something that will not compile if incorrectly formatted
uint64_t joinEUI = RADIOLIB_LORAWAN_JOIN_EUI;
uint64_t devEUI = RADIOLIB_LORAWAN_DEV_EUI;
uint8_t appKey[] = { RADIOLIB_LORAWAN_APP_KEY };
uint8_t nwkKey[] = { RADIOLIB_LORAWAN_NWK_KEY };
// create the LoRaWAN node
LoRaWANNode node(&radio, &Region, subBand);
// result code to text - these are error codes that can be raised when using LoRaWAN
// however, RadioLib has many more - see https://jgromes.github.io/RadioLib/group__status__codes.html for a complete list
String stateDecode(const int16_t result) {
switch (result) {
case RADIOLIB_ERR_NONE:
return "ERR_NONE";
case RADIOLIB_ERR_CHIP_NOT_FOUND:
return "ERR_CHIP_NOT_FOUND";
case RADIOLIB_ERR_PACKET_TOO_LONG:
return "ERR_PACKET_TOO_LONG";
case RADIOLIB_ERR_RX_TIMEOUT:
return "ERR_RX_TIMEOUT";
case RADIOLIB_ERR_CRC_MISMATCH:
return "ERR_CRC_MISMATCH";
case RADIOLIB_ERR_INVALID_BANDWIDTH:
return "ERR_INVALID_BANDWIDTH";
case RADIOLIB_ERR_INVALID_SPREADING_FACTOR:
return "ERR_INVALID_SPREADING_FACTOR";
case RADIOLIB_ERR_INVALID_CODING_RATE:
return "ERR_INVALID_CODING_RATE";
case RADIOLIB_ERR_INVALID_FREQUENCY:
return "ERR_INVALID_FREQUENCY";
case RADIOLIB_ERR_INVALID_OUTPUT_POWER:
return "ERR_INVALID_OUTPUT_POWER";
case RADIOLIB_ERR_NETWORK_NOT_JOINED:
return "RADIOLIB_ERR_NETWORK_NOT_JOINED";
case RADIOLIB_ERR_DOWNLINK_MALFORMED:
return "RADIOLIB_ERR_DOWNLINK_MALFORMED";
case RADIOLIB_ERR_INVALID_REVISION:
return "RADIOLIB_ERR_INVALID_REVISION";
case RADIOLIB_ERR_INVALID_PORT:
return "RADIOLIB_ERR_INVALID_PORT";
case RADIOLIB_ERR_NO_RX_WINDOW:
return "RADIOLIB_ERR_NO_RX_WINDOW";
case RADIOLIB_ERR_INVALID_CID:
return "RADIOLIB_ERR_INVALID_CID";
case RADIOLIB_ERR_UPLINK_UNAVAILABLE:
return "RADIOLIB_ERR_UPLINK_UNAVAILABLE";
case RADIOLIB_ERR_COMMAND_QUEUE_FULL:
return "RADIOLIB_ERR_COMMAND_QUEUE_FULL";
case RADIOLIB_ERR_COMMAND_QUEUE_ITEM_NOT_FOUND:
return "RADIOLIB_ERR_COMMAND_QUEUE_ITEM_NOT_FOUND";
case RADIOLIB_ERR_JOIN_NONCE_INVALID:
return "RADIOLIB_ERR_JOIN_NONCE_INVALID";
case RADIOLIB_ERR_N_FCNT_DOWN_INVALID:
return "RADIOLIB_ERR_N_FCNT_DOWN_INVALID";
case RADIOLIB_ERR_A_FCNT_DOWN_INVALID:
return "RADIOLIB_ERR_A_FCNT_DOWN_INVALID";
case RADIOLIB_ERR_DWELL_TIME_EXCEEDED:
return "RADIOLIB_ERR_DWELL_TIME_EXCEEDED";
case RADIOLIB_ERR_CHECKSUM_MISMATCH:
return "RADIOLIB_ERR_CHECKSUM_MISMATCH";
case RADIOLIB_ERR_NO_JOIN_ACCEPT:
return "RADIOLIB_ERR_NO_JOIN_ACCEPT";
case RADIOLIB_LORAWAN_SESSION_RESTORED:
return "RADIOLIB_LORAWAN_SESSION_RESTORED";
case RADIOLIB_LORAWAN_NEW_SESSION:
return "RADIOLIB_LORAWAN_NEW_SESSION";
case RADIOLIB_ERR_NONCES_DISCARDED:
return "RADIOLIB_ERR_NONCES_DISCARDED";
case RADIOLIB_ERR_SESSION_DISCARDED:
return "RADIOLIB_ERR_SESSION_DISCARDED";
}
return "See https://jgromes.github.io/RadioLib/group__status__codes.html";
}
// helper function to display any issues
void debug(bool failed, const __FlashStringHelper* message, int state, bool halt) {
if(failed) {
Serial.print(message);
Serial.print(" - ");
Serial.print(stateDecode(state));
Serial.print(" (");
Serial.print(state);
Serial.println(")");
while(halt) { delay(1); }
}
}
// helper function to display a byte array
void arrayDump(uint8_t *buffer, uint16_t len) {
for(uint16_t c = 0; c < len; c++) {
char b = buffer[c];
if(b < 0x10) { Serial.print('0'); }
Serial.print(b, HEX);
}
Serial.println();
}
// Custom delay function:
// Communication over LoRaWAN includes a lot of delays.
// By default, RadioLib will use the Arduino delay() function,
// which will waste a lot of power. However, you can put your
// microcontroller to sleep instead by customizing the function below,
// and providing it to RadioLib via "node.setSleepFunction".
// NOTE: You ahve to ensure that this function is timed precisely, and
// does actually wait for the amount of time specified!
// Failure to do so will result in missed downlinks or failed join!
void customDelay(RadioLibTime_t ms) {
// this is just an example, so we use the Arduino delay() function,
// but you can put your microcontroller to sleep here
::delay(ms);
}
#endif

View file

@ -0,0 +1,82 @@
/*
RadioLib LoRaWAN Starter Example
! Please refer to the included notes to get started !
This example joins a LoRaWAN network and will send
uplink packets. Before you start, you will have to
register your device at https://www.thethingsnetwork.org/
After your device is registered, you can run this example.
The device will join the network and start uploading data.
Running this examples REQUIRES you to check "Resets DevNonces"
on your LoRaWAN dashboard. Refer to the network's
documentation on how to do this.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For LoRaWAN details, see the wiki page
https://github.com/jgromes/RadioLib/wiki/LoRaWAN
*/
#include "config.h"
void setup() {
Serial.begin(115200);
while(!Serial);
delay(5000); // Give time to switch to the serial monitor
Serial.println(F("\nSetup ... "));
Serial.println(F("Initialise the radio"));
int16_t state = radio.begin();
debug(state != RADIOLIB_ERR_NONE, F("Initialise radio failed"), state, true);
// Setup the OTAA session information
state = node.beginOTAA(joinEUI, devEUI, nwkKey, appKey);
debug(state != RADIOLIB_ERR_NONE, F("Initialise node failed"), state, true);
Serial.println(F("Join ('login') the LoRaWAN Network"));
state = node.activateOTAA();
debug(state != RADIOLIB_LORAWAN_NEW_SESSION, F("Join failed"), state, true);
Serial.println(F("Ready!\n"));
}
void loop() {
Serial.println(F("Sending uplink"));
// This is the place to gather the sensor inputs
// Instead of reading any real sensor, we just generate some random numbers as example
uint8_t value1 = radio.random(100);
uint16_t value2 = radio.random(2000);
// Build payload byte array
uint8_t uplinkPayload[3];
uplinkPayload[0] = value1;
uplinkPayload[1] = highByte(value2); // See notes for high/lowByte functions
uplinkPayload[2] = lowByte(value2);
// Perform an uplink
int16_t state = node.sendReceive(uplinkPayload, sizeof(uplinkPayload));
debug(state < RADIOLIB_ERR_NONE, F("Error in sendReceive"), state, false);
// Check if a downlink was received
// (state 0 = no downlink, state 1/2 = downlink in window Rx1/Rx2)
if(state > 0) {
Serial.println(F("Received a downlink"));
} else {
Serial.println(F("No downlink received"));
}
Serial.print(F("Next uplink in "));
Serial.print(uplinkIntervalSeconds);
Serial.println(F(" seconds\n"));
// Wait until next uplink - observing legal & TTN FUP constraints
delay(uplinkIntervalSeconds * 1000UL); // delay needs milli-seconds
}

View file

@ -0,0 +1,147 @@
#ifndef _RADIOLIB_EX_LORAWAN_CONFIG_H
#define _RADIOLIB_EX_LORAWAN_CONFIG_H
#include <RadioLib.h>
// first you have to set your radio model and pin configuration
// this is provided just as a default example
SX1278 radio = new Module(10, 2, 9, 3);
// if you have RadioBoards (https://github.com/radiolib-org/RadioBoards)
// and are using one of the supported boards, you can do the following:
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// how often to send an uplink - consider legal & FUP constraints - see notes
const uint32_t uplinkIntervalSeconds = 5UL * 60UL; // minutes x seconds
// joinEUI - previous versions of LoRaWAN called this AppEUI
// for development purposes you can use all zeros - see wiki for details
#define RADIOLIB_LORAWAN_JOIN_EUI 0x0000000000000000
// the Device EUI & two keys can be generated on the TTN console
#ifndef RADIOLIB_LORAWAN_DEV_EUI // Replace with your Device EUI
#define RADIOLIB_LORAWAN_DEV_EUI 0x---------------
#endif
#ifndef RADIOLIB_LORAWAN_APP_KEY // Replace with your App Key
#define RADIOLIB_LORAWAN_APP_KEY 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--
#endif
#ifndef RADIOLIB_LORAWAN_NWK_KEY // Put your Nwk Key here
#define RADIOLIB_LORAWAN_NWK_KEY 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--
#endif
// for the curious, the #ifndef blocks allow for automated testing &/or you can
// put your EUI & keys in to your platformio.ini - see wiki for more tips
// regional choices: EU868, US915, AU915, AS923, AS923_2, AS923_3, AS923_4, IN865, KR920, CN470
const LoRaWANBand_t Region = EU868;
// 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 ...
// copy over the EUI's & keys in to the something that will not compile if incorrectly formatted
uint64_t joinEUI = RADIOLIB_LORAWAN_JOIN_EUI;
uint64_t devEUI = RADIOLIB_LORAWAN_DEV_EUI;
uint8_t appKey[] = { RADIOLIB_LORAWAN_APP_KEY };
uint8_t nwkKey[] = { RADIOLIB_LORAWAN_NWK_KEY };
// create the LoRaWAN node
LoRaWANNode node(&radio, &Region, subBand);
// result code to text - these are error codes that can be raised when using LoRaWAN
// however, RadioLib has many more - see https://jgromes.github.io/RadioLib/group__status__codes.html for a complete list
String stateDecode(const int16_t result) {
switch (result) {
case RADIOLIB_ERR_NONE:
return "ERR_NONE";
case RADIOLIB_ERR_CHIP_NOT_FOUND:
return "ERR_CHIP_NOT_FOUND";
case RADIOLIB_ERR_PACKET_TOO_LONG:
return "ERR_PACKET_TOO_LONG";
case RADIOLIB_ERR_RX_TIMEOUT:
return "ERR_RX_TIMEOUT";
case RADIOLIB_ERR_CRC_MISMATCH:
return "ERR_CRC_MISMATCH";
case RADIOLIB_ERR_INVALID_BANDWIDTH:
return "ERR_INVALID_BANDWIDTH";
case RADIOLIB_ERR_INVALID_SPREADING_FACTOR:
return "ERR_INVALID_SPREADING_FACTOR";
case RADIOLIB_ERR_INVALID_CODING_RATE:
return "ERR_INVALID_CODING_RATE";
case RADIOLIB_ERR_INVALID_FREQUENCY:
return "ERR_INVALID_FREQUENCY";
case RADIOLIB_ERR_INVALID_OUTPUT_POWER:
return "ERR_INVALID_OUTPUT_POWER";
case RADIOLIB_ERR_NETWORK_NOT_JOINED:
return "RADIOLIB_ERR_NETWORK_NOT_JOINED";
case RADIOLIB_ERR_DOWNLINK_MALFORMED:
return "RADIOLIB_ERR_DOWNLINK_MALFORMED";
case RADIOLIB_ERR_INVALID_REVISION:
return "RADIOLIB_ERR_INVALID_REVISION";
case RADIOLIB_ERR_INVALID_PORT:
return "RADIOLIB_ERR_INVALID_PORT";
case RADIOLIB_ERR_NO_RX_WINDOW:
return "RADIOLIB_ERR_NO_RX_WINDOW";
case RADIOLIB_ERR_INVALID_CID:
return "RADIOLIB_ERR_INVALID_CID";
case RADIOLIB_ERR_UPLINK_UNAVAILABLE:
return "RADIOLIB_ERR_UPLINK_UNAVAILABLE";
case RADIOLIB_ERR_COMMAND_QUEUE_FULL:
return "RADIOLIB_ERR_COMMAND_QUEUE_FULL";
case RADIOLIB_ERR_COMMAND_QUEUE_ITEM_NOT_FOUND:
return "RADIOLIB_ERR_COMMAND_QUEUE_ITEM_NOT_FOUND";
case RADIOLIB_ERR_JOIN_NONCE_INVALID:
return "RADIOLIB_ERR_JOIN_NONCE_INVALID";
case RADIOLIB_ERR_N_FCNT_DOWN_INVALID:
return "RADIOLIB_ERR_N_FCNT_DOWN_INVALID";
case RADIOLIB_ERR_A_FCNT_DOWN_INVALID:
return "RADIOLIB_ERR_A_FCNT_DOWN_INVALID";
case RADIOLIB_ERR_DWELL_TIME_EXCEEDED:
return "RADIOLIB_ERR_DWELL_TIME_EXCEEDED";
case RADIOLIB_ERR_CHECKSUM_MISMATCH:
return "RADIOLIB_ERR_CHECKSUM_MISMATCH";
case RADIOLIB_ERR_NO_JOIN_ACCEPT:
return "RADIOLIB_ERR_NO_JOIN_ACCEPT";
case RADIOLIB_LORAWAN_SESSION_RESTORED:
return "RADIOLIB_LORAWAN_SESSION_RESTORED";
case RADIOLIB_LORAWAN_NEW_SESSION:
return "RADIOLIB_LORAWAN_NEW_SESSION";
case RADIOLIB_ERR_NONCES_DISCARDED:
return "RADIOLIB_ERR_NONCES_DISCARDED";
case RADIOLIB_ERR_SESSION_DISCARDED:
return "RADIOLIB_ERR_SESSION_DISCARDED";
}
return "See https://jgromes.github.io/RadioLib/group__status__codes.html";
}
// helper function to display any issues
void debug(bool failed, const __FlashStringHelper* message, int state, bool halt) {
if(failed) {
Serial.print(message);
Serial.print(" - ");
Serial.print(stateDecode(state));
Serial.print(" (");
Serial.print(state);
Serial.println(")");
while(halt) { delay(1); }
}
}
// helper function to display a byte array
void arrayDump(uint8_t *buffer, uint16_t len) {
for(uint16_t c = 0; c < len; c++) {
char b = buffer[c];
if(b < 0x10) { Serial.print('0'); }
Serial.print(b, HEX);
}
Serial.println();
}
#endif

View file

@ -0,0 +1,180 @@
# RadioLib LoRaWAN on TTN starter script
## Welcome
These notes are for someone who has successfully created a few sketches for their Arduino based device but is starting out with LoRaWAN. You don't have to be a C coding ninja but some familarity with C and procedural programming is assumed. The absolutely simplest way to get started is to buy some known good hardware that's all done for you so you can concentrate on the code & configuration.
## Introduction
LoRaWAN is an amazing system for small battery powered sensors collecting data for years at a time. With great features comes some more complex elements which means it is not quite as simple as just providing WiFi credentials and pushing data through. It is in the range of setting up & customising the settings for a home router but with no wizards to do the heavy lifting for you. So we strongly recommend spending a couple of hours reviewing the TTN Getting Started section so you are aware of the minimum knowledge to make a successful start: https://www.thethingsnetwork.org/docs/lorawan/. Johan's video is amazing but is also drinking from the firehose. Read the text first and then watch the video on Youtube where there are bookmarks to deliver it in small digestable chunks.
These notes plus a lot more are available in the wiki: https://github.com/jgromes/RadioLib/wiki/LoRaWAN
For questions about using RadioLib there is the discussions section (https://github.com/jgromes/RadioLib/discussions) and if you believe you've found an issue (aka bug), the issues section (https://github.com/jgromes/RadioLib/issues). If posting an issue please ensure you tell us what hardware you are using and provide a debug log - make sure you enable `RADIOLIB_DEBUG_PROTOCOL`. If the question is more LoRaWAN or firmware related, then you can use the TTN forum: https://www.thethingsnetwork.org/forum/
## Register & setup on TTN
This sketch isn't particularly aimed at The Things Stack (TTS) but you can get a free Sandbox account and the following instructions are for that. Helium does not support LoRaWAN v1.1 which is the version implemented by RadioLib. Chirpstack & other LoRaWAN Network Server (LNS) stacks have not yet been tried so YMMV.
Why no screen shots? TTS is a web based app, one that you will need to become familiar with and we will need to direct you to some of the less obvious parts. So much better that you learn the layouts in concept than slavishly follow screen shots that can & will go stale.
There will be some instructions that you have to take on face value. You didn't learn to run before you walked and it's so much more encouraging to get started and build on success than get bogged down in endless details. Once you are up & running more of the details start to slot in to place.
### Register on TTN
Go to https://www.thethingsnetwork.org/get-started and register - just like any other website. These instructions are for TTS Sandbox.
Once you have confirmed your email address, you can login to the console here: https://console.cloud.thethings.network/. If you allow your browser to share your location the best console will be selected. For most users the best one is the obvious one, if you have any doubts you can ask on the forum here: https://www.thethingsnetwork.org/forum/ - you login with the exact same details.
It is simpler to register your gateway first. If you don't have a gateway, then a The Things Indoor Gateway (TTIG) is a very affordable option. A gateway gives you a console to see if your device is being heard and is hugely useful when debugging a DIY device. If you are in range of a community gateway you may be lucky with your first device creation but you will never know if you are in range unless you have access to that gateway's console.
You can read up on key concepts and troubleshooting here: https://www.thethingsindustries.com/docs/gateways/
LoRa stands for Long Range - having the gateway & device on the same desk tends to overload both receiver circuits when they hear a transmission so close to hand. The gateway should be 5 - 10m away, preferably with a solid wall in the way as well.
### Create your application
An application is like a box to keep some devices in - normally doing the same thing - on larger deployments this may be 1,000's of similar devices. Starting out it is likely to be just a few so there is no need to get concerned about how to divide up your use just yet.
Onced logged in to the console you can go in to Applications to create your first application. The ID must be all lower case or numbers, no spaces, dashes are OK and it has to be unique to the entire TTN community - so `first-app` will be rejected - you could use `your-username-first-app` as that's likely to be unique. The name and description are for your own use and are optional.
The main menu for an application is in the left hand panel - nothing is needed there just yet.
### Create your device
On the right hand side about half way down on your application's summary is a big blue button `+ Register end device`. Click this to create the settings for your first device.
You are making your own device using a third party LoRaWAN stack so there will not be an entry in the device repository so choose 'Enter end device specifics manually'.
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 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.
Your End device ID can be changed to make the device more identifiable. Something related to your hardware helps - like devicename-01. The you can click the blue 'Register device'.
When many sensors are big deployed, a device is registered, batteries put in, it joins and gets on with sending data for the next few years. For development purposes we need to turn off one of the security settings so that you can join & uplink out of the normal sequence that a device in the field would do.
Click on General Settings, scroll down to Join settings, click the Expand button, scroll down and click the 'Resets join nonces' option. You will see a warning about replay attacks which is entirely proper & correct. If anyone eavesdropping in your area on your LoRa transmissions could fake a join and send uplinks from their device but only if they happened to find out your AppKey & NwkKey which is kept securely on the TTN servers and is never transmitted over the air, so they'd also have to login to your account, which is protected by your password.
You then need to copy over the device details in to the config file for RadioLib. There are buttons to copy items to the clipboard so you don't have to hand type them.
### Copy & Paste made easy
You can copy the EUIs & keys from the device overview section.
The EUIs are really straightforward - click the clipboard icon at the right hand end of the EUI display field and it will be copied in the format you need. You can then paste it in to the code - you must leave the 0x in place so the compiler knows that it's a hex value.
The keys are relatively straightforward. Click the eye icon at the right hand end of the field. Then click the <> icon that will appear to the left. This will format the hex values as an array. Then you can click the clipboard icon to copy the array and then paste it between the { } brackets.
### Secrets to keep safe.
The Join & Dev EUI's are transmitted in plain text when the device joins a network. The gateway ID is public. If you have an issue and are asked for details, there are only three things to keep private - your password, the keys which are used for encryption and any API keys you create which are used for accessing your data & configuration.
### Monitoring your device
If you are on your application summary page you'll see uplinks in the small activity box top right with a link to the full size table. If you click the Live Data menu item on the left it will show activity for all the devices registered on the application in the full window.
If you just want your devices activity, from the summary page click on the device in the list in the middle of the page.
The main menu for a device is the horizontal band: Overview, Live Data, Messaging etc. You can click Live Data or the link above the small activity box.
**The console shows LIVE data - not a history of everything that has ever happened. A LNS is a management & relay service, not a database. When you open the console you may see a summary of recent activity - this is a bonus. You must leave the console open, even in another tab, if you want to see live activity.**
### Explore
Nothing on the console can be upset unless you confirm a warning message, so you are safe to explore the different menus to orientate yourself. This is very good idea so you have an understanding of the layout of the land and shouldn't take more than 10 or 15 minutes. The documentation & volunteers on GitHub and the TTN forum will make refer to parts of the console without giving blow by blow directions.
## The config.h
### The uplinkInterval
LoRaWAN devices typically send small amounts of data at intervals between 15 minutes through to once per day. This allows a device to run on two AA batteries for 2 to 5 years. Hoping that LoRaWAN can move lots of data and your device can regularly receive commands to do something on demand is trying to bend the LoRaWAN system in ways it is not designed for and usually ends up with far too many issues to unravel.
The radio frequencies that are used are usually shared with other Industrial, Scientific & Medical, known as ISM, users. The LoRa modulation is particularly resistant to interference due to other simultaneous transmissions on the same frequency but too much local activity will mean that not all uplinks get through. The Things Industries suggest designing a system to a potential packet loss rate of 10%. Typically we see 1 or 2% loss. This is entirely down to shared use of the radio waves, once an uplink is heard by a gateway the system is super reliable through The Things Stack.
To ensure that the shared ISM bands are fairly used there are limits defined in law on how often you can transmit, called Duty Cycle. The details vary by region or country but typically you can only transmit for 1% of the time. Some frequencies you can only use 0.1% of the time. See https://www.thethingsnetwork.org/docs/lorawan/duty-cycle/ for more information.
Additionally, as The Things Stack Sandbox aka TTN is an array of servers in three locations around the world paid for by The Things Industries, there is a Fair Use Policy so that those learning LoRaWAN, communities, hobbyists & makers are guided on how much of the resource any one device can use. In short, it's 30 seconds of airtime a day and 10 downlinks. When a gateway is transmitting a downlink it can not hear any uplinks (contributing to the potential uplink loss outlined above). The community consensus is that 1 downlink a fortnight to update or adjust settings is appropriate. See https://www.thethingsnetwork.org/docs/lorawan/duty-cycle/#fair-use-policy for more information.
You can see what intervals can be used with this interactive calculator: https://avbentem.github.io/airtime-calculator/ttn/. Devices further away from gateways will have to use a higher Spread Factor to be heard - do not assume everything will happen at SF7. An uplink takes a minimum of 6 seconds from start to end, sometimes longer if the device is further away from the gateway, so you will need to be patient for just a short while whilst waiting for feedback after seeing "Sending uplink"
With all these considerations, trying to use LoRaWAN for command & control isn't appropriate and realtime GPS tracking almost always breaches FUP and usually legal limits, leaving aside the challenges of coverage.
See the hints & tips section on testing your device.
### EUI's & Keys
In the `config.h` towards the top there are four lines thus:
// replace-with-your-device-id
uint64_t joinEUI = 0x0000000000000000;
uint64_t devEUI = 0x0000000000000000;
uint8_t appKey[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
uint8_t nwkKey[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
On the TTN console on the device summary page, click the clipboard icon next to the DevEUI, highlight the 16 0's in the third line after the x and paste.
The devEUI must start with 0x and will end up looking something like 0x70B3D57ED006544E
For the appKey we need TTN to format it correctly. Click the eye icon and an extra icon will appear <> - click this and the key will be formatted for you. Click the clipboard icon and then paste over the 32 0x00's in the config file. Then do the same for nwkKey.
A key will end up something like 0x31, 0x16, 0x6A, 0x22, 0x97, 0x52, 0xB6, 0x34, 0x57, 0x45, 0x1B, 0xC3, 0xC9, 0xD8, 0x83, 0xE8
### Region
The region value you use MUST match the one you selected on the console.
If you are using US915 or AU915 then you should change the subBand const to 2.
### The pinmap
This is the connection between your microcontroller (ESP32, ATmega, SAMD etc.) and the radio (SX1276, SX1262, LR1110 etc.).
You have to select the correct module and set the correct pins.
Pin maps for commonly used radio modules are kept in a separate library, called RadioBoards: https://github.com/radiolib-org/RadioBoards
It can automatically detect your microcontroller platform and radio, and configure things for you. If you have a board that is not supported by RadioBoards, feel free to suggest it in the RadioBoards issues, or better yet - open a pull request there!
## Observations on the main sketch
Most of the sketch has comments that tell you what the various parts are doing. This should add a little more info:
### The Join
When a device is first started, it needs to register with the LoRaWAN Network Server (LNS) and setup it's session. With the settings from the console copied over and a gateway an appropriate distance away, most of the time the join will 'just work'.
If it doesn't, then there is no point trying repeatedly without going through the troubleshootng sequence. So this starter sketch will try once only to save the airwaves & TTN Community servers from repeated misfires.
### The payload
You may see other starter sketches sending text. Apart from being massively inefficient, the text isn't easily displayed on the TTN console which makes it rather pointless and pro embedded engineers don't send strings. So this sketch sends the data as a sequence of bytes as recommended.
Further reading on this can be found here, just ignore the pink message about v2, it's all still valid: https://www.thethingsnetwork.org/docs/devices/bytes/
We've not assumed anything about any sensors you have, so we are just reading a digital & an analog pin. An analog reading is typically a two byte value - an integer - this is split using the Arduino highByte & lowByte function. You'll see how we put it back together in the TTN console below.
## TTN Console Payload Decoder
Coming soon
## Hints & Tips
### Device testing
The LoRaWAN code base works to a specification and once you are happy your device is able to join & send a few dozen uplinks, continuing to sit around waiting for an uplink to test your sensor code & payload format is a waste of your time. The solution is to write everything else in a different sketch, output the array to the serial console and then you can copy & paste the hex array in to the TTN console Payload Formatters section to test the decoding.

View file

@ -0,0 +1,37 @@
# LoRaWAN examples
RadioLib LoRaWAN examples.
* [LoRaWAN_Starter](https://github.com/jgromes/RadioLib/tree/master/examples/LoRaWAN/LoRaWAN_Starter): this is the recommended entry point for new users. Please read the [`notes`](https://github.com/jgromes/RadioLib/blob/master/examples/LoRaWAN/LoRaWAN_Starter/notes.md) that come with this example to learn more about LoRaWAN and how to use it in RadioLib!
* [LoRaWAN_Reference](https://github.com/jgromes/RadioLib/tree/master/examples/LoRaWAN/LoRaWAN_Reference): this sketch showcases most of the available API for LoRaWAN in RadioLib. Be frightened by the possibilities! It is recommended you have read all the [`notes`](https://github.com/jgromes/RadioLib/blob/master/examples/LoRaWAN/LoRaWAN_Starter/notes.md) for the Starter sketch first, as well as the [Learn section on The Things Network](https://www.thethingsnetwork.org/docs/lorawan/)!
* [LoRaWAN_ABP](https://github.com/jgromes/RadioLib/tree/master/examples/LoRaWAN/LoRaWAN_ABP): if you wish to use ABP instead of OTAA (but why?), this example shows how you can do this using RadioLib.
## LoRaWAN versions & regional parameters
RadioLib implements both LoRaWAN Specification 1.1 and 1.0.4. Confusingly, 1.0.4 is newer than 1.1, but 1.1 includes more security checks and as such **LoRaWAN 1.1 is preferred**.
The catch is in the Regional Parameters: as RP002 1.0.4 is newer than RP001 1.1, it is more up to date regarding local laws & regulations. Therefore, RadioLib implements 1.0.4 as baseline and 1.1 (revision B) as fallback, and as such **RP002 Regional Parameters 1.0.4 is preferred**.
_Note: the CN470 band is implemented as specified in RP001 1.1 revision B, as the RP002 1.0.4 version is much too complex._
To activate a LoRaWAN 1.1 session, supply all the required keys:
```cpp
node.beginOTAA(joinEUI, devEUI, nwkKey, appKey);
node.beginABP(devAddr, fNwkSIntKey, sNwkSIntKey, nwkSEncKey, appSKey);
```
To activate a LoRaWAN 1.0.4 session, set the keys that are not available to `NULL`:
```cpp
node.beginOTAA(joinEUI, devEUI, NULL, appKey);
node.beginABP(devAddr, NULL, NULL, nwkSEncKey, appSKey);
```
The device doesn't need to know the Regional Parameters version - that is of importance on the console.
## LoRaWAN persistence
> [!WARNING]
> These examples do not 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 1.1. Examples are (or will become) available for some of the most popular platforms. **These examples assume you have successfully used the Starter sketch and understood (most of) the accompanying notes!**
Currently, examples are available for the following platforms:
* [LoRaWAN for ESP32](https://github.com/radiolib-org/radiolib-persistence/tree/main/examples/LoRaWAN_ESP32)
* [LoRaWAN for ESP8266](https://github.com/radiolib-org/radiolib-persistence/tree/main/examples/LoRaWAN_ESP8266)
_This list is last updated at 30/03/2024._

View file

@ -0,0 +1,119 @@
/*
RadioLib SX127x Morse Receive AM Example
This example receives Morse code message using
SX1278's FSK modem. The signal is expected to be
modulated as OOK, to be demodulated in AM mode.
Other modules that can be used for Morse Code
with AFSK modulation:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// SX1278 has the following connections:
// NSS pin: 10
// DIO0 pin: 2
// RESET pin: 9
// DIO1 pin: 3
SX1278 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();
*/
// create AFSK client instance using the FSK module
// pin 5 is connected to SX1278 DIO2
AFSKClient audio(&radio, 5);
// create Morse client instance using the AFSK instance
MorseClient morse(&audio);
void setup() {
Serial.begin(9600);
// initialize SX1278 with default settings
Serial.print(F("[SX1278] Initializing ... "));
int state = radio.beginFSK();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// when using one of the non-LoRa modules for Morse code
// (RF69, CC1101, Si4432 etc.), use the basic begin() method
// int state = radio.begin();
// initialize Morse client
Serial.print(F("[Morse] Initializing ... "));
// AFSK tone frequency: 400 Hz
// speed: 20 words per minute
state = morse.begin(400);
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// after that, set mode to OOK to emulate AM modulation
Serial.print(F("[SX1278] Switching to OOK ... "));
state = radio.setOOK(true);
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// start direct mode reception
radio.receiveDirect();
}
// save symbol and length between loops
byte symbol = 0;
byte len = 0;
void loop() {
// try to read a new symbol
int state = morse.read(&symbol, &len);
// check if we have something to decode
if(state != RADIOLIB_MORSE_INTER_SYMBOL) {
// decode and print
Serial.print(MorseClient::decode(symbol, len));
// reset the symbol buffer
symbol = 0;
len = 0;
// check if we have a complete word
if(state == RADIOLIB_MORSE_WORD_COMPLETE) {
// inter-word space, interpret that as a new line
Serial.println();
}
}
}

View file

@ -0,0 +1,135 @@
/*
RadioLib Morse Transmit AM Example
This example sends Morse code message using
SX1278's FSK modem. The signal is modulated
as OOK, and may be demodulated in AM mode.
Other modules that can be used for Morse Code
with AM modulation:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// SX1278 has the following connections:
// NSS pin: 10
// DIO0 pin: 2
// RESET pin: 9
// DIO1 pin: 3
SX1278 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();
*/
// create AFSK client instance using the FSK module
// pin 5 is connected to SX1278 DIO2
AFSKClient audio(&radio, 5);
// create Morse client instance using the AFSK instance
MorseClient morse(&audio);
void setup() {
Serial.begin(9600);
// initialize SX1278 with default settings
Serial.print(F("[SX1278] Initializing ... "));
int state = radio.beginFSK();
// when using one of the non-LoRa modules for Morse code
// (RF69, CC1101, Si4432 etc.), use the basic begin() method
// int state = radio.begin();
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// initialize Morse client
Serial.print(F("[Morse] Initializing ... "));
// tone frequency: 400 Hz
// speed: 20 words per minute
state = morse.begin(400);
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// after that, set mode to OOK to emulate AM modulation
Serial.print(F("[SX1278] Switching to OOK ... "));
state = radio.setOOK(true);
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
}
void loop() {
Serial.print(F("[Morse] Sending Morse data ... "));
// MorseClient supports all methods of the Serial class
// NOTE: Characters that do not have ITU-R M.1677-1
// representation will not be sent! Lower case
// letters will be capitalized.
// send start signal first
morse.startSignal();
// Arduino String class
String aStr = "Arduino String";
morse.print(aStr);
// character array (C-String)
morse.print("C-String");
// string saved in flash
morse.print(F("Flash String"));
// character
morse.print('c');
// byte
// formatting DEC/HEX/OCT/BIN is supported for
// any integer type (byte/int/long)
morse.print(255, HEX);
// integer number
int i = 1000;
morse.print(i);
// floating point number
// NOTE: When using println(), the transmission will be
// terminated with end-of-work signal (...-.-).
float f = -3.1415;
morse.println(f, 3);
Serial.println(F("done!"));
// wait for a second before transmitting again
delay(1000);
}

View file

@ -1,23 +1,24 @@
/*
RadioLib Morse Transmit AFSK Example
RadioLib Morse Transmit AFSK Example
This example sends Morse code message using
SX1278's FSK modem. The data is modulated
as AFSK.
This example sends Morse code message using
SX1278's FSK modem. The signal is modulated
as AFSK, and may be demodulated in FM mode.
Other modules that can be used for Morse Code
with AFSK modulation:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
Other modules that can be used for Morse Code
with AFSK modulation:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
- SX126x/LLCC68
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -30,12 +31,23 @@
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//SX1278 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// create AFSK client instance using the FSK module
// pin 5 is connected to SX1278 DIO2
// this requires connection to the module direct
// input pin, here connected to Arduino pin 5
// SX127x/RFM9x: DIO2
// RF69: DIO2
// SX1231: DIO2
// CC1101: GDO2
// Si443x/RFM2x: GPIO
// SX126x/LLCC68: DIO2
AFSKClient audio(&radio, 5);
// create Morse client instance using the AFSK instance
@ -57,12 +69,12 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
// initialize Morse client
Serial.print(F("[Morse] Initializing ... "));
// AFSK tone frequency: 400 MHz
// tone frequency: 400 Hz
// speed: 20 words per minute
state = morse.begin(400);
if(state == RADIOLIB_ERR_NONE) {
@ -70,7 +82,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while(true);
while (true) { delay(10); }
}
}

View file

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

View file

@ -0,0 +1,3 @@
# generated by ESP-IDF
managed_components/
dependencies.lock

View file

@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.16)
# include the top-level cmake
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
# name the project something nice
project(esp-sx1261)

View file

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

View file

@ -0,0 +1,4 @@
# register the component and set "RadioLib", "esp_timer" and "driver" as required
idf_component_register(SRCS "main.cpp"
INCLUDE_DIRS "."
REQUIRES RadioLib esp_timer driver)

View file

@ -0,0 +1,322 @@
#ifndef ESP_HAL_H
#define ESP_HAL_H
// include RadioLib
#include <RadioLib.h>
// this example only works on ESP32 and is unlikely to work on ESP32S2/S3 etc.
// if you need high portability, you should probably use Arduino anyway ...
#if CONFIG_IDF_TARGET_ESP32 == 0
#error This example HAL only supports ESP32 targets. Support for ESP32S2/S3 etc. can be added by adjusting this file to user needs.
#endif
// include all the dependencies
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp32/rom/gpio.h"
#include "soc/rtc.h"
#include "soc/dport_reg.h"
#include "soc/spi_reg.h"
#include "soc/spi_struct.h"
#include "driver/gpio.h"
#include "hal/gpio_hal.h"
#include "esp_timer.h"
#include "esp_log.h"
// define Arduino-style macros
#define LOW (0x0)
#define HIGH (0x1)
#define INPUT (0x01)
#define OUTPUT (0x03)
#define RISING (0x01)
#define FALLING (0x02)
#define NOP() asm volatile ("nop")
#define MATRIX_DETACH_OUT_SIG (0x100)
#define MATRIX_DETACH_IN_LOW_PIN (0x30)
// all of the following is needed to calculate SPI clock divider
#define ClkRegToFreq(reg) (apb_freq / (((reg)->clkdiv_pre + 1) * ((reg)->clkcnt_n + 1)))
typedef union {
uint32_t value;
struct {
uint32_t clkcnt_l: 6;
uint32_t clkcnt_h: 6;
uint32_t clkcnt_n: 6;
uint32_t clkdiv_pre: 13;
uint32_t clk_equ_sysclk: 1;
};
} spiClk_t;
uint32_t getApbFrequency() {
rtc_cpu_freq_config_t conf;
rtc_clk_cpu_freq_get_config(&conf);
if(conf.freq_mhz >= 80) {
return(80 * MHZ);
}
return((conf.source_freq_mhz * MHZ) / conf.div);
}
uint32_t spiFrequencyToClockDiv(uint32_t freq) {
uint32_t apb_freq = getApbFrequency();
if(freq >= apb_freq) {
return SPI_CLK_EQU_SYSCLK;
}
const spiClk_t minFreqReg = { 0x7FFFF000 };
uint32_t minFreq = ClkRegToFreq((spiClk_t*) &minFreqReg);
if(freq < minFreq) {
return minFreqReg.value;
}
uint8_t calN = 1;
spiClk_t bestReg = { 0 };
int32_t bestFreq = 0;
while(calN <= 0x3F) {
spiClk_t reg = { 0 };
int32_t calFreq;
int32_t calPre;
int8_t calPreVari = -2;
reg.clkcnt_n = calN;
while(calPreVari++ <= 1) {
calPre = (((apb_freq / (reg.clkcnt_n + 1)) / freq) - 1) + calPreVari;
if(calPre > 0x1FFF) {
reg.clkdiv_pre = 0x1FFF;
} else if(calPre <= 0) {
reg.clkdiv_pre = 0;
} else {
reg.clkdiv_pre = calPre;
}
reg.clkcnt_l = ((reg.clkcnt_n + 1) / 2);
calFreq = ClkRegToFreq(&reg);
if(calFreq == (int32_t) freq) {
memcpy(&bestReg, &reg, sizeof(bestReg));
break;
} else if(calFreq < (int32_t) freq) {
if(RADIOLIB_ABS(freq - calFreq) < RADIOLIB_ABS(freq - bestFreq)) {
bestFreq = calFreq;
memcpy(&bestReg, &reg, sizeof(bestReg));
}
}
}
if(calFreq == (int32_t) freq) {
break;
}
calN++;
}
return(bestReg.value);
}
// create a new ESP-IDF hardware abstraction layer
// the HAL must inherit from the base RadioLibHal class
// and implement all of its virtual methods
// this is pretty much just copied from Arduino ESP32 core
class EspHal : public RadioLibHal {
public:
// default constructor - initializes the base HAL and any needed private members
EspHal(int8_t sck, int8_t miso, int8_t mosi)
: RadioLibHal(INPUT, OUTPUT, LOW, HIGH, RISING, FALLING),
spiSCK(sck), spiMISO(miso), spiMOSI(mosi) {
}
void init() override {
// we only need to init the SPI here
spiBegin();
}
void term() override {
// we only need to stop the SPI here
spiEnd();
}
// 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;
}
gpio_hal_context_t gpiohal;
gpiohal.dev = GPIO_LL_GET_HW(GPIO_PORT_0);
gpio_config_t conf = {
.pin_bit_mask = (1ULL<<pin),
.mode = (gpio_mode_t)mode,
.pull_up_en = GPIO_PULLUP_DISABLE,
.pull_down_en = GPIO_PULLDOWN_DISABLE,
.intr_type = (gpio_int_type_t)gpiohal.dev->pin[pin].int_type,
};
gpio_config(&conf);
}
void digitalWrite(uint32_t pin, uint32_t value) override {
if(pin == RADIOLIB_NC) {
return;
}
gpio_set_level((gpio_num_t)pin, value);
}
uint32_t digitalRead(uint32_t pin) override {
if(pin == RADIOLIB_NC) {
return(0);
}
return(gpio_get_level((gpio_num_t)pin));
}
void attachInterrupt(uint32_t interruptNum, void (*interruptCb)(void), uint32_t mode) override {
if(interruptNum == RADIOLIB_NC) {
return;
}
gpio_install_isr_service((int)ESP_INTR_FLAG_IRAM);
gpio_set_intr_type((gpio_num_t)interruptNum, (gpio_int_type_t)(mode & 0x7));
// this uses function typecasting, which is not defined when the functions have different signatures
// untested and might not work
gpio_isr_handler_add((gpio_num_t)interruptNum, (void (*)(void*))interruptCb, NULL);
}
void detachInterrupt(uint32_t interruptNum) override {
if(interruptNum == RADIOLIB_NC) {
return;
}
gpio_isr_handler_remove((gpio_num_t)interruptNum);
gpio_wakeup_disable((gpio_num_t)interruptNum);
gpio_set_intr_type((gpio_num_t)interruptNum, GPIO_INTR_DISABLE);
}
void delay(unsigned long ms) override {
vTaskDelay(ms / portTICK_PERIOD_MS);
}
void delayMicroseconds(unsigned long us) override {
uint64_t m = (uint64_t)esp_timer_get_time();
if(us) {
uint64_t e = (m + us);
if(m > e) { // overflow
while((uint64_t)esp_timer_get_time() > e) {
NOP();
}
}
while((uint64_t)esp_timer_get_time() < e) {
NOP();
}
}
}
unsigned long millis() override {
return((unsigned long)(esp_timer_get_time() / 1000ULL));
}
unsigned long micros() override {
return((unsigned long)(esp_timer_get_time()));
}
long pulseIn(uint32_t pin, uint32_t state, unsigned long timeout) override {
if(pin == RADIOLIB_NC) {
return(0);
}
this->pinMode(pin, INPUT);
uint32_t start = this->micros();
uint32_t curtick = this->micros();
while(this->digitalRead(pin) == state) {
if((this->micros() - curtick) > timeout) {
return(0);
}
}
return(this->micros() - start);
}
void spiBegin() {
// enable peripheral
DPORT_SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_SPI2_CLK_EN);
DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_SPI2_RST);
// reset the control struct
this->spi->slave.trans_done = 0;
this->spi->slave.val = 0;
this->spi->pin.val = 0;
this->spi->user.val = 0;
this->spi->user1.val = 0;
this->spi->ctrl.val = 0;
this->spi->ctrl1.val = 0;
this->spi->ctrl2.val = 0;
this->spi->clock.val = 0;
this->spi->user.usr_mosi = 1;
this->spi->user.usr_miso = 1;
this->spi->user.doutdin = 1;
for(uint8_t i = 0; i < 16; i++) {
this->spi->data_buf[i] = 0x00000000;
}
// set SPI mode 0
this->spi->pin.ck_idle_edge = 0;
this->spi->user.ck_out_edge = 0;
// set bit order to MSB first
this->spi->ctrl.wr_bit_order = 0;
this->spi->ctrl.rd_bit_order = 0;
// set the clock
this->spi->clock.val = spiFrequencyToClockDiv(2000000);
// initialize pins
this->pinMode(this->spiSCK, OUTPUT);
this->pinMode(this->spiMISO, INPUT);
this->pinMode(this->spiMOSI, OUTPUT);
gpio_matrix_out(this->spiSCK, HSPICLK_OUT_IDX, false, false);
gpio_matrix_in(this->spiMISO, HSPIQ_OUT_IDX, false);
gpio_matrix_out(this->spiMOSI, HSPID_IN_IDX, false, false);
}
void spiBeginTransaction() {
// not needed - in ESP32 Arduino core, this function
// repeats clock div, mode and bit order configuration
}
uint8_t spiTransferByte(uint8_t b) {
this->spi->mosi_dlen.usr_mosi_dbitlen = 7;
this->spi->miso_dlen.usr_miso_dbitlen = 7;
this->spi->data_buf[0] = b;
this->spi->cmd.usr = 1;
while(this->spi->cmd.usr);
return(this->spi->data_buf[0] & 0xFF);
}
void spiTransfer(uint8_t* out, size_t len, uint8_t* in) {
for(size_t i = 0; i < len; i++) {
in[i] = this->spiTransferByte(out[i]);
}
}
void spiEndTransaction() {
// nothing needs to be done here
}
void spiEnd() {
// detach pins
gpio_matrix_out(this->spiSCK, MATRIX_DETACH_OUT_SIG, false, false);
gpio_matrix_in(this->spiMISO, MATRIX_DETACH_IN_LOW_PIN, false);
gpio_matrix_out(this->spiMOSI, MATRIX_DETACH_OUT_SIG, false, false);
}
private:
// the HAL can contain any additional private members
int8_t spiSCK;
int8_t spiMISO;
int8_t spiMOSI;
spi_dev_t * spi = (volatile spi_dev_t *)(DR_REG_SPI2_BASE);
};
#endif

View file

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

View file

@ -0,0 +1,67 @@
/*
RadioLib Non-Arduino ESP-IDF Example
This example shows how to use RadioLib without Arduino.
In this case, a Liligo T-BEAM (ESP32 and SX1276)
is used.
Can be used as a starting point to port RadioLib to any platform!
See this API reference page for details on the RadioLib hardware abstraction
https://jgromes.github.io/RadioLib/class_hal.html
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// include the hardware abstraction layer
#include "EspHal.h"
// create a new instance of the HAL class
EspHal* hal = new EspHal(5, 19, 27);
// now we can create the radio module
// NSS pin: 18
// DIO0 pin: 26
// NRST pin: 14
// DIO1 pin: 33
SX1276 radio = new Module(hal, 18, 26, 14, 33);
static const char *TAG = "main";
// the entry point for the program
// it must be declared as "extern C" because the compiler assumes this will be a C function
extern "C" void app_main(void) {
// initialize just like with Arduino
ESP_LOGI(TAG, "[SX1276] Initializing ... ");
int state = radio.begin();
if (state != RADIOLIB_ERR_NONE) {
ESP_LOGI(TAG, "failed, code %d\n", state);
while(true) {
hal->delay(1000);
}
}
ESP_LOGI(TAG, "success!\n");
// loop forever
for(;;) {
// send a packet
ESP_LOGI(TAG, "[SX1276] Transmitting packet ... ");
state = radio.transmit("Hello World!");
if(state == RADIOLIB_ERR_NONE) {
// the packet was successfully transmitted
ESP_LOGI(TAG, "success!");
} else {
ESP_LOGI(TAG, "failed, code %d\n", state);
}
// wait for a second before transmitting again
hal->delay(1000);
}
}

File diff suppressed because it is too large Load diff

1
examples/NonArduino/Pico/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
build/

View file

@ -0,0 +1,33 @@
cmake_minimum_required(VERSION 3.18)
# Pull in SDK (must be before project)
include(pico_sdk_import.cmake)
project(pico-sx1276 C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
# Initialize the SDK
pico_sdk_init()
add_compile_options(
-Wall
-Wno-format
-Wno-unused-function
)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../../../../RadioLib" "${CMAKE_CURRENT_BINARY_DIR}/RadioLib")
add_executable(${PROJECT_NAME}
main.cpp
)
# Pull in common dependencies
target_link_libraries(${PROJECT_NAME} pico_stdlib hardware_spi hardware_gpio hardware_timer pico_multicore hardware_pwm RadioLib)
pico_enable_stdio_usb(${PROJECT_NAME} 1)
pico_enable_stdio_uart(${PROJECT_NAME} 0)
# Create map/bin/hex file etc.
pico_add_extra_outputs(${PROJECT_NAME})

View file

@ -0,0 +1,8 @@
#!/bin/bash
set -e
mkdir -p build
cd build
cmake ..
make
cd ..

View file

@ -0,0 +1,3 @@
#!/bin/bash
rm -rf ./build

View file

@ -0,0 +1,86 @@
/*
RadioLib Non-Arduino Raspberry Pi Pico library example
Licensed under the MIT License
Copyright (c) 2024 Cameron Goddard
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.
*/
// define pins to be used
#define SPI_PORT spi0
#define SPI_MISO 4
#define SPI_MOSI 3
#define SPI_SCK 2
#define RFM_NSS 26
#define RFM_RST 22
#define RFM_DIO0 14
#define RFM_DIO1 15
#include <pico/stdlib.h>
// include the library
#include <RadioLib.h>
// include the hardware abstraction layer
#include "hal/RPiPico/PicoHal.h"
// create a new instance of the HAL class
PicoHal* hal = new PicoHal(SPI_PORT, SPI_MISO, SPI_MOSI, SPI_SCK);
// now we can create the radio module
// NSS pin: 26
// DIO0 pin: 14
// RESET pin: 22
// DIO1 pin: 15
SX1276 radio = new Module(hal, RFM_NSS, RFM_DIO0, RFM_RST, RFM_DIO1);
int main() {
// initialize just like with Arduino
printf("[SX1276] Initializing ... ");
int state = radio.begin();
if (state != RADIOLIB_ERR_NONE) {
printf("failed, code %d\n", state);
return(1);
}
printf("success!\n");
// loop forever
for(;;) {
// send a packet
printf("[SX1276] Transmitting packet ... ");
state = radio.transmit("Hello World!");
if(state == RADIOLIB_ERR_NONE) {
// the packet was successfully transmitted
printf("success!\n");
// wait for a second before transmitting again
hal->delay(1000);
} else {
printf("failed, code %d\n", state);
}
}
return(0);
}

View file

@ -0,0 +1,73 @@
# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake
# This can be dropped into an external project to help locate this SDK
# It should be include()ed prior to project()
if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
endif ()
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT))
set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT})
message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')")
endif ()
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH))
set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH})
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
endif ()
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
if (NOT PICO_SDK_PATH)
if (PICO_SDK_FETCH_FROM_GIT)
include(FetchContent)
set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR})
if (PICO_SDK_FETCH_FROM_GIT_PATH)
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
endif ()
# GIT_SUBMODULES_RECURSE was added in 3.17
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
GIT_SUBMODULES_RECURSE FALSE
)
else ()
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
)
endif ()
if (NOT pico_sdk)
message("Downloading Raspberry Pi Pico SDK")
FetchContent_Populate(pico_sdk)
set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
endif ()
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
else ()
message(FATAL_ERROR
"SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
)
endif ()
endif ()
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
if (NOT EXISTS ${PICO_SDK_PATH})
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
endif ()
set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
endif ()
set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
include(${PICO_SDK_INIT_CMAKE_FILE})

View file

@ -0,0 +1 @@
build/

View file

@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.18)
# create the project
project(rpi-sx1261)
# when using debuggers such as gdb, the following line can be used
#set(CMAKE_BUILD_TYPE Debug)
# if you did not build RadioLib as shared library (see wiki),
# you will have to add it as source directory
# the following is just an example, yours will likely be different
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../../../../RadioLib" "${CMAKE_CURRENT_BINARY_DIR}/RadioLib")
# add the executable
add_executable(${PROJECT_NAME} main.cpp)
# link both libraries
target_link_libraries(${PROJECT_NAME} RadioLib lgpio)
# you can also specify RadioLib compile-time flags here
#target_compile_definitions(RadioLib PUBLIC RADIOLIB_DEBUG_BASIC RADIOLIB_DEBUG_SPI)
#target_compile_definitions(RadioLib PUBLIC RADIOLIB_DEBUG_PORT=stdout)

View file

@ -0,0 +1,9 @@
#!/bin/bash
set -e
mkdir -p build
cd build
cmake -G "CodeBlocks - Unix Makefiles" ..
make
cd ..
size build/rpi-sx1261

View file

@ -0,0 +1,3 @@
#!/bin/bash
rm -rf ./build

View file

@ -0,0 +1,70 @@
/*
RadioLib Non-Arduino Raspberry Pi Example
This example shows how to use RadioLib without Arduino.
In this case, a Raspberry Pi with WaveShare SX1302 LoRaWAN Hat
using the lgpio library
https://abyz.me.uk/lg/lgpio.html
Can be used as a starting point to port RadioLib to any platform!
See this API reference page for details on the RadioLib hardware abstraction
https://jgromes.github.io/RadioLib/class_hal.html
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// include the hardware abstraction layer
#include "hal/RPi/PiHal.h"
// create a new instance of the HAL class
// use SPI channel 1, because on Waveshare LoRaWAN Hat,
// the SX1261 CS is connected to CE1
PiHal* hal = new PiHal(1);
// now we can create the radio module
// pinout corresponds to the Waveshare LoRaWAN Hat
// NSS pin: 7
// DIO1 pin: 17
// NRST pin: 22
// BUSY pin: not connected
SX1261 radio = new Module(hal, 7, 17, 22, RADIOLIB_NC);
// the entry point for the program
int main(int argc, char** argv) {
// initialize just like with Arduino
printf("[SX1261] Initializing ... ");
int state = radio.begin();
if (state != RADIOLIB_ERR_NONE) {
printf("failed, code %d\n", state);
return(1);
}
printf("success!\n");
// loop forever
int count = 0;
for(;;) {
// send a packet
printf("[SX1261] Transmitting packet ... ");
char str[64];
sprintf(str, "Hello World! #%d", count++);
state = radio.transmit(str);
if(state == RADIOLIB_ERR_NONE) {
// the packet was successfully transmitted
printf("success!\n");
// wait for a second before transmitting again
hal->delay(1000);
} else {
printf("failed, code %d\n", state);
}
}
return(0);
}

2
examples/NonArduino/Tock/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
build-*
TockApp.tab

View file

@ -0,0 +1,137 @@
# RadioLib Non-Arduino Tock Library CMake script
#
# 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.
cmake_minimum_required(VERSION 3.18)
# create the project
project(tock-sx1261)
set(LINKER_SCRIPT $ENV{LIBTOCK_C_DIRECTORY}/userland_generic.ld)
if (RISCV_BUILD)
include("tock-riscv.cmake")
else()
include("tock-arm.cmake")
endif()
# when using debuggers such as gdb, the following line can be used
#set(CMAKE_BUILD_TYPE Debug)
# if you did not build RadioLib as shared library (see wiki),
# you will have to add it as source directory
# the following is just an example, yours will likely be different
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../../../../RadioLib" "${CMAKE_CURRENT_BINARY_DIR}/RadioLib")
# add the executable
add_executable(${PROJECT_NAME} main.cpp)
# link with RadioLib and libtock-c
# The build system for libtock-c is a bit odd and the version of libraries
# built changes based on compiler version.
if (RISCV_BUILD)
if(EXISTS "$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-14.1.0")
target_link_libraries(${PROJECT_NAME} PUBLIC
RadioLib
$ENV{LIBTOCK_C_DIRECTORY}/libtock/build/rv32imc/libtock.a
$ENV{LIBTOCK_C_DIRECTORY}/libtock-sync/build/rv32imc/libtocksync.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-14.1.0/riscv/lib/gcc/riscv64-unknown-elf/14.1.0/rv32i/ilp32/libgcc.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-14.1.0/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libstdc++.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.4.0.20231231/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libc.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.4.0.20231231/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libm.a
)
target_include_directories(RadioLib AFTER PUBLIC
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.3.0.20230120/riscv/riscv64-unknown-elf/include/
)
elseif(EXISTS "$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-13.2.0")
target_link_libraries(${PROJECT_NAME} PUBLIC
RadioLib
$ENV{LIBTOCK_C_DIRECTORY}/libtock/build/rv32imc/libtock.a
$ENV{LIBTOCK_C_DIRECTORY}/libtock-sync/build/rv32imc/libtocksync.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-13.2.0/riscv/lib/gcc/riscv64-unknown-elf/13.2.0/rv32i/ilp32/libgcc.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-13.2.0/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libstdc++.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.3.0.20230120/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libc.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.3.0.20230120/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/
)
else()
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++-10.5.0/riscv/lib/gcc/riscv64-unknown-elf/10.5.0/rv32i/ilp32/libgcc.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-10.5.0/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libstdc++.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.2.0.20211231/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libc.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.2.0.20211231/riscv/riscv64-unknown-elf/lib/rv32i/ilp32/libm.a
)
target_include_directories(RadioLib AFTER PUBLIC
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.2.0.20211231/riscv/riscv64-unknown-elf/include/
)
endif()
else()
if (EXISTS "$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-14.1.0")
target_link_libraries(${PROJECT_NAME} PUBLIC
RadioLib
$ENV{LIBTOCK_C_DIRECTORY}/libtock/build/cortex-m4/libtock.a
$ENV{LIBTOCK_C_DIRECTORY}/libtock-sync/build/cortex-m4/libtocksync.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-14.1.0/arm/lib/gcc/arm-none-eabi/14.1.0/libgcc.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-14.1.0/arm/arm-none-eabi/lib/libstdc++.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.4.0.20231231/arm/arm-none-eabi/lib/libc.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.4.0.20231231/arm/arm-none-eabi/lib/libm.a
)
elseif(EXISTS "$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-13.2.0")
target_link_libraries(${PROJECT_NAME} PUBLIC
RadioLib
$ENV{LIBTOCK_C_DIRECTORY}/libtock/build/cortex-m4/libtock.a
$ENV{LIBTOCK_C_DIRECTORY}/libtock-sync/build/cortex-m4/libtocksync.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-13.2.0/arm/lib/gcc/arm-none-eabi/13.2.0/libgcc.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-13.2.0/arm/arm-none-eabi/lib/libstdc++.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.3.0.20230120/arm/arm-none-eabi/lib/libc.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.3.0.20230120/arm/arm-none-eabi/lib/libm.a
)
else()
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++-10.5.0/arm/lib/gcc/arm-none-eabi/10.5.0/libgcc.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-libc++-10.5.0/arm/arm-none-eabi/lib/libstdc++.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.2.0.20211231/arm/arm-none-eabi/lib/libc.a
$ENV{LIBTOCK_C_DIRECTORY}/lib/libtock-newlib-4.2.0.20211231/arm/arm-none-eabi/lib/libm.a
)
endif()
endif()
target_include_directories(${PROJECT_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/
$ENV{LIBTOCK_C_DIRECTORY}
)
# you can also specify RadioLib compile-time flags here
#target_compile_definitions(${PROJECT_NAME} PUBLIC RADIOLIB_DEBUG RADIOLIB_VERBOSE)

View file

@ -0,0 +1,34 @@
# RadioLib as Tock application
[Tock](https://github.com/tock/tock) is an embedded operating system designed
for running multiple concurrent, mutually distrustful applications on Cortex-M
and RISC-V based embedded platforms.
RadioLib can be built as a Tock application using
[libtock-c](https://github.com/tock/libtock-c). This is an example of running
RadioLib as a Tock application.
This has been tested on the
[SparkFun LoRa Thing Plus - expLoRaBLE board] (https://github.com/tock/tock/tree/master/boards/apollo3/lora_things_plus)
but will work on any LoRa compatible Tock board (currently only the
expLoRaBLE board).
libtock-c by default is bulit for RISC-V and ARM. RadioLib is also built
for both architectures by default. You can skip the RISC-V RadioLib build
by setting the `SKIP_RISCV` varaible.
The RadioLib example can be built with:
```shell
$ git clone https://github.com/jgromes/RadioLib.git
$ cd RadioLib/examples/NonArduino/Tock/
$ git clone https://github.com/tock/libtock-c.git
$ cd libtock-c; git checkout c0202f9ab78da4a6e95f136cf5250701e3778f63; cd ../
$ LIBTOCK_C_DIRECTORY="$(pwd)/libtock-c" ./build.sh
```
Then in the Tock repo you can flash the kernel and app with:
```shell
$ make flash; APP=RadioLib/examples/NonArduino/Tock/build-arm/tock-sx1261.tbf make flash-app
```

View file

@ -0,0 +1,30 @@
#!/bin/bash
set -e
rm -rf ./build-*
pushd ${LIBTOCK_C_DIRECTORY}/examples/cxx_hello
make -j4
popd
mkdir -p build-arm
cd build-arm
cmake -G "CodeBlocks - Unix Makefiles" ..
make -j4
cd ..
if ! env | grep SKIP_RISCV; then
mkdir -p build-riscv
cd build-riscv
cmake -G "CodeBlocks - Unix Makefiles" -DRISCV_BUILD=1 ..
make -j4
cd ..
fi
elf2tab -n radio-lib --stack 4096 --app-heap 2048 --kernel-heap 2048 \
--kernel-major 2 --kernel-minor 1 \
-v ./build-arm/tock-sx1261

View file

@ -0,0 +1,81 @@
/*
RadioLib Non-Arduino Tock Library test application
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.
*/
// include the library
#include <RadioLib.h>
// include the hardware abstraction layer
#include "RadioLib/libtockHal.h"
// the entry point for the program
int main(void) {
printf("[SX1261] Initialising Radio ... \r\n");
// create a new instance of the HAL class
TockRadioLibHal* hal = new TockRadioLibHal();
// now we can create the radio module
// pinout corresponds to the SparkFun LoRa Thing Plus - expLoRaBLE
// NSS pin: 0
// DIO1 pin: 2
// NRST pin: 4
// BUSY pin: 1
Module* tock_module = new Module(hal, RADIOLIB_RADIO_NSS, RADIOLIB_RADIO_DIO_1, RADIOLIB_RADIO_RESET, RADIOLIB_RADIO_BUSY);
SX1262* radio = new SX1262(tock_module);
// Setup the radio
// The settings here work for the SparkFun LoRa Thing Plus - expLoRaBLE
radio->XTAL = true;
int state = radio->begin(915.0);
if (state != RADIOLIB_ERR_NONE) {
printf("failed, code %d\r\n", state);
return 1;
}
printf("success!\r\n");
// loop forever
for(;;) {
yield_no_wait();
// send a packet
printf("[SX1261] Transmitting\r\n");
state = radio->transmit("Hello World!");
if(state == RADIOLIB_ERR_NONE) {
// the packet was successfully transmitted
printf("success!\r\n");
// wait for a second before transmitting again
hal->delay(1000);
} else {
printf("failed, code %d\r\n", state);
}
}
return 0;
}

View file

@ -0,0 +1,65 @@
# Tock target specific CMake file
#
# 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.
#
# This is copied from https://github.com/Lora-net/LoRaMac-node/pull/1390
# and has been relicensed by the original author
if(NOT DEFINED LINKER_SCRIPT)
message(FATAL_ERROR "No linker script defined")
endif(NOT DEFINED LINKER_SCRIPT)
message("Linker script: ${LINKER_SCRIPT}")
#---------------------------------------------------------------------------------------
# Set compiler/linker flags
#---------------------------------------------------------------------------------------
set(STACK_SIZE 4096)
set(APP_HEAP_SIZE 2048)
set(KERNEL_HEAP_SIZE 2048)
set(TOOLCHAIN arm-none-eabi)
find_program(TOOLCHAIN_PREFIX ${TOOLCHAIN}-gcc NO_CACHE)
get_filename_component(TOOLCHAIN_PREFIX ${TOOLCHAIN_PREFIX} DIRECTORY)
set(TOOLCHAIN_BIN_DIR ${TOOLCHAIN_PREFIX}/../bin)
set(TOOLCHAIN_INC_DIR ${TOOLCHAIN_PREFIX}/../${TOOLCHAIN}/include)
set(TOOLCHAIN_LIB_DIR ${TOOLCHAIN_PREFIX}/../${TOOLCHAIN}/lib)
#---------------------------------------------------------------------------------------
# Set compilers
#---------------------------------------------------------------------------------------
set(CMAKE_C_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-gcc CACHE INTERNAL "C Compiler")
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-g++ CACHE INTERNAL "C++ Compiler")
set(CMAKE_ASM_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-gcc CACHE INTERNAL "ASM Compiler")
# Object build options
set(OBJECT_GEN_FLAGS "-mthumb -g2 -fno-builtin -mcpu=cortex-m4 -Wall -Wextra -pedantic -Wno-unused-parameter -ffunction-sections -fdata-sections -fomit-frame-pointer -mabi=aapcs -fno-unroll-loops -ffast-math -ftree-vectorize -frecord-gcc-switches -gdwarf-2 -Os -fdata-sections -ffunction-sections -fstack-usage -Wl,--emit-relocs -fPIC -mthumb -mfloat-abi=soft -msingle-pic-base -mpic-register=r9 -mno-pic-data-is-text-relative -D__TOCK__ -DSVCALL_AS_NORMAL_FUNCTION -DSOFTDEVICE_s130")
set(CMAKE_C_FLAGS "${OBJECT_GEN_FLAGS} -std=gnu99 " CACHE INTERNAL "C Compiler options")
set(CMAKE_CXX_FLAGS "${OBJECT_GEN_FLAGS} -std=c++20 " CACHE INTERNAL "C++ Compiler options")
set(CMAKE_ASM_FLAGS "${OBJECT_GEN_FLAGS} -x assembler-with-cpp " CACHE INTERNAL "ASM Compiler options")
# Linker flags
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--gc-sections --specs=nano.specs --specs=nosys.specs -mthumb -g2 -mcpu=cortex-m4 -mabi=aapcs -T${LINKER_SCRIPT} -Wl,-Map=${CMAKE_PROJECT_NAME}.map -Xlinker --defsym=STACK_SIZE=${STACK_SIZE} -Xlinker --defsym=APP_HEAP_SIZE=${APP_HEAP_SIZE} -Xlinker --defsym=KERNEL_HEAP_SIZE=${KERNEL_HEAP_SIZE} -nostdlib -Wl,--start-group" CACHE INTERNAL "Linker options")

View file

@ -0,0 +1,76 @@
# Tock target specific CMake file
#
# 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.
#
# This is copied from https://github.com/Lora-net/LoRaMac-node/pull/1390
# and has been relicensed by the original author
if(NOT DEFINED LINKER_SCRIPT)
message(FATAL_ERROR "No linker script defined")
endif(NOT DEFINED LINKER_SCRIPT)
message("Linker script: ${LINKER_SCRIPT}")
#---------------------------------------------------------------------------------------
# Set compiler/linker flags
#---------------------------------------------------------------------------------------
set(STACK_SIZE 4096)
set(APP_HEAP_SIZE 2048)
set(KERNEL_HEAP_SIZE 2048)
find_program(TOOLCHAIN
NAMES
riscv64-none-elf-gcc
riscv32-none-elf-gcc
riscv64-elf-gcc
riscv32-unknown-elf-gcc
riscv64-unknown-elf-gcc
riscv64-unknown-elf-clang
riscv32-unknown-elf-clang
NO_CACHE)
get_filename_component(TOOLCHAIN_PREFIX ${TOOLCHAIN} DIRECTORY)
get_filename_component(TOOLCHAIN ${TOOLCHAIN} NAME)
string(REPLACE "-gcc" "" TOOLCHAIN ${TOOLCHAIN})
set(TOOLCHAIN_BIN_DIR ${TOOLCHAIN_PREFIX}/../bin)
set(TOOLCHAIN_INC_DIR ${TOOLCHAIN_PREFIX}/../${TOOLCHAIN}/include)
set(TOOLCHAIN_LIB_DIR ${TOOLCHAIN_PREFIX}/../${TOOLCHAIN}/lib)
#---------------------------------------------------------------------------------------
# Set compilers
#---------------------------------------------------------------------------------------
set(CMAKE_C_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-gcc CACHE INTERNAL "C Compiler")
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-g++ CACHE INTERNAL "C++ Compiler")
set(CMAKE_ASM_COMPILER ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-gcc CACHE INTERNAL "ASM Compiler")
# Object build options
set(OBJECT_GEN_FLAGS "-march=rv32i -mabi=ilp32 -mcmodel=medlow -g2 -fno-builtin -Wall -Wextra -pedantic -Wno-unused-parameter -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-unroll-loops -ffast-math -ftree-vectorize -frecord-gcc-switches -gdwarf-2 -Os -fdata-sections -ffunction-sections -fstack-usage -Wl,--emit-relocs -D__TOCK__ -DSVCALL_AS_NORMAL_FUNCTION -DSOFTDEVICE_s130")
set(CMAKE_C_FLAGS "${OBJECT_GEN_FLAGS} -std=gnu99 " CACHE INTERNAL "C Compiler options")
set(CMAKE_CXX_FLAGS "${OBJECT_GEN_FLAGS} -std=c++20 " CACHE INTERNAL "C++ Compiler options")
set(CMAKE_ASM_FLAGS "${OBJECT_GEN_FLAGS} -x assembler-with-cpp " CACHE INTERNAL "ASM Compiler options")
# Linker flags
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--gc-sections -march=rv32i -mabi=ilp32 -mcmodel=medlow -T${LINKER_SCRIPT} -Wl,-Map=${CMAKE_PROJECT_NAME}.map -Xlinker --defsym=STACK_SIZE=${STACK_SIZE} -Xlinker --defsym=APP_HEAP_SIZE=${APP_HEAP_SIZE} -Xlinker --defsym=KERNEL_HEAP_SIZE=${KERNEL_HEAP_SIZE} -nostdlib -Wl,--start-group" CACHE INTERNAL "Linker options")

View file

@ -0,0 +1,133 @@
/*
RadioLib Pager (POCSAG) Receive Example
This example shows how to receive FSK packets without using
SX127x packet engine.
This example receives POCSAG messages using SX1278's
FSK modem in direct mode.
Other modules that can be used to receive POCSAG:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- Si443x/RFM2x
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx127xrfm9x---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// SX1278 has the following connections:
// NSS pin: 10
// DIO0 pin: 2
// RESET pin: 9
// DIO1 pin: 3
SX1278 radio = new Module(10, 2, 9, 3);
// receiving packets requires connection
// to the module direct output pin,
// here connected to Arduino pin 5
// SX127x/RFM9x: DIO2
// RF69: DIO2
// SX1231: DIO2
// CC1101: GDO2
// Si443x/RFM2x: GPIO
// SX126x/LLCC68: DIO2
const int pin = 5;
// create Pager client instance using the FSK module
PagerClient pager(&radio);
// 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 SX1278 with default settings
Serial.print(F("[SX1278] Initializing ... "));
int state = radio.beginFSK();
// when using one of the non-LoRa modules
// (RF69, CC1101, Si4432 etc.), use the basic begin() method
// int state = radio.begin();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// initialize Pager client
Serial.print(F("[Pager] Initializing ... "));
// base (center) frequency: 434.0 MHz
// speed: 1200 bps
state = pager.begin(434.0, 1200);
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// start receiving POCSAG messages
Serial.print(F("[Pager] Starting to listen ... "));
// address of this "pager": 1234567
state = pager.startReceive(pin, 1234567);
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
}
void loop() {
// the number of batches to wait for
// 2 batches will usually be enough to fit short and medium messages
if (pager.available() >= 2) {
Serial.print(F("[Pager] Received pager data, decoding ... "));
// you can read the data as an Arduino String
String str;
int state = pager.readData(str);
// you can also receive data as byte array
/*
byte byteArr[8];
size_t numBytes = 0;
int state = radio.receive(byteArr, &numBytes);
*/
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
// print the received data
Serial.print(F("[Pager] Data:\t"));
Serial.println(str);
} else {
// some error occurred
Serial.print(F("failed, code "));
Serial.println(state);
}
}
}

View file

@ -0,0 +1,106 @@
/*
RadioLib Pager (POCSAG) Transmit Example
This example sends POCSAG messages using SX1278's
FSK modem.
Other modules that can be used to send POCSAG:
- SX127x/RFM9x
- RF69
- SX1231
- CC1101
- SX126x
- nRF24
- Si443x/RFM2x
- SX128x
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// SX1278 has the following connections:
// NSS pin: 10
// DIO0 pin: 2
// RESET pin: 9
// DIO1 pin: 3
SX1278 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();
*/
// create Pager client instance using the FSK module
PagerClient pager(&radio);
void setup() {
Serial.begin(9600);
// initialize SX1278 with default settings
Serial.print(F("[SX1278] Initializing ... "));
int state = radio.beginFSK();
// when using one of the non-LoRa modules
// (RF69, CC1101, Si4432 etc.), use the basic begin() method
// int state = radio.begin();
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// initialize Pager client
Serial.print(F("[Pager] Initializing ... "));
// base (center) frequency: 434.0 MHz
// speed: 1200 bps
state = pager.begin(434.0, 1200);
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
}
void loop() {
Serial.print(F("[Pager] Transmitting messages ... "));
// the simples form of "message" is just a tone on the destination pager
int state = pager.sendTone(1234567);
delay(500);
// next, transmit numeric (BCD) message to the destination pager
// NOTE: Only characters 0123456789*U-() and space
// can be sent in a BCD message!
state |= pager.transmit("0123456789*U -()", 1234567);
delay(500);
// finally, let's transmit an ASCII message now
state |= pager.transmit("Hello World!", 1234567, RADIOLIB_PAGER_ASCII);
delay(500);
// we can also send only a tone
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
}
// wait for a second before transmitting again
delay(3000);
}

View file

@ -0,0 +1,145 @@
/*
RadioLib PhysicalLayer Interface Example
This example shows how to use the common PhysicalLayer
to interface with different radio modules using the same
methods.
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
#include <RadioLib.h>
// select which radio to use
// this can be any radio supported by RadioLib!
#define RADIO_TYPE SX1278
// set the pinout depending on the wiring and module type
// SPI NSS pin: 10
// interrupt pin: 2
// reset pin: 9 (unused on some modules)
// extra GPIO/interrupt pin: 3 (unused on some modules)
RADIO_TYPE radio = new Module(10, 2, 9, 3);
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
// get pointer to the common layer
PhysicalLayer* phy = (PhysicalLayer*)&radio;
void dummyISR(void) {
// nothing here, this example is just a showcase
}
void setup() {
Serial.begin(9600);
// now we can use "radio" to access the features
// specific to that radio type, such as the begin() method
Serial.print(F("[Radio] Initializing ... "));
int state = radio.begin();
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// or we can use the "phy" pointer to access the common layer
// PhysicalLayer has some common configuration
Serial.print(F("[PHY] Changing frequency ... "));
state = phy->setFrequency(433.5);
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// PhysicalLayer also contains basic functionality
// like transmitting and receiving packets
Serial.print(F("[PHY] Sending packet ... "));
state = phy->transmit("Hello World!");
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// try to receive now - this will almost certainly timeout
// unless by chance there is a transmitter nearby,
// but the point of this example is to showcase the interface
String str;
Serial.print(F("[PHY] Listening for packets ... "));
state = phy->receive(str);
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else if(state == RADIOLIB_ERR_RX_TIMEOUT) {
Serial.println(F("timeout!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// interrupt-driven versions of Rx/Tx are supported as well
// for these to work, you have to configure the interrupt actions
phy->setPacketReceivedAction(dummyISR);
phy->setPacketSentAction(dummyISR);
// now you can use methods like startTransmit(), startReceive(),
// readData() etc.
// interrupt actions can be cleared as well
phy->clearPacketReceivedAction();
phy->clearPacketSentAction();
// PhysicalLayer supports basic mode changes like sleep ...
Serial.print(F("[PHY] Going to sleep ... "));
state = phy->sleep();
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// ... or standby
Serial.print(F("[PHY] Going to standby ... "));
state = phy->standby();
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
// there are also common SNR/RSSI measurement functions
Serial.print(F("[PHY] Measured SNR = "));
Serial.print(phy->getSNR());
Serial.println(F(" dB"));
Serial.print(F("[PHY] Measured RSSI = "));
Serial.print(phy->getRSSI());
Serial.println(F(" dBm"));
// and also a true random number generator
Serial.print(F("[PHY] Random number between 0 and 100 = "));
Serial.println(phy->random(100));
}
void loop() {
// nothing here, the example is just a showcase
}

View file

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

View file

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

View file

@ -1,19 +1,24 @@
/*
RadioLib RF69 Receive Example
RadioLib RF69 Blocking Receive Example
This example receives packets using RF69 FSK radio module.
To successfully receive data, the following settings have to be the same
on both transmitter and receiver:
- carrier frequency
- bit rate
- frequency deviation
- sync word
This example receives packets using RF69 FSK radio module.
To successfully receive data, the following settings have to be the same
on both transmitter and receiver:
- carrier frequency
- bit rate
- frequency deviation
- sync word
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
Using blocking receive is not recommended, as it will lead
to significant amount of timeouts, inefficient use of processor
time and can miss some packets!
Instead, interrupt receive is recommended.
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#rf69sx1231
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -25,9 +30,13 @@
// RESET pin: 3
RF69 radio = new Module(10, 2, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//RF69 radio = RadioShield.ModuleA;
// or detect the pinout automatically using RadioBoards
// https://github.com/radiolib-org/RadioBoards
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>
Radio radio = new RadioModule();
*/
void setup() {
Serial.begin(9600);
@ -40,7 +49,7 @@ void setup() {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
while (true) { delay(10); }
}
}

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