mirror of
https://github.com/kidoman/embd
synced 2024-12-22 04:40:04 +01:00
gpio: added pinmap accessor for introspection usage
This commit is contained in:
parent
05c03968d7
commit
e6d0ea4225
3
gpio.go
3
gpio.go
@ -125,6 +125,9 @@ type PWMPin interface {
|
|||||||
|
|
||||||
// GPIODriver implements a generic GPIO driver.
|
// GPIODriver implements a generic GPIO driver.
|
||||||
type GPIODriver interface {
|
type GPIODriver interface {
|
||||||
|
// Returns the pinmap for this GPIODriver
|
||||||
|
PinMap() PinMap
|
||||||
|
|
||||||
// Unregister unregisters the pin from the driver. Should be called when the pin is closed.
|
// Unregister unregisters the pin from the driver. Should be called when the pin is closed.
|
||||||
Unregister(string) error
|
Unregister(string) error
|
||||||
|
|
||||||
|
@ -107,6 +107,10 @@ func (io *gpioDriver) PWMPin(key interface{}) (PWMPin, error) {
|
|||||||
return p, nil
|
return p, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (io *gpioDriver) PinMap() PinMap {
|
||||||
|
return io.pinMap
|
||||||
|
}
|
||||||
|
|
||||||
func (io *gpioDriver) Close() error {
|
func (io *gpioDriver) Close() error {
|
||||||
for _, p := range io.initializedPins {
|
for _, p := range io.initializedPins {
|
||||||
if err := p.Close(); err != nil {
|
if err := p.Close(); err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user