examples/rtl8720dn: update all remaining examples for refactored API

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram
2022-09-05 15:35:18 +02:00
committed by Ron Evans
parent 54ddb895cc
commit a6a8d478b9
18 changed files with 94 additions and 757 deletions
+7 -8
View File
@@ -4,15 +4,17 @@
// You can open a server to accept connections from this program using:
//
// nc -w 5 -lk 8080
//
package main
import (
"machine"
"bytes"
"fmt"
"time"
"tinygo.org/x/drivers/net"
"tinygo.org/x/drivers/rtl8720dn"
)
// You can override the setting with the init() in another source code.
@@ -41,18 +43,15 @@ func main() {
}
func run() error {
rtl, err := setupRTL8720DN()
if err != nil {
return err
}
net.UseDriver(rtl)
adaptor := rtl8720dn.New(machine.UART3, machine.PB24, machine.PC24, machine.RTL8720D_CHIP_PU)
adaptor.Configure()
err = rtl.ConnectToAccessPoint(ssid, password, 10*time.Second)
err := adaptor.ConnectToAccessPoint(ssid, password, 10*time.Second)
if err != nil {
return err
}
ip, subnet, gateway, err := rtl.GetIP()
ip, subnet, gateway, err := adaptor.GetIP()
if err != nil {
return err
}