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:
deadprogram
2020-10-18 18:03:12 +02:00
parent e376785596
commit 39e9e209ec
23 changed files with 135 additions and 124 deletions
+13 -1
View File
@@ -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())