File tree Expand file tree Collapse file tree 4 files changed +34
-12
lines changed Expand file tree Collapse file tree 4 files changed +34
-12
lines changed Original file line number Diff line number Diff line change @@ -23,20 +23,20 @@ Builds/flashes atcmd console application with simulator instead of actual LoRa r
2323tinygo flash -target pico ./examples/lora/lorawan/atcmd/
2424```
2525
26- ## PyBadge with LoRa Featherwing
26+ ## PyBadge with LoRa Featherwing for EU868 region
2727
2828Builds/flashes atcmd console application on PyBadge using LoRa Featherwing (RFM95/SX1276).
2929
3030```
31- tinygo flash -target pybadge -tags featherwing ./examples/lora/lorawan/atcmd/
31+ tinygo flash -target pybadge -tags featherwing -ldflags="-X main.reg=EU868" ./examples/lora/lorawan/atcmd/
3232```
3333
34- ## LoRa-E5
34+ ## LoRa-E5 for US915 region
3535
3636Builds/flashes atcmd console application on Lora-E5 using onboard SX126x.
3737
3838```
39- tinygo flash -target lorae5 ./examples/lora/lorawan/atcmd/
39+ tinygo flash -target lorae5 -ldflags="-X main.reg=US915" ./examples/lora/lorawan/atcmd/
4040```
4141
4242## Joining a Public Lorawan Network
Original file line number Diff line number Diff line change 3232 defaultTimeout uint32 = 1000
3333)
3434
35+ var reg string
36+
3537func main () {
3638 uart .Configure (machine.UARTConfig {TX : tx , RX : rx })
3739
@@ -45,7 +47,16 @@ func main() {
4547 otaa = & lorawan.Otaa {}
4648 lorawan .UseRadio (radio )
4749
48- lorawan .UseRegionSettings (region .EU868 ())
50+ switch reg {
51+ case "AU915" :
52+ lorawan .UseRegionSettings (region .AU915 ())
53+ case "EU868" :
54+ lorawan .UseRegionSettings (region .EU868 ())
55+ case "US915" :
56+ lorawan .UseRegionSettings (region .US915 ())
57+ default :
58+ lorawan .UseRegionSettings (region .EU868 ())
59+ }
4960
5061 for {
5162 if uart .Buffered () > 0 {
Original file line number Diff line number Diff line change @@ -21,16 +21,16 @@ loraConnect: Connected !
2121tinygo flash -target pico ./examples/lora/lorawan/basic-demo
2222```
2323
24- ## PyBadge with LoRa Featherwing
24+ ## PyBadge with LoRa Featherwing for EU868 region
2525
2626```
27- tinygo flash -target pybadge -tags featherwing ./examples/lora/lorawan/basic-demo
27+ tinygo flash -target pybadge -tags featherwing -ldflags="-X main.reg=EU868" ./examples/lora/lorawan/basic-demo
2828```
2929
30- ## LoRa-E5
30+ ## LoRa-E5 for US915 region
3131
3232```
33- tinygo flash -target lorae5 ./examples/lora/lorawan/basic-demo
33+ tinygo flash -target lorae5 -ldflags="-X main.reg=US915" ./examples/lora/lorawan/basic-demo
3434```
3535
3636
Original file line number Diff line number Diff line change @@ -12,7 +12,10 @@ import (
1212 "tinygo.org/x/drivers/lora/lorawan/region"
1313)
1414
15- var debug string
15+ var (
16+ reg string
17+ debug string
18+ )
1619
1720const (
1821 LORAWAN_JOIN_TIMEOUT_SEC = 180
@@ -67,8 +70,16 @@ func main() {
6770
6871 // Connect the lorawan with the Lora Radio device.
6972 lorawan .UseRadio (radio )
70-
71- lorawan .UseRegionSettings (region .EU868 ())
73+ switch reg {
74+ case "AU915" :
75+ lorawan .UseRegionSettings (region .AU915 ())
76+ case "EU868" :
77+ lorawan .UseRegionSettings (region .EU868 ())
78+ case "US915" :
79+ lorawan .UseRegionSettings (region .US915 ())
80+ default :
81+ lorawan .UseRegionSettings (region .EU868 ())
82+ }
7283
7384 // Configure AppEUI, DevEUI, APPKey, and public/private Lorawan Network
7485 setLorawanKeys ()
You can’t perform that action at this time.
0 commit comments