Refactor beaglebone to use new adaptor interface

This commit is contained in:
Adrian Zankich 2014-11-22 18:59:27 -08:00
parent 9a0f3b46f7
commit 149760e392
2 changed files with 7 additions and 7 deletions

View File

@ -14,7 +14,8 @@ import (
"github.com/hybridgroup/gobot/sysfs"
)
var _ gobot.AdaptorInterface = (*BeagleboneAdaptor)(nil)
var _ gobot.Adaptor = (*BeagleboneAdaptor)(nil)
var slots = "/sys/devices/bone_capemgr.*"
var ocp = "/sys/devices/ocp.*"
var usrLed = "/sys/devices/ocp.3/gpio-leds.8/leds/beaglebone:green:"
@ -114,7 +115,7 @@ var analogPins = map[string]string{
}
type BeagleboneAdaptor struct {
gobot.Adaptor
name string
digitalPins []sysfs.DigitalPin
pwmPins map[string]*pwmPin
i2cDevice io.ReadWriteCloser
@ -126,10 +127,7 @@ type BeagleboneAdaptor struct {
// NewBeagleboneAdaptor returns a new beaglebone adaptor with specified name
func NewBeagleboneAdaptor(name string) *BeagleboneAdaptor {
b := &BeagleboneAdaptor{
Adaptor: *gobot.NewAdaptor(
name,
"BeagleboneAdaptor",
),
name: name,
digitalPins: make([]sysfs.DigitalPin, 120),
pwmPins: make(map[string]*pwmPin),
}
@ -141,6 +139,7 @@ func NewBeagleboneAdaptor(name string) *BeagleboneAdaptor {
return b
}
func (b *BeagleboneAdaptor) Name() string { return b.name }
// Connect returns true on a succesful connection to beaglebone board.
// It initializes digital, pwm and analog pins

View File

@ -2,9 +2,10 @@ package beaglebone
import (
"fmt"
"github.com/hybridgroup/gobot/sysfs"
"os"
"strings"
"github.com/hybridgroup/gobot/sysfs"
)
type pwmPin struct {