Commit 57b607a6 authored by simon's avatar simon
Browse files

comment

parent cc390325
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ Go language joystick/controller/gamepad interface.

uses Linux 'input' interface to receive events directly, no polling.

then uses channels to pipe around events, for flexibility and multi-threading.
uses channels to pipe around events, for flexibility and multi-threading.

Overview/docs: [![GoDoc](https://godoc.org/github.com/splace/joysticks?status.svg)](https://godoc.org/github.com/splace/joysticks)

@@ -63,4 +63,6 @@ Example: play a note when pressing button #1. hat position changes frequency, y



Note: "jstest-gtk" - system wide mapping and calibration.

+12 −5
Original line number Diff line number Diff line
/*
Package joysticks, provides simplified event routing, through channels, from the Linux joystick driver File-like interface.

events can be listened for from any thread, re-routed and simulated.
events can be listened for from any thread, dynamically re-mapped and simulated.

usage:

'Capture', a single call to setup and start basic event routing.
'Capture', a single call to setup and start basic 'Event' channeling on the first available device.

'Event', an interface, provides a time.Duration through the Moment() method, returning whatever the underlying Linux driver provides as the events timestamp, as a time.Duration.

Events, will need casting to the actual type to access data other than moment. 


or (more flexible)

'Connect' to a HID by index number, then use methods to add event channels, one for each button or hat, and start running by calling 'ParcelOutEvents'.
'Connect(index)' to a HID. 

Use methods to add (or alter) 'Event' channels, 

event, an interface with a 'Moment' method, provides a time.Duration. Moment() returns whatever the underlying Linux driver provides as the events timestamp, in time.Duration.
Start running by calling 'ParcelOutEvents()'.

hat channel event provides current position, (x,y) the event will need casting to the hat event to access these. (and only one axis actually changes per event.)
event index to channel mappings can be changed dynamically.

or (DIY)