Skip to content

Commit 0cb6639

Browse files
committed
fix: use HAL
1 parent e4f0acd commit 0cb6639

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

examples/w5500/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func main() {
1616
})
1717
machine.GPIO17.Configure(machine.PinConfig{Mode: machine.PinOutput})
1818

19-
eth := w5500.New(machine.SPI0, machine.GPIO17.Set)
19+
eth := w5500.New(machine.SPI0, machine.GPIO17)
2020
eth.Configure(w5500.Config{
2121
MAC: net.HardwareAddr{0xee, 0xbe, 0xe9, 0xa9, 0xb6, 0x4f},
2222
IP: netip.AddrFrom4([4]byte{192, 168, 1, 2}),

w5500/w5500.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"sync"
88

99
"tinygo.org/x/drivers"
10+
"tinygo.org/x/drivers/internal/pin"
1011
"tinygo.org/x/drivers/netdev"
1112
)
1213

@@ -27,7 +28,7 @@ type Device struct {
2728

2829
mu sync.Mutex
2930
bus drivers.SPI
30-
cs PinOutput
31+
cs pin.OutputFunc
3132
dns Resolver
3233

3334
sockets []*socket
@@ -37,10 +38,10 @@ type Device struct {
3738
}
3839

3940
// New returns a new w5500 driver.
40-
func New(bus drivers.SPI, cs PinOutput) *Device {
41+
func New(bus drivers.SPI, csPin pin.Output) *Device {
4142
return &Device{
4243
bus: bus,
43-
cs: cs,
44+
cs: csPin.Set,
4445
}
4546
}
4647

0 commit comments

Comments
 (0)