joule: implement DigitalPinnerProvider and PWMPinnerProvider interfaces

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram 2017-05-01 10:31:36 +02:00
parent fb07036fda
commit c3f9b4ae5d
2 changed files with 4 additions and 2 deletions

View File

@ -78,7 +78,7 @@ func (e *Adaptor) Finalize() (err error) {
}
// digitalPin returns matched digitalPin for specified values
func (e *Adaptor) DigitalPin(pin string, dir string) (sysfsPin *sysfs.DigitalPin, err error) {
func (e *Adaptor) DigitalPin(pin string, dir string) (sysfsPin sysfs.DigitalPinner, err error) {
i := sysfsPinMap[pin]
if e.digitalPins[i.pin] == nil {
e.digitalPins[i.pin] = sysfs.NewDigitalPin(i.pin)
@ -132,7 +132,7 @@ func (e *Adaptor) PwmWrite(pin string, val byte) (err error) {
}
// PWMPin returns a sysfs.PWMPin
func (e *Adaptor) PWMPin(pin string) (sysfsPin *sysfs.PWMPin, err error) {
func (e *Adaptor) PWMPin(pin string) (sysfsPin sysfs.PWMPinner, err error) {
sysPin := sysfsPinMap[pin]
if sysPin.pwmPin != -1 {
if e.pwmPins[sysPin.pwmPin] == nil {

View File

@ -17,6 +17,8 @@ var _ gobot.Adaptor = (*Adaptor)(nil)
var _ gpio.DigitalReader = (*Adaptor)(nil)
var _ gpio.DigitalWriter = (*Adaptor)(nil)
var _ gpio.PwmWriter = (*Adaptor)(nil)
var _ sysfs.DigitalPinnerProvider = (*Adaptor)(nil)
var _ sysfs.PWMPinnerProvider = (*Adaptor)(nil)
var _ i2c.Connector = (*Adaptor)(nil)
func initTestAdaptor() (*Adaptor, *sysfs.MockFilesystem) {