fix requested changes by @aykevl

This commit is contained in:
soypat
2023-05-31 22:08:39 -03:00
committed by Ron Evans
parent 64029612e0
commit 31538f1b2f
6 changed files with 24 additions and 16 deletions
+4 -4
View File
@@ -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:])
}
}