mirror of
https://github.com/kidoman/embd
synced 2025-07-03 03:47:33 +02:00
- add analog pin details to bbb descriptor
- pinMap lookups now honor pin capabilities
This commit is contained in:
parent
53e6c55378
commit
833ab3a472
4 changed files with 91 additions and 72 deletions
6
pin.go
6
pin.go
|
@ -13,6 +13,7 @@ const (
|
|||
CapGPMC
|
||||
CapLCD
|
||||
CapPWM
|
||||
CapAnalog
|
||||
)
|
||||
|
||||
type PinDesc struct {
|
||||
|
@ -21,11 +22,12 @@ type PinDesc struct {
|
|||
Caps int
|
||||
|
||||
DigitalLogical int
|
||||
AnalogLogical int
|
||||
}
|
||||
|
||||
type PinMap []*PinDesc
|
||||
|
||||
func (m PinMap) Lookup(k interface{}) (*PinDesc, bool) {
|
||||
func (m PinMap) Lookup(k interface{}, cap int) (*PinDesc, bool) {
|
||||
var ks string
|
||||
switch key := k.(type) {
|
||||
case int:
|
||||
|
@ -46,7 +48,7 @@ func (m PinMap) Lookup(k interface{}) (*PinDesc, bool) {
|
|||
}
|
||||
|
||||
for j := range pd.Aliases {
|
||||
if pd.Aliases[j] == ks {
|
||||
if pd.Aliases[j] == ks && pd.Caps&cap != 0 {
|
||||
return pd, true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue