mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-03 06:27:47 +00:00
21 lines
370 B
Go
21 lines
370 B
Go
package espat
|
|
|
|
import (
|
|
"time"
|
|
|
|
"tinygo.org/x/drivers/net"
|
|
)
|
|
|
|
func (d *Device) ConnectToAccessPoint(ssid, pass string, timeout time.Duration) error {
|
|
if len(ssid) == 0 {
|
|
return net.ErrWiFiMissingSSID
|
|
}
|
|
|
|
d.SetWifiMode(WifiModeClient)
|
|
return d.ConnectToAP(ssid, pass, int(timeout.Seconds()))
|
|
}
|
|
|
|
func (d *Device) Disconnect() error {
|
|
return d.DisconnectFromAP()
|
|
}
|