mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-15 12:23:41 +00:00
8238f96319
This moves the netdev/netlink namespace out of drivers and into their own packages. Also, defines netdev and netlink as L3/L4 and L2 OSI layers, respectively. Move some L3 functionality from netlink to netdev (GetIPAddr). For netlink, add ConnectParams for NetConnect to pass in L2 connection parameters (ssid, pass, auth_type, etc). Also adds connection mode (STA, AP, etc). For netlink, add SendEth and RecvEthFunc funcs to handle L2 send/recv of Ethernet pkts.
37 lines
680 B
Go
37 lines
680 B
Go
//go:build arduino_mkrwifi1010
|
|
|
|
package probe
|
|
|
|
import (
|
|
"machine"
|
|
"time"
|
|
|
|
"tinygo.org/x/drivers/netdev"
|
|
"tinygo.org/x/drivers/netlink"
|
|
"tinygo.org/x/drivers/wifinina"
|
|
)
|
|
|
|
func Probe() (netlink.Netlinker, netdev.Netdever) {
|
|
|
|
cfg := wifinina.Config{
|
|
// Configure SPI for 8Mhz, Mode 0, MSB First
|
|
Spi: machine.NINA_SPI,
|
|
Freq: 8 * 1e6,
|
|
Sdo: machine.NINA_SDO,
|
|
Sdi: machine.NINA_SDI,
|
|
Sck: machine.NINA_SCK,
|
|
// Device pins
|
|
Cs: machine.NINA_CS,
|
|
Ack: machine.NINA_ACK,
|
|
Gpio0: machine.NINA_GPIO0,
|
|
Resetn: machine.NINA_RESETN,
|
|
// mMKR 1010 resets High
|
|
ResetIsHigh: true,
|
|
}
|
|
|
|
nina := wifinina.New(&cfg)
|
|
netdev.UseNetdev(nina)
|
|
|
|
return nina, nina
|
|
}
|