i2c: switch all i2c drivers definitions to use i2c bus interface type instead of machine package concrete type

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram
2020-08-27 12:45:17 +02:00
committed by Ron Evans
parent a07b20f2f9
commit db02cbb8a4
24 changed files with 86 additions and 87 deletions
+4 -2
View File
@@ -7,6 +7,8 @@ import (
"machine"
"strings"
"time"
"tinygo.org/x/drivers"
)
var (
@@ -20,7 +22,7 @@ type Device struct {
bufIdx int
sentence strings.Builder
uart *machine.UART
bus *machine.I2C
bus drivers.I2C
address uint16
}
@@ -35,7 +37,7 @@ func NewUART(uart *machine.UART) Device {
}
// NewI2C creates a new I2C GPS connection.
func NewI2C(bus *machine.I2C) Device {
func NewI2C(bus drivers.I2C) Device {
return Device{
bus: bus,
address: I2C_ADDRESS,