Closed mikedewar closed 10 years ago
If I connect to a pin, then close that pin, then try to connect again I receive the error
Pin 43 is already assigned to module gpio
Code below.
package main import ( "github.com/mrmorphic/hwio" ) func main() { pin, e := hwio.GetPinWithMode("P9.11", hwio.INPUT) if e != nil { panic(e) } err := hwio.ClosePin(pin) if err != nil { panic(e) } pin, e = hwio.GetPinWithMode("P9.11", hwio.INPUT) if e != nil { panic(e) } }
which pukes as follows, on a BeagleBoneBlack:
panic: Pin 43 is already assigned to module gpio goroutine 1 [running]: runtime.panic(0xf9e20, 0x10500bb8) /home/root/go/src/pkg/runtime/panic.c:266 +0x134 main.main() /home/root/projects/go/src/github.com/nytlabs/magnet/main.go:18 +0x154
I just committed a fix for that if you want to take a look. The close function was unexporting, but not updating the list of assigned pins.
Brilliant! Thanks so much.
If I connect to a pin, then close that pin, then try to connect again I receive the error
Code below.
which pukes as follows, on a BeagleBoneBlack: