mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-18 21:53:56 +00:00
spi: remove machine.SPI and replace with drivers.SPI interface for almost all SPI drivers
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
+13
-1
@@ -13,6 +13,7 @@ import (
|
||||
|
||||
"machine"
|
||||
|
||||
"tinygo.org/x/drivers"
|
||||
"tinygo.org/x/drivers/net"
|
||||
)
|
||||
|
||||
@@ -258,7 +259,7 @@ type command struct {
|
||||
}
|
||||
|
||||
type Device struct {
|
||||
SPI machine.SPI
|
||||
SPI drivers.SPI
|
||||
CS machine.Pin
|
||||
ACK machine.Pin
|
||||
GPIO0 machine.Pin
|
||||
@@ -268,6 +269,17 @@ type Device struct {
|
||||
ssids [10]string
|
||||
}
|
||||
|
||||
// New returns a new Wiifinina driver.
|
||||
func New(bus drivers.SPI, csPin, ackPin, gpio0Pin, resetPin machine.Pin) *Device {
|
||||
return &Device{
|
||||
SPI: bus,
|
||||
CS: csPin,
|
||||
ACK: ackPin,
|
||||
GPIO0: gpio0Pin,
|
||||
RESET: resetPin,
|
||||
}
|
||||
}
|
||||
|
||||
func (d *Device) Configure() {
|
||||
|
||||
net.UseDriver(d.NewDriver())
|
||||
|
||||
Reference in New Issue
Block a user