firmata: remove unused code, increase test coverage

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram 2017-05-13 14:08:34 +02:00
parent 870ea0fc99
commit ecdd98aa15
2 changed files with 4 additions and 15 deletions

View File

@ -202,7 +202,10 @@ func TestAdaptorAnalogReadBadPin(t *testing.T) {
func TestAdaptorI2cStart(t *testing.T) {
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) {

View File

@ -89,20 +89,6 @@ func (c *firmataI2cConnection) ReadWordData(reg uint8) (val uint16, err error) {
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) {
buf := []byte{val}
_, err = c.Write(buf)