Skip to content

Commit

Permalink
Fix platform tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zankich committed May 3, 2014
1 parent b22d48e commit 828b10f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion platforms/firmata/firmata_adaptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var _ = Describe("FirmataAdaptor", func() {
)

BeforeEach(func() {
adaptor = NewFirmataAdaptor()
adaptor = NewFirmataAdaptor("tom", "/dev/null")
adaptor.connect = func(f *FirmataAdaptor) {
f.Board = newBoard(sp{})
f.Board.Events = append(f.Board.Events, event{Name: "firmware_query"})
Expand Down
3 changes: 1 addition & 2 deletions platforms/gpio/led_driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ var _ = Describe("Led", func() {
)

BeforeEach(func() {
l = NewLedDriver(t)
l.Pin = "1"
l = NewLedDriver(t, "myLed", "1")
})

It("Must be able to tell if IsOn", func() {
Expand Down
3 changes: 2 additions & 1 deletion platforms/i2c/hmc6352_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package i2c

import (
"github.com/hybridgroup/gobot"
"time"
)

type HMC6352Driver struct {
Expand All @@ -20,7 +21,7 @@ func (h *HMC6352Driver) Start() bool {
h.Adaptor.I2cStart(0x21)
h.Adaptor.I2cWrite([]uint16{uint16([]byte("A")[0])})

gobot.Every("1s", func() {
gobot.Every(1*time.Second, func() {
h.Adaptor.I2cWrite([]uint16{uint16([]byte("A")[0])})
ret := h.Adaptor.I2cRead(2)
if len(ret) == 2 {
Expand Down
3 changes: 2 additions & 1 deletion platforms/i2c/wiichuck_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package i2c
import (
"fmt"
"github.com/hybridgroup/gobot"
"time"
)

type WiichuckDriver struct {
Expand Down Expand Up @@ -36,7 +37,7 @@ func NewWiichuckDriver(a I2cInterface) *WiichuckDriver {

func (w *WiichuckDriver) Start() bool {
w.Adaptor.I2cStart(byte(0x52))
gobot.Every("100ms", func() {
gobot.Every(100*time.Millisecond, func() {
w.Adaptor.I2cWrite([]uint16{uint16(0x40), uint16(0x00)})
w.Adaptor.I2cWrite([]uint16{uint16(0x00)})
new_value := w.Adaptor.I2cRead(uint16(6))
Expand Down

0 comments on commit 828b10f

Please sign in to comment.