firmata: remove unused code, increase test coverage
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
870ea0fc99
commit
ecdd98aa15
|
@ -202,7 +202,10 @@ func TestAdaptorAnalogReadBadPin(t *testing.T) {
|
||||||
|
|
||||||
func TestAdaptorI2cStart(t *testing.T) {
|
func TestAdaptorI2cStart(t *testing.T) {
|
||||||
a := initTestAdaptor()
|
a := initTestAdaptor()
|
||||||
a.GetConnection(0, 0)
|
i2c, err := a.GetConnection(0, 0)
|
||||||
|
gobottest.Assert(t, err, nil)
|
||||||
|
gobottest.Refute(t, i2c, nil)
|
||||||
|
gobottest.Assert(t, i2c.Close(), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAdaptorI2cRead(t *testing.T) {
|
func TestAdaptorI2cRead(t *testing.T) {
|
||||||
|
|
|
@ -89,20 +89,6 @@ func (c *firmataI2cConnection) ReadWordData(reg uint8) (val uint16, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *firmataI2cConnection) ReadBlockData(reg uint8, b []byte) (n int, err error) {
|
|
||||||
// Assume target device handles this well, will not behave exactly as on SMBus
|
|
||||||
if err = c.WriteByte(reg); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to read full 32 bytes
|
|
||||||
buf := make([]byte, 32)
|
|
||||||
bytesRead, err := c.Read(buf)
|
|
||||||
copy(b, buf)
|
|
||||||
|
|
||||||
return bytesRead, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *firmataI2cConnection) WriteByte(val byte) (err error) {
|
func (c *firmataI2cConnection) WriteByte(val byte) (err error) {
|
||||||
buf := []byte{val}
|
buf := []byte{val}
|
||||||
_, err = c.Write(buf)
|
_, err = c.Write(buf)
|
||||||
|
|
Loading…
Reference in New Issue