mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-04 15:07:46 +00:00
f8dd441827
Work in progress. Does not work yet.
Some notes:
- This requires some changes to TinyGo, look at the espnet branch.
- The next step is probably defining all the functions in
g_wifi_osi_funcs (see espnet.c). Right now it hangs in
esp_wifi_init_internal, probably a NULL pointer dereference.
- This is only for the ESP32-C3. This will require some work to work
on other chips from Espressif.
21 lines
385 B
Go
21 lines
385 B
Go
package main
|
|
|
|
import "tinygo.org/x/drivers/espnet"
|
|
|
|
func main() {
|
|
err := espnet.WiFi.Configure(espnet.Config{})
|
|
if err != nil {
|
|
println("failed to configure:", err.Error())
|
|
}
|
|
mac, err := espnet.WiFi.AccessPointMAC()
|
|
if err != nil {
|
|
println("failed to read MAC address:", err.Error())
|
|
return
|
|
}
|
|
print("MAC address:")
|
|
for _, b := range mac {
|
|
print(" ", b)
|
|
}
|
|
println()
|
|
}
|