mirror of
https://github.com/kidoman/embd
synced 2025-07-03 11:57:38 +02:00
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"
This commit is contained in:
parent
57328c979d
commit
c35deeb17c
44 changed files with 1184 additions and 1018 deletions
26
host/bbb/analogpin_test.go
Normal file
26
host/bbb/analogpin_test.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
package bbb
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
)
|
||||
|
||||
func TestAnalogPinClose(t *testing.T) {
|
||||
pinMap := embd.PinMap{
|
||||
&embd.PinDesc{ID: "P1_1", Aliases: []string{"1"}, Caps: embd.CapAnalog},
|
||||
}
|
||||
driver := embd.NewGPIODriver(pinMap, nil, newAnalogPin, nil)
|
||||
pin, err := driver.AnalogPin(1)
|
||||
if err != nil {
|
||||
t.Fatalf("Looking up analog pin 1: got %v", err)
|
||||
}
|
||||
pin.Close()
|
||||
pin2, err := driver.AnalogPin(1)
|
||||
if err != nil {
|
||||
t.Fatalf("Looking up analog pin 1: got %v", err)
|
||||
}
|
||||
if pin == pin2 {
|
||||
t.Fatal("Looking up closed analog pin 1: but got the old instance")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue