edison: use refactored sysfs interface
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
0eff347997
commit
4064a608d9
|
@ -103,7 +103,7 @@ func (e *Adaptor) Finalize() (err error) {
|
|||
}
|
||||
for _, pin := range e.pwmPins {
|
||||
if pin != nil {
|
||||
if errs := pin.Enable("0"); errs != nil {
|
||||
if errs := pin.Enable(false); errs != nil {
|
||||
err = multierror.Append(err, errs)
|
||||
}
|
||||
if errs := pin.Unexport(); errs != nil {
|
||||
|
@ -152,7 +152,7 @@ func (e *Adaptor) PwmWrite(pin string, val byte) (err error) {
|
|||
if err = e.pwmPins[sysPin.pwmPin].Export(); err != nil {
|
||||
return
|
||||
}
|
||||
if err = e.pwmPins[sysPin.pwmPin].Enable("1"); err != nil {
|
||||
if err = e.pwmPins[sysPin.pwmPin].Enable(true); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ func (e *Adaptor) PwmWrite(pin string, val byte) (err error) {
|
|||
return err
|
||||
}
|
||||
duty := gobot.FromScale(float64(val), 0, 255.0)
|
||||
return e.pwmPins[sysPin.pwmPin].WriteDuty(strconv.Itoa(int(float64(period) * duty)))
|
||||
return e.pwmPins[sysPin.pwmPin].SetDutyCycle(uint32(float64(period) * duty))
|
||||
}
|
||||
return errors.New("Not a PWM pin")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue