Loading README.md +2 −2 Original line number Diff line number Diff line # joysticks Go language joystick interface. uses channels for events, so multi-threaded. uses channels for events, for flexibility and multi-threading. Overview/docs: [](https://godoc.org/github.com/splace/joysticks) Loading @@ -9,7 +9,7 @@ Installation: go get github.com/splace/joysticks Example: play a note when pressing button #1. hat position changes frequency, y axis, and volume, x axis. (double press button #10 to exit) Example: play a note when pressing button #1. hat position changes frequency, y axis, and volume, x axis. (long press button #10 to exit) package main Loading joysticks_linux.go +2 −1 Original line number Diff line number Diff line Loading @@ -87,6 +87,7 @@ func Capture(registrees ...Channel) []chan event { // Connect sets up a go routine that puts a joysticks events onto registered channels. // register channels by using the returned state object's On<xxx>(index) methods. // Note: only one event, of each type '<xxx>', for each 'index', re-registering stops previously registered event. // then activate using state objects ProcessEvents() method.(usually in a go routine.) func Connect(index int) (js State, e error) { r, e := os.OpenFile(fmt.Sprintf("/dev/input/js%d", index-1), os.O_RDONLY, 0666) Loading Loading @@ -195,7 +196,7 @@ func (js State) OnClose(button uint8) chan event { return c } // button goes closed // button goes open and last event on it, closed, wasn't recent. (within 1 second) func (js State) OnLong(button uint8) chan event { c := make(chan event) js.buttonLongPressEvents[button] = c Loading Loading
README.md +2 −2 Original line number Diff line number Diff line # joysticks Go language joystick interface. uses channels for events, so multi-threaded. uses channels for events, for flexibility and multi-threading. Overview/docs: [](https://godoc.org/github.com/splace/joysticks) Loading @@ -9,7 +9,7 @@ Installation: go get github.com/splace/joysticks Example: play a note when pressing button #1. hat position changes frequency, y axis, and volume, x axis. (double press button #10 to exit) Example: play a note when pressing button #1. hat position changes frequency, y axis, and volume, x axis. (long press button #10 to exit) package main Loading
joysticks_linux.go +2 −1 Original line number Diff line number Diff line Loading @@ -87,6 +87,7 @@ func Capture(registrees ...Channel) []chan event { // Connect sets up a go routine that puts a joysticks events onto registered channels. // register channels by using the returned state object's On<xxx>(index) methods. // Note: only one event, of each type '<xxx>', for each 'index', re-registering stops previously registered event. // then activate using state objects ProcessEvents() method.(usually in a go routine.) func Connect(index int) (js State, e error) { r, e := os.OpenFile(fmt.Sprintf("/dev/input/js%d", index-1), os.O_RDONLY, 0666) Loading Loading @@ -195,7 +196,7 @@ func (js State) OnClose(button uint8) chan event { return c } // button goes closed // button goes open and last event on it, closed, wasn't recent. (within 1 second) func (js State) OnLong(button uint8) chan event { c := make(chan event) js.buttonLongPressEvents[button] = c Loading