mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-19 06:03:57 +00:00
fix requested changes by @aykevl
This commit is contained in:
+4
-4
@@ -33,7 +33,7 @@ func (d *I2CDevice16) Addr() uint8 {
|
||||
}
|
||||
|
||||
// ReadRegister implements I2C.ReadRegister.
|
||||
func (d *I2CDevice16) ReadRegister(r uint8, buf []byte) error {
|
||||
func (d *I2CDevice16) readRegister(r uint8, buf []byte) error {
|
||||
if d.Err != nil {
|
||||
return d.Err
|
||||
}
|
||||
@@ -54,7 +54,7 @@ func (d *I2CDevice16) ReadRegister(r uint8, buf []byte) error {
|
||||
}
|
||||
|
||||
// WriteRegister implements I2C.WriteRegister.
|
||||
func (d *I2CDevice16) WriteRegister(r uint8, buf []byte) error {
|
||||
func (d *I2CDevice16) writeRegister(r uint8, buf []byte) error {
|
||||
if d.Err != nil {
|
||||
return d.Err
|
||||
}
|
||||
@@ -80,11 +80,11 @@ func (bus *I2CDevice16) Tx(w, r []byte) error {
|
||||
bus.c.Fatalf("i2c mock: need a write byte")
|
||||
return nil
|
||||
case 1:
|
||||
return bus.ReadRegister(w[0], r)
|
||||
return bus.readRegister(w[0], r)
|
||||
default:
|
||||
if len(r) > 0 || len(w) == 1 {
|
||||
bus.c.Fatalf("i2c mock: unsupported lengths in Tx(%d, %d)", len(w), len(r))
|
||||
}
|
||||
return bus.WriteRegister(w[0], w[1:])
|
||||
return bus.writeRegister(w[0], w[1:])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user