1
0
mirror of https://github.com/kidoman/embd synced 2024-12-23 05:10:05 +01:00
embd/host/bbb/pwmpin_test.go
Karan Misra c35deeb17c host specific drivers can now be loaded separately
this ensures cleaner abstractions/code and will ensure that the produced
binary is as small as possible. a convenience package is provided to
easily load all hosts easily: "github.com/kidoman/embd/host/all"
2014-04-06 06:50:09 +05:30

27 lines
559 B
Go

package bbb
import (
"testing"
"github.com/kidoman/embd"
)
func TestPWMPinClose(t *testing.T) {
pinMap := embd.PinMap{
&embd.PinDesc{ID: "P1_1", Aliases: []string{"1"}, Caps: embd.CapPWM},
}
driver := embd.NewGPIODriver(pinMap, nil, nil, newPWMPin)
pin, err := driver.PWMPin(1)
if err != nil {
t.Fatalf("Looking up pwm pin 1: got %v", err)
}
pin.Close()
pin2, err := driver.PWMPin(1)
if err != nil {
t.Fatalf("Looking up pwm pin 1: got %v", err)
}
if pin == pin2 {
t.Fatal("Looking up closed pwm pin 1: but got the old instance")
}
}