-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08ce38e
commit a4f10ed
Showing
5 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,3 +79,4 @@ debayered | |
rescanned | ||
unescaping | ||
underdefined | ||
gamepads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.. _generic_windows_devices: | ||
|
||
Generic Windows devices | ||
============================== | ||
|
||
There is some support for generic Windows drivers for some devices. | ||
|
||
Joysticks | ||
------------------------------ | ||
|
||
Basic support for Windows-compatible joysticks / gamepads using WinMM. Since the driver only supports polling, the events (button/axis presses) are emulated using a separate polling loop. The main device class is :class:`pylablib.devices.Windows.Joystick<.joystick.Joystick>`. Since this library is a standard part of Windows, no additional software is required, apart from potential joystick drivers. | ||
|
||
The code supports polling the joystick state (button and axes) as well as querying events:: | ||
|
||
>> from pylablib.devices import Windows | ||
>> Windows.list_joysticks() | ||
{0: TDeviceInfo(name='Microsoft PC-joystick driver', id=(121, 17), nbuttons=10, naxes=2)} | ||
>> j=Windows.Joystick() | ||
>> j.get_buttons() | ||
[False, False, False, False, False, False, False, False, False, False] | ||
>> j.start() # start polling loop in a separate thread | ||
>> j.get_events() # get the recent events (since the last get_events call) | ||
TJoystickEvent(kind='axis', index=0, old=0, new=-1, timestamp=1000000000.000), | ||
TJoystickEvent(kind='axis', index=0, old=-1, new=0, timestamp=1000000001.000)] | ||
>> j.stop() # stop the polling loop when done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,5 @@ Currently supported devices: | |
Lumel | ||
Omron | ||
misc_devices | ||
Windows | ||
protocols |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters