From cca91da5edfacd86cbc1475ae7af550e41d4ac96 Mon Sep 17 00:00:00 2001 From: Adrian Zankich Date: Sat, 22 Nov 2014 19:43:53 -0800 Subject: [PATCH] Refactor edison to use new adaptor interface --- platforms/intel-iot/edison/edison_adaptor.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/platforms/intel-iot/edison/edison_adaptor.go b/platforms/intel-iot/edison/edison_adaptor.go index aa6e0d2a..84fcc69b 100644 --- a/platforms/intel-iot/edison/edison_adaptor.go +++ b/platforms/intel-iot/edison/edison_adaptor.go @@ -10,7 +10,7 @@ import ( "github.com/hybridgroup/gobot/sysfs" ) -var _ gobot.AdaptorInterface = (*EdisonAdaptor)(nil) +var _ gobot.Adaptor = (*EdisonAdaptor)(nil) func writeFile(path string, data []byte) (i int, err error) { file, err := sysfs.OpenFile(path, os.O_WRONLY, 0644) @@ -51,7 +51,7 @@ type sysfsPin struct { } type EdisonAdaptor struct { - gobot.Adaptor + name string tristate sysfs.DigitalPin digitalPins map[int]sysfs.DigitalPin pwmPins map[int]*pwmPin @@ -184,10 +184,7 @@ func changePinMode(pin, mode string) (err error) { // creates connect function func NewEdisonAdaptor(name string) *EdisonAdaptor { return &EdisonAdaptor{ - Adaptor: *gobot.NewAdaptor( - name, - "EdisonAdaptor", - ), + name: name, connect: func(e *EdisonAdaptor) (err error) { e.tristate = sysfs.NewDigitalPin(214) if err = e.tristate.Export(); err != nil { @@ -251,6 +248,8 @@ func NewEdisonAdaptor(name string) *EdisonAdaptor { } } +func (e *EdisonAdaptor) Name() string { return e.name } + // Connect starts conection with board and creates // digitalPins and pwmPins adaptor maps func (e *EdisonAdaptor) Connect() (errs []error) {