Skip to content

Commit

Permalink
drv2605l fix missing address write byte in test of Halt()
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Kohler authored and deadprogram committed Mar 19, 2022
1 parent f312f00 commit bfeb5bb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/i2c/drv2605l_driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,16 @@ func TestDRVD2605DriverStartReadError(t *testing.T) {
}

func TestDRV2605LDriverHalt(t *testing.T) {
writeStopPlaybackData := []byte{drv2605RegGo, 0}
// single-byte-read starts with a write operation to set the register for reading
// see section 8.5.3.5 of data sheet
readCurrentStandbyModeData := byte(drv2605RegMode)
writeNewStandbyModeData := []byte{drv2605RegMode, 42 | drv2605Standby}
d, adaptor := initTestDriverAndAdaptor()
gobottest.Assert(t, d.Start(), nil)
adaptor.written = []byte{}
gobottest.Assert(t, d.Halt(), nil)
gobottest.Assert(t, adaptor.written, []byte{drv2605RegGo, 0, drv2605RegMode, 42 | drv2605Standby})
gobottest.Assert(t, adaptor.written, append(append(writeStopPlaybackData, readCurrentStandbyModeData), writeNewStandbyModeData...))
}

func TestDRVD2605DriverHaltWriteError(t *testing.T) {
Expand Down

0 comments on commit bfeb5bb

Please sign in to comment.