1
0
Fork 0
mirror of https://github.com/kidoman/embd synced 2025-07-03 20:07:40 +02:00

- add analog pin details to bbb descriptor

- pinMap lookups now honor pin capabilities
This commit is contained in:
Karan Misra 2014-03-23 01:36:24 +05:30
parent 53e6c55378
commit 833ab3a472
4 changed files with 91 additions and 72 deletions

View file

@ -22,12 +22,12 @@ func newGPIODriver(pinMap PinMap) *gpioDriver {
}
}
func (io *gpioDriver) lookupKey(key interface{}) (*PinDesc, bool) {
return io.pinMap.Lookup(key)
func (io *gpioDriver) lookupKey(key interface{}, cap int) (*PinDesc, bool) {
return io.pinMap.Lookup(key, cap)
}
func (io *gpioDriver) digitalPin(key interface{}) (*digitalPin, error) {
pd, found := io.lookupKey(key)
pd, found := io.lookupKey(key, CapNormal)
if !found {
return nil, fmt.Errorf("gpio: could not find pin matching %q", key)
}
@ -43,10 +43,6 @@ func (io *gpioDriver) digitalPin(key interface{}) (*digitalPin, error) {
return dp, nil
}
if pd.Caps&CapNormal == 0 {
return nil, fmt.Errorf("gpio: sorry, pin %q cannot be used for digital io", key)
}
if pd.Caps != CapNormal {
glog.Infof("gpio: pin %q is not a dedicated digital io pin. please refer to the system reference manual for more details", key)
}