Git Product home page Git Product logo

gpio's People

Contributors

johnsto avatar warthog618 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gpio's Issues

gpio.test test failures on more recent platforms

run gpop.test sometimes OK, sometimes may FAIL.

error message is following:

pi@raspberrypi:~ $ ./gpio.test -test.bench=.*
--- FAIL: TestCloseInterrupts (0.06s)
interrupt_test.go:312: Spurious interrupt during close 0
FAIL

Getting the pin number in the watcher handler

Currently the Pin struct doesn't export a way of getting the pin number that caused to watcher handler to run.

This makes writing generic handlers impossible.

Adding a reader to the Pin struct for the internal pin value would make things way easier. Something like

func (pin *Pin) Pin() uint8 {
  return pin.pin
}

Another option would be to export the pin field, but then it would be possible to set that value externally.

too many GO modules depends

I found it depends on soo many modules which I can't download all, and I can't get it compiled.

after remove file go.mod, go.sum, fallback to go get mode, it compile OK.

maybe somethin error whit go module ?

BTW: I very this project : wonderful function, clear APIs ...

how to recover from a crash?

hi,
my app crashed for the first time while using this library (nil pointer dereference) so it couldn't call Unwatch() on all the buttons nor gpio.Close().
when the app is now started again, I get the error that the pin is already in use.
what is the proper way to claim a pin again? I actually want to "force use" the pin because the application must always "just work".

compile err on GO1.11

./dio.go:186:19: invalid operation: 1 << (pin & 31) (shift count type int, must be unsigned integer)
./dio.go:242:28: invalid operation: mem[pin.fsel] >> modeShift (shift count type int, must be unsigned integer)
./dio.go:272:33: invalid operation: modeMask << modeShift (shift count type int, must be unsigned integer)
./dio.go:272:69: invalid operation: uint32(mode) << modeShift (shift count type int, must be unsigned integer)
./dio.go:334:47: invalid operation: pullMask << shift (shift count type int, must be unsigned integer)
./dio.go:334:79: invalid operation: uint32(pull) << shift (shift count type int, must be unsigned integer)

Port to Banana PI M4 Board

Hi Kent,
We are looking for a Golang package to access GPIO on our Banana PI M4 board. Your project seems promising but realize that this is for Raspberry PI board. If we want to use your project for our Banana PI board, what changes do we have to make and where the changes have to be made. Or if you are able to make the changes to it so as to enable support for Banana PI M4 that would be excellent.
Thank you for your help.
David.

panic: pin already in use

no error on first run. when I cancel the program with ctrl-c getting this error. (Raspberry pi 3 B+)


err=pin.Watch(gpio.EdgeBoth, func(pin *gpio.Pin) {
fmt.Printf("Pin 4 is %v\n", pin.Read())
})
if err!=nil {
panic(err)
}

defer pin.Unwatch()

panic: pin already in use

goroutine 1 [running]:
panic(0xd2b10, 0x1040c198)
/usr/lib/go-1.7/src/runtime/panic.go:500 +0x33c

Excellent, thank you.

Just dropping by to say thank you for an excellent library. Source code is clear and idiomatic from a targetted Go/Linux/RPI system perspective. The README gives a nice introduction and justification.

I refactored my code from @hybridgroup's Gobot GPIO ButtonDriver to use your library instead and saw a significant reduction in resource consumption.

Below stats from top are enough to see the huge difference during a non-eventful watch period.

Before:

RES    SHR  S  %CPU  %MEM
7432   2416 S   4.7   1.7

After:

RES    SHR  S  %CPU  %MEM
2404   1964 S   0.0   0.5

I actually had to hunt for the pid because the process no longer shows up in top when ordered by CPU usage. Nice work!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.