mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-12 19:03:42 +00:00
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:
+4
-3
@@ -1,8 +1,9 @@
|
||||
package adt7410 // import "tinygo.org/x/drivers/adt7410"
|
||||
|
||||
import (
|
||||
"machine"
|
||||
"time"
|
||||
|
||||
"tinygo.org/x/drivers"
|
||||
)
|
||||
|
||||
type Error uint8
|
||||
@@ -21,7 +22,7 @@ func (e Error) Error() string {
|
||||
}
|
||||
|
||||
type Device struct {
|
||||
bus *machine.I2C
|
||||
bus drivers.I2C
|
||||
buf []byte
|
||||
addr uint8
|
||||
}
|
||||
@@ -31,7 +32,7 @@ type Device struct {
|
||||
// can be set using by connecting to the A1 and A0 pins to VDD or GND (for a
|
||||
// total of up to 4 devices on a I2C bus). Also note that 10k pullups are
|
||||
// recommended for the SDA and SCL lines.
|
||||
func New(i2c *machine.I2C, addressBits uint8) *Device {
|
||||
func New(i2c drivers.I2C, addressBits uint8) *Device {
|
||||
return &Device{
|
||||
bus: i2c,
|
||||
buf: make([]byte, 2),
|
||||
|
||||
Reference in New Issue
Block a user