mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-13 11:23:40 +00:00
i2c iface refactor: Resolve 559
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package legacy
|
||||
|
||||
import "tinygo.org/x/drivers"
|
||||
|
||||
type I2C struct {
|
||||
i2c drivers.I2C
|
||||
}
|
||||
|
||||
func ReadRegister(i2c drivers.I2C, addr uint8, reg uint8, buf []byte) error {
|
||||
return i2c.Tx(uint16(addr), []byte{reg}, buf)
|
||||
}
|
||||
|
||||
func WriteRegister(i2c drivers.I2C, addr uint8, reg uint8, buf []byte) error {
|
||||
return i2c.Tx(uint16(addr), append([]byte{reg}, buf...), nil)
|
||||
}
|
||||
Reference in New Issue
Block a user