Qwiic_Twist_Py
Python for SFE Qwiic Twist
Loading...
Searching...
No Matches
qwiic_twist.QwiicTwist Class Reference

QwiicTwist. More...

Inheritance diagram for qwiic_twist.QwiicTwist:

Public Member Functions

def __init__ (self, address=None, i2c_driver=None)
 
def is_connected (self)
 Determine if a Tesit device is conntected to the system. More...
 
def begin (self)
 Initialize the operation of the Twist module. More...
 
def clear_interrupts (self)
 Clears the moved, clicked, and pressed bits. More...
 
def get_count (self)
 Returns the number of indents the user has twisted the knob. More...
 
def set_count (self, amount)
 Set the encoder count to a specific amount. More...
 
def get_limit (self)
 Returns the limit of allowed counts before wrapping. More...
 
def set_limit (self, amount)
 Set the encoder count limit to a specific amount. More...
 
def get_diff (self, clear_value=False)
 Returns the number of ticks since last check. More...
 
def is_pressed (self)
 Returns true if button is currently being pressed. More...
 
def was_clicked (self)
 Returns true if a click event has occurred. More...
 
def has_moved (self)
 Returns true if knob has been twisted. More...
 
def since_last_movement (self, clear_value=True)
 Returns the number of milliseconds since the last encoder movement By default, clear the current value. More...
 
def since_last_press (self, clear_value=True)
 Returns the number of milliseconds since the last button event (press and release) By default, clear the current value. More...
 
def set_color (self, red, green, blue)
 Sets the color of the encoder LEDs. More...
 
def set_red (self, red)
 Sets the red color of the encoder LEDs. More...
 
def get_red (self)
 Gets the red color of the encoder LEDs. More...
 
def set_green (self, green)
 Sets the green color of the encoder LEDs. More...
 
def get_green (self)
 Gets the green color of the encoder LEDs. More...
 
def set_blue (self, blue)
 Sets the blue color of the encoder LEDs. More...
 
def get_blue (self)
 Gets the blue color of the encoder LEDs. More...
 
def get_version (self)
 Returns a integer of the firmware version number. More...
 
def connect_color (self, red, green, blue)
 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) More...
 
def set_connect_red (self, red)
 Sets the connect red color of the encoder LEDs. More...
 
def get_connect_red (self)
 Gets the connect red color of the encoder LEDs. More...
 
def set_connect_green (self, green)
 Sets the connect green color of the encoder LEDs. More...
 
def get_connect_green (self)
 Gets the connect green color of the encoder LEDs. More...
 
def set_connect_blue (self, blue)
 Sets the connect blue color of the encoder LEDs. More...
 
def get_connect_blue (self)
 Gets the connect blue color of the encoder LEDs. More...
 
def set_int_timeout (self, timeout)
 Set number of milliseconds that elapse between end of knob turning and interrupt firing. More...
 
def get_int_timeout (self)
 Get number of milliseconds that elapse between end of knob turning and interrupt firing. More...
 

Public Attributes

 address
 

Static Public Attributes

 device_name = _DEFAULT_NAME
 
 available_addresses = _AVAILABLE_I2C_ADDRESS
 

Properties

 connected = property(is_connected)
 
 count = property(get_count, set_count)
 
 limit = property(get_limit, set_limit)
 
 pressed = property(is_pressed)
 
 clicked = property(was_clicked)
 
 moved = property(has_moved)
 
 red = property(get_red, set_red)
 
 green = property(get_green, set_green)
 
 blue = property(get_blue, set_blue)
 
 version = property(get_version)
 
 connect_red = property(get_connect_red, set_connect_red)
 
 connect_green = property(get_connect_green, set_connect_green)
 
 connect_blue = property(get_connect_blue, set_connect_blue)
 
 int_timeout = property(get_int_timeout, set_int_timeout)
 

Detailed Description

QwiicTwist.

Parameters
addressThe I2C address to use for the device. If not provided, the default address is used.
i2c_driverAn existing i2c driver object. If not provided a driver object is created.
Returns
The Twist device object.

Constructor & Destructor Documentation

◆ __init__()

def qwiic_twist.QwiicTwist.__init__ (   self,
  address = None,
  i2c_driver = None 
)

Member Function Documentation

◆ begin()

def qwiic_twist.QwiicTwist.begin (   self)

Initialize the operation of the Twist module.

Returns
bool Returns true of the initializtion was successful, otherwise False.

◆ clear_interrupts()

def qwiic_twist.QwiicTwist.clear_interrupts (   self)

Clears the moved, clicked, and pressed bits.

Returns
No return Value

◆ connect_color()

def qwiic_twist.QwiicTwist.connect_color (   self,
  red,
  green,
  blue 
)

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
redRed component
greenGreen component
blueBlue component
Returns
No return value

◆ get_blue()

def qwiic_twist.QwiicTwist.get_blue (   self)

Gets the blue color of the encoder LEDs.

Returns
integer blue component of the color

◆ get_connect_blue()

def qwiic_twist.QwiicTwist.get_connect_blue (   self)

Gets the connect blue color of the encoder LEDs.

Returns
Blue component of the color

◆ get_connect_green()

def qwiic_twist.QwiicTwist.get_connect_green (   self)

Gets the connect green color of the encoder LEDs.

Returns
green component of the color

◆ get_connect_red()

def qwiic_twist.QwiicTwist.get_connect_red (   self)

Gets the connect red color of the encoder LEDs.

Returns
Red component of the color

◆ get_count()

def qwiic_twist.QwiicTwist.get_count (   self)

Returns the number of indents the user has twisted the knob.

Returns
word as integer number of indents

◆ get_diff()

def qwiic_twist.QwiicTwist.get_diff (   self,
  clear_value = False 
)

Returns the number of ticks since last check.

Parameters
clearValueSet to True to clear the current value. Default is False
Returns
integer the difference

◆ get_green()

def qwiic_twist.QwiicTwist.get_green (   self)

Gets the green color of the encoder LEDs.

Returns
integer green component of the color

◆ get_int_timeout()

def qwiic_twist.QwiicTwist.get_int_timeout (   self)

Get number of milliseconds that elapse between end of knob turning and interrupt firing.

Returns
integer the timeout value

◆ get_limit()

def qwiic_twist.QwiicTwist.get_limit (   self)

Returns the limit of allowed counts before wrapping.

0 is disabled

Returns
integer The limit

◆ get_red()

def qwiic_twist.QwiicTwist.get_red (   self)

Gets the red color of the encoder LEDs.

Returns
Red component of the color

◆ get_version()

def qwiic_twist.QwiicTwist.get_version (   self)

Returns a integer of the firmware version number.

Returns
integer The firmware version

◆ has_moved()

def qwiic_twist.QwiicTwist.has_moved (   self)

Returns true if knob has been twisted.

Returns
Boolean Moved state

◆ is_connected()

def qwiic_twist.QwiicTwist.is_connected (   self)

Determine if a Tesit device is conntected to the system.

Returns
bool True if the device is connected, otherwise False.

◆ is_pressed()

def qwiic_twist.QwiicTwist.is_pressed (   self)

Returns true if button is currently being pressed.

Returns
Boolean Button pressed state

◆ set_blue()

def qwiic_twist.QwiicTwist.set_blue (   self,
  blue 
)

Sets the blue color of the encoder LEDs.

Parameters
blueblue component
Returns
No return value

◆ set_color()

def qwiic_twist.QwiicTwist.set_color (   self,
  red,
  green,
  blue 
)

Sets the color of the encoder LEDs.

Parameters
redRed component
greenGreen component
blueBlue component
Returns
No return value

◆ set_connect_blue()

def qwiic_twist.QwiicTwist.set_connect_blue (   self,
  blue 
)

Sets the connect blue color of the encoder LEDs.

Parameters
blueblue component
Returns
No return value

◆ set_connect_green()

def qwiic_twist.QwiicTwist.set_connect_green (   self,
  green 
)

Sets the connect green color of the encoder LEDs.

Parameters
greenGreen component
Returns
No return value

◆ set_connect_red()

def qwiic_twist.QwiicTwist.set_connect_red (   self,
  red 
)

Sets the connect red color of the encoder LEDs.

Parameters
redRed component
Returns
No return value

◆ set_count()

def qwiic_twist.QwiicTwist.set_count (   self,
  amount 
)

Set the encoder count to a specific amount.

Parameters
amountthe value to set the counter to
Returns
no return value

◆ set_green()

def qwiic_twist.QwiicTwist.set_green (   self,
  green 
)

Sets the green color of the encoder LEDs.

Parameters
greenGreen component
Returns
integer No return value

◆ set_int_timeout()

def qwiic_twist.QwiicTwist.set_int_timeout (   self,
  timeout 
)

Set number of milliseconds that elapse between end of knob turning and interrupt firing.

Parameters
timeoutthe timeout value in milliseconds
Returns
No return value

◆ set_limit()

def qwiic_twist.QwiicTwist.set_limit (   self,
  amount 
)

Set the encoder count limit to a specific amount.

Parameters
amountthe value to set the limit to
Returns
no return value

◆ set_red()

def qwiic_twist.QwiicTwist.set_red (   self,
  red 
)

Sets the red color of the encoder LEDs.

Parameters
redRed component
Returns
No return value

◆ since_last_movement()

def qwiic_twist.QwiicTwist.since_last_movement (   self,
  clear_value = True 
)

Returns the number of milliseconds since the last encoder movement By default, clear the current value.

Parameters
clearValueClear out the value? True by default
Returns
integer time since last encoder movement

◆ since_last_press()

def qwiic_twist.QwiicTwist.since_last_press (   self,
  clear_value = True 
)

Returns the number of milliseconds since the last button event (press and release) By default, clear the current value.

Parameters
clearValueClear out the value? False by default
Returns
integer time since last button press

◆ was_clicked()

def qwiic_twist.QwiicTwist.was_clicked (   self)

Returns true if a click event has occurred.

Returns
Boolean Click event state

Member Data Documentation

◆ address

qwiic_twist.QwiicTwist.address

◆ available_addresses

qwiic_twist.QwiicTwist.available_addresses = _AVAILABLE_I2C_ADDRESS
static

◆ device_name

qwiic_twist.QwiicTwist.device_name = _DEFAULT_NAME
static

Property Documentation

◆ blue

qwiic_twist.QwiicTwist.blue = property(get_blue, set_blue)
static

◆ clicked

qwiic_twist.QwiicTwist.clicked = property(was_clicked)
static

◆ connect_blue

qwiic_twist.QwiicTwist.connect_blue = property(get_connect_blue, set_connect_blue)
static

◆ connect_green

qwiic_twist.QwiicTwist.connect_green = property(get_connect_green, set_connect_green)
static

◆ connect_red

qwiic_twist.QwiicTwist.connect_red = property(get_connect_red, set_connect_red)
static

◆ connected

qwiic_twist.QwiicTwist.connected = property(is_connected)
static

◆ count

qwiic_twist.QwiicTwist.count = property(get_count, set_count)
static

◆ green

qwiic_twist.QwiicTwist.green = property(get_green, set_green)
static

◆ int_timeout

qwiic_twist.QwiicTwist.int_timeout = property(get_int_timeout, set_int_timeout)
static

◆ limit

qwiic_twist.QwiicTwist.limit = property(get_limit, set_limit)
static

◆ moved

qwiic_twist.QwiicTwist.moved = property(has_moved)
static

◆ pressed

qwiic_twist.QwiicTwist.pressed = property(is_pressed)
static

◆ red

qwiic_twist.QwiicTwist.red = property(get_red, set_red)
static

◆ version

qwiic_twist.QwiicTwist.version = property(get_version)
static

The documentation for this class was generated from the following file: