2023-04-29 18:58:07 +03:00
|
|
|
//go:build baremetal
|
2020-09-13 21:21:38 +03:00
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2024-01-02 14:36:07 +03:00
|
|
|
// DeviceAddress is the MAC address of the Bluetooth peripheral you want to connect to.
|
|
|
|
// Replace this by using -ldflags="-X main.DeviceAddress=[MAC ADDRESS]"
|
|
|
|
// where [MAC ADDRESS] is the actual MAC address of the peripheral.
|
|
|
|
// For example:
|
|
|
|
// tinygo flash -target circuitplay-bluefruit -ldflags="-X main.DeviceAddress=7B:36:98:8C:41:1C" ./examples/discover/
|
|
|
|
var DeviceAddress string
|
2020-09-13 21:21:38 +03:00
|
|
|
|
|
|
|
func connectAddress() string {
|
2024-01-02 14:36:07 +03:00
|
|
|
return DeviceAddress
|
2020-09-13 21:21:38 +03:00
|
|
|
}
|
|
|
|
|
2020-09-22 19:15:38 +03:00
|
|
|
// wait on baremetal, proceed immediately on desktop OS.
|
|
|
|
func wait() {
|
|
|
|
time.Sleep(3 * time.Second)
|
|
|
|
}
|
|
|
|
|
2020-09-13 21:21:38 +03:00
|
|
|
// done just blocks forever, allows USB CDC reset for flashing new software.
|
|
|
|
func done() {
|
|
|
|
println("Done.")
|
|
|
|
|
|
|
|
time.Sleep(1 * time.Hour)
|
|
|
|
}
|