mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-17 05:13:23 +00:00
16 lines
357 B
Go
16 lines
357 B
Go
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)
|
|
}
|