This Python library is intended to handle Griffin Powermate wheel(s) events.
pip install lib-powermate
[To be explained]
-
find_wheels()
Returns an array of PowerMate wheel devices. Raises a
DeviceNotFound
exception if none found.
Receives an optional device as parameter, which can be obtained with the find_wheels()
function. If no device is specified, set_device()
must be called with a valid device before using the wheel, otherwise it will fail.
-
get_device()
Returns the current instance's device.
-
is_pressed()
True
if the wheel is currently pressed. -
has_twisted()
True
if the current instance is ignoring multiple twists (seeignore_multiple_twists
method) and the wheel has been pressed, then turned.
-
set_device
(<device new_device>)
Sets the device to be used by the current instance.
-
set_logger
(<logger new_logger>)
Changes the logger used by the current instance. Mostly useful for debugging purposes.
-
ignore_all_events
([<bool value=True>])
Skips all events if True.
-
ignore_mutiple_twists
([<bool value=True>])
Ignores twist events (in any direction) after the first one until the wheel is unpressed. Useful for discrete operations.
-
on
(<str event_name>, <callable some_function>)
Define which function (or any other callable) to call when an even occurs. See Events for a list of events.
-
listen()
Starts listening for events.
-
brightness
(<byte level>)
Defines the LED brightness level (0 is off, 255 is full brightness)
-
led_on()
Turns LED on.
-
led_off()
Turns LED off.
press
: Triggered when the wheel is pressed down.depress
: Triggered when the wheel is unpressed/released. (Alias:release
)turn_left
: Triggered when the wheel is turned to the left (counter-clockwise).turn_right
: Triggered when the wheel is turned to the right (clockwise).twist_left
: Triggered when the wheel is turned to the left (counter-clockwise) while being pressed down.twist_right
: Triggered when the wheel is turned to the right (clockwise) while being pressed down.
GNU GPLv2 - Copyright 2017, Enrico Lamperti.
Please see LICENSE file for more details.