API Reference¶
qwiic_twist¶
Python module for the[SparkFun Qwiic Twist](https://www.sparkfun.com/products/15083)
This python package is a port of the existing [SparkFun Qwiic Twist Arduino Library](https://github.com/sparkfun/SparkFun_Qwiic_Twist_Arduino_Library)
This package can be used in conjunction with the overall [SparkFun qwiic Python Package](https://github.com/sparkfun/Qwiic_Py)
New to qwiic? Take a look at the entire [SparkFun qwiic ecosystem](https://www.sparkfun.com/qwiic).
-
class
qwiic_twist.
QwiicTwist
(address=None, i2c_driver=None)[source]¶ Parameters: - address – The I2C address to use for the device. If not provided, the default address is used.
- i2c_driver – An existing i2c driver object. If not provided a driver object is created.
Returns: The QwiicTwist device object.
Return type: Object
-
begin
()[source]¶ Initialize the operation of the Twist module
Returns: Returns true of the initializtion was successful, otherwise False. Return type: bool
-
blue
¶ Gets the blue color of the encoder LEDs
Returns: blue component of the color Return type: integer
-
clicked
¶ Returns true if a click event has occurred
Returns: Click event state Return type: Boolean
-
connect_blue
¶ Gets the connect blue color of the encoder LEDs
Returns: Blue component of the color
-
connect_color
(red, green, blue)[source]¶ Sets the relation between each color and the twisting of the knob Connect the LED so it changes [amount] with each encoder tick Negative numbers are allowed (so LED gets brighter the more you turn the encoder down)
Parameters: - red – Red component
- green – Green component
- blue – Blue component
Returns: No return value
-
connect_green
¶ Gets the connect green color of the encoder LEDs
Returns: green component of the color
-
connect_red
¶ Gets the connect red color of the encoder LEDs
Returns: Red component of the color
-
connected
¶ Determine if a Tesit device is conntected to the system..
Returns: True if the device is connected, otherwise False. Return type: bool
-
count
¶ Returns the number of indents the user has twisted the knob
Returns: number of indents Return type: word as integer
-
get_blue
()[source]¶ Gets the blue color of the encoder LEDs
Returns: blue component of the color Return type: integer
-
get_connect_blue
()[source]¶ Gets the connect blue color of the encoder LEDs
Returns: Blue component of the color
-
get_connect_green
()[source]¶ Gets the connect green color of the encoder LEDs
Returns: green component of the color
-
get_connect_red
()[source]¶ Gets the connect red color of the encoder LEDs
Returns: Red component of the color
-
get_count
()[source]¶ Returns the number of indents the user has twisted the knob
Returns: number of indents Return type: word as integer
-
get_diff
(clear_value=False)[source]¶ Returns the number of ticks since last check
Parameters: clearValue – Set to True to clear the current value. Default is False Returns: the difference Return type: integer
-
get_green
()[source]¶ Gets the green color of the encoder LEDs
Returns: green component of the color Return type: integer
-
get_int_timeout
()[source]¶ Get number of milliseconds that elapse between end of knob turning and interrupt firing
Returns: the timeout value Return type: integer
-
get_limit
()[source]¶ Returns the limit of allowed counts before wrapping. 0 is disabled
Returns: The limit Return type: integer
-
get_version
()[source]¶ Returns a integer of the firmware version number
Returns: The firmware version Return type: integer
-
green
¶ Gets the green color of the encoder LEDs
Returns: green component of the color Return type: integer
-
int_timeout
¶ Get number of milliseconds that elapse between end of knob turning and interrupt firing
Returns: the timeout value Return type: integer
-
is_connected
()[source]¶ Determine if a Tesit device is conntected to the system..
Returns: True if the device is connected, otherwise False. Return type: bool
-
is_pressed
()[source]¶ Returns true if button is currently being pressed
Returns: Button pressed state Return type: Boolean
-
limit
¶ Returns the limit of allowed counts before wrapping. 0 is disabled
Returns: The limit Return type: integer
-
moved
¶ Returns true if knob has been twisted
Returns: Moved state Return type: Boolean
-
pressed
¶ Returns true if button is currently being pressed
Returns: Button pressed state Return type: Boolean
-
red
¶ Gets the red color of the encoder LEDs
Returns: Red component of the color
-
set_blue
(blue)[source]¶ Sets the blue color of the encoder LEDs
Parameters: blue – blue component Returns: No return value
-
set_color
(red, green, blue)[source]¶ Sets the color of the encoder LEDs
Parameters: - red – Red component
- green – Green component
- blue – Blue component
Returns: No return value
-
set_connect_blue
(blue)[source]¶ Sets the connect blue color of the encoder LEDs
Parameters: blue – blue component Returns: No return value
-
set_connect_green
(green)[source]¶ Sets the connect green color of the encoder LEDs
Parameters: green – Green component Returns: No return value
-
set_connect_red
(red)[source]¶ Sets the connect red color of the encoder LEDs
Parameters: red – Red component Returns: No return value
-
set_count
(amount)[source]¶ Set the encoder count to a specific amount
Parameters: amount – the value to set the counter to Returns: no return value
-
set_green
(green)[source]¶ Sets the green color of the encoder LEDs
Parameters: green – Green component Returns: No return value Return type: integer
-
set_int_timeout
(timeout)[source]¶ Set number of milliseconds that elapse between end of knob turning and interrupt firing
Parameters: timeout – the timeout value in milliseconds Returns: No return value
-
set_limit
(amount)[source]¶ Set the encoder count limit to a specific amount
Parameters: amount – the value to set the limit to Returns: no return value
-
set_red
(red)[source]¶ Sets the red color of the encoder LEDs
Parameters: red – Red component Returns: No return value
-
since_last_movement
(clear_value=True)[source]¶ Returns the number of milliseconds since the last encoder movement By default, clear the current value
Parameters: clearValue – Clear out the value? True by default Returns: time since last encoder movement Return type: integer
-
since_last_press
(clear_value=True)[source]¶ Returns the number of milliseconds since the last button event (press and release) By default, clear the current value
Parameters: clearValue – Clear out the value? False by default Returns: time since last button press Return type: integer
-
version
¶ Returns a integer of the firmware version number
Returns: The firmware version Return type: integer