Update i2c package

This commit is contained in:
Adrian Zankich 2014-05-22 21:33:05 -07:00
parent 20395a016e
commit 51bd9247e7
6 changed files with 11 additions and 6 deletions

View File

@ -10,9 +10,10 @@ type BlinkMDriver struct {
Adaptor I2cInterface Adaptor I2cInterface
} }
func NewBlinkMDriver(a I2cInterface) *BlinkMDriver { func NewBlinkMDriver(a I2cInterface, name string) *BlinkMDriver {
return &BlinkMDriver{ return &BlinkMDriver{
Driver: gobot.Driver{ Driver: gobot.Driver{
Name: name,
Commands: []string{ Commands: []string{
"RgbC", "RgbC",
"FadeC", "FadeC",

View File

@ -12,7 +12,7 @@ var _ = Describe("BlinkM", func() {
) )
BeforeEach(func() { BeforeEach(func() {
b = NewBlinkMDriver(t) b = NewBlinkMDriver(t, "bot")
}) })
It("Must be able to Start", func() { It("Must be able to Start", func() {

View File

@ -11,8 +11,11 @@ type HMC6352Driver struct {
Heading uint16 Heading uint16
} }
func NewHMC6352Driver(a I2cInterface) *HMC6352Driver { func NewHMC6352Driver(a I2cInterface, name string) *HMC6352Driver {
return &HMC6352Driver{ return &HMC6352Driver{
Driver: gobot.Driver{
Name: name,
},
Adaptor: a, Adaptor: a,
} }
} }

View File

@ -12,7 +12,7 @@ var _ = Describe("HMC6352", func() {
) )
BeforeEach(func() { BeforeEach(func() {
h = NewHMC6352Driver(t) h = NewHMC6352Driver(t, "bot")
}) })
It("Must be able to Start", func() { It("Must be able to Start", func() {

View File

@ -13,9 +13,10 @@ type WiichuckDriver struct {
data map[string]float64 data map[string]float64
} }
func NewWiichuckDriver(a I2cInterface) *WiichuckDriver { func NewWiichuckDriver(a I2cInterface, name string) *WiichuckDriver {
return &WiichuckDriver{ return &WiichuckDriver{
Driver: gobot.Driver{ Driver: gobot.Driver{
Name: name,
Events: map[string]chan interface{}{ Events: map[string]chan interface{}{
"z_button": make(chan interface{}), "z_button": make(chan interface{}),
"c_button": make(chan interface{}), "c_button": make(chan interface{}),

View File

@ -12,7 +12,7 @@ var _ = Describe("Wiichuck", func() {
) )
BeforeEach(func() { BeforeEach(func() {
w = NewWiichuckDriver(t) w = NewWiichuckDriver(t, "bot")
}) })
PIt("Must be able to Start", func() { PIt("Must be able to Start", func() {