mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-13 19:33:39 +00:00
examples/lora/lorawan: modify atcmd and basic demo to support choosing
any one of the supported regions at compile time by using ldflags. Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
@@ -32,6 +32,8 @@ var (
|
||||
defaultTimeout uint32 = 1000
|
||||
)
|
||||
|
||||
var reg string
|
||||
|
||||
func main() {
|
||||
uart.Configure(machine.UARTConfig{TX: tx, RX: rx})
|
||||
|
||||
@@ -45,7 +47,16 @@ func main() {
|
||||
otaa = &lorawan.Otaa{}
|
||||
lorawan.UseRadio(radio)
|
||||
|
||||
lorawan.UseRegionSettings(region.EU868())
|
||||
switch reg {
|
||||
case "AU915":
|
||||
lorawan.UseRegionSettings(region.AU915())
|
||||
case "EU868":
|
||||
lorawan.UseRegionSettings(region.EU868())
|
||||
case "US915":
|
||||
lorawan.UseRegionSettings(region.US915())
|
||||
default:
|
||||
lorawan.UseRegionSettings(region.EU868())
|
||||
}
|
||||
|
||||
for {
|
||||
if uart.Buffered() > 0 {
|
||||
|
||||
Reference in New Issue
Block a user