tinkerboard: corrections needed for sysfs.PWMPin

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram 2017-04-25 11:57:25 +02:00
parent 927293c3dd
commit d0385e4ccb
1 changed files with 2 additions and 7 deletions

View File

@ -3,7 +3,6 @@ package tinkerboard
import ( import (
"errors" "errors"
"fmt" "fmt"
"strconv"
multierror "github.com/hashicorp/go-multierror" multierror "github.com/hashicorp/go-multierror"
"gobot.io/x/gobot" "gobot.io/x/gobot"
@ -101,11 +100,7 @@ func (c *Adaptor) PwmWrite(pin string, val byte) (err error) {
if err != nil { if err != nil {
return return
} }
p, err := pwmPin.Period() period, err := pwmPin.Period()
if err != nil {
return err
}
period, err := strconv.Atoi(p)
if err != nil { if err != nil {
return err return err
} }
@ -199,7 +194,7 @@ func (c *Adaptor) pwmPin(pin string) (sysfsPin *sysfs.PWMPin, err error) {
if err = newPin.SetPeriod(10000000); err != nil { if err = newPin.SetPeriod(10000000); err != nil {
return return
} }
if err = newPin.SetPolarityInverted(false); err != nil { if err = newPin.InvertPolarity(false); err != nil {
return return
} }
c.pwmPins[sysPin.pwmPin] = newPin c.pwmPins[sysPin.pwmPin] = newPin