Qwiic_Alphanumeric_Py
Python for SFE Qwiic Alphanumeric
Loading...
Searching...
No Matches
qwiic_alphanumeric.QwiicAlphanumeric Class Reference

QwiicAlphanumeric. More...

Inheritance diagram for qwiic_alphanumeric.QwiicAlphanumeric:

Public Member Functions

def __init__ (self, address=None, i2c_driver=None)
 
def begin (self, address_display_one=_QWIIC_ALPHANUMERIC_DEFAULT_ADDRESS, address_display_two=DEFAULT_NOTHING_ATTACHED, address_display_three=DEFAULT_NOTHING_ATTACHED, address_display_four=DEFAULT_NOTHING_ATTACHED)
 Initialize the operation of the Qwiic Alphanumeric. More...
 
def is_connected (self, display_number)
 Check that dispplays are responding on the I2C bus. More...
 
def initialize (self)
 Run through initialization sequence for each display connected on the I2C bus Enable clocks, set brightness default to full brightness, turn off blinking, and turn all displays on. More...
 
def enable_system_clock (self)
 Turn on the system oscillator for all displays on the I2C bus. More...
 
def disable_system_clock (self)
 Turn off the system oscillator for all displays on the bus. More...
 
def enable_system_clock_single (self, display_number)
 Turn on the system oscillator for normal operation mode. More...
 
def disable_system_clock_single (self, display_number)
 Turn off the system oscillator for standby mode. More...
 
def look_up_display_address (self, display_number)
 This function connects the display number to its coressponding address. More...
 
def clear (self)
 Turn off all segments of all displays connected to bus. More...
 
def set_brightness (self, duty)
 This function sets the brightness of all displays on the bus. More...
 
def set_brightness_single (self, display_number, duty)
 Set the brightness of a single display. More...
 
def set_blink_rate (self, rate)
 Set the blink rate of all displays on the bus as defined by the datasheet. More...
 
def set_blink_rate_single (self, display_number, rate)
 Set the blink rate of a single display on the bus. More...
 
def display_on_single (self, display_number)
 Turn a single alphanumeric display on. More...
 
def display_off_single (self, display_number)
 Turn a single alphanumeric display off. More...
 
def set_display_on_off (self, display_number, turn_on_display)
 Set or clear the display on/off bit of a given display number. More...
 
def display_on (self)
 Turn on all displays on the I2C bus. More...
 
def display_off (self)
 Turn off all displays on the I2C bus. More...
 
def decimal_on_single (self, display_number)
 Turn the decimal point on for a single display. More...
 
def decimal_off_single (self, display_number)
 Turn the decimal point off for a single display. More...
 
def set_decimal_on_off (self, display_number, turn_on_decimal)
 Set or clear the decimal on/off bit. More...
 
def decimal_on (self)
 Turn the decimal on for all displays on the bus. More...
 
def decimal_off (self)
 Turn the decimal point off for all displays on the bus. More...
 
def colon_on_single (self, display_number)
 Turn the colon on for a single display. More...
 
def colon_off_single (self, display_number)
 Turn the colon off for a single display. More...
 
def set_colon_on_off (self, display_number, turn_on_colon)
 Set or clear the colon on/off bit. More...
 
def colon_on (self)
 Turn the colon on for all displays on the bus. More...
 
def colon_off (self)
 Turn the colon off for all displays on the bus. More...
 
def illuminate_segment (self, segment, digit)
 Given a segment and a digit, set the matching bit within the RAM of the Holtek RAM set. More...
 
def illuminate_char (self, segments_to_turn_on, digit)
 Fiven a binary set of segments and a digit, store this data into the RAM array. More...
 
def print_char (self, display_char, digit)
 Print a character, for a given digit, on display. More...
 
def print (self, print_string)
 Print a whole string to the alphanumeric display(s) More...
 
def update_display (self)
 Push the contents of display_RAM out on to the various displays in 16 byte chunks. More...
 
def shift_right (self, shift_amt=1)
 Shift the display content to the right a number of digits. More...
 
def shift_left (self, shift_amt=1)
 Shift the display content to the left a number of digits. More...
 
def write_RAM (self, address, reg, buff)
 Write LED updates to the RAM of the LED driver IC. More...
 
def write_RAM_byte (self, address, data_to_write)
 

Public Attributes

 address
 
 number_of_displays
 
 digit_position
 
 display_on_off
 
 decimal_on_off
 
 colon_on_off
 

Static Public Attributes

 device_name = _DEFAULT_NAME
 
 available_addresses = _AVAILABLE_I2C_ADDRESS
 
int DEFAULT_NOTHING_ATTACHED = 0xFF
 
int SEG_A = 0x0001
 
int SEG_B = 0x0002
 
int SEG_C = 0x0004
 
int SEG_D = 0x0008
 
int SEG_E = 0x0010
 
int SEG_F = 0x0020
 
int SEG_G = 0x0040
 
int SEG_H = 0x0080
 
int SEG_I = 0x0100
 
int SEG_J = 0x0200
 
int SEG_K = 0x0400
 
int SEG_L = 0x0800
 
int SEG_M = 0x1000
 
int SEG_N = 0x2000
 
int ALPHA_BLINK_RATE_NOBLINK = 0b00
 
int ALPHA_BLINK_RATE_2HZ = 0b01
 
int ALPHA_BLINK_RATE_1HZ = 0b10
 
int ALPHA_BLINK_RATE_0_5HZ = 0b11
 
int ALPHA_DISPLAY_ON = 0b1
 
int ALPHA_DISPLAY_OFF = 0b0
 
int ALPHA_DECIMAL_ON = 0b1
 
int ALPHA_DECIMAL_OFF = 0b0
 
int ALPHA_COLON_ON = 0b1
 
int ALPHA_COLON_OFF = 0b0
 
int ALPHA_CMD_SYSTEM_SETUP = 0b00100000
 
int ALPHA_CMD_DISPLAY_SETUP = 0b10000000
 
int ALPHA_CMD_DIMMING_SETUP = 0b11100000
 
int SFE_ALPHANUM_UNKNOWN_CHAR = 95
 
list alphanumeric_segs = []
 
int digit_position = 0
 
int number_of_displays = 1
 
int display_on_off = 0
 
int decimal_on_off = 0
 
int colon_on_off = 0
 
int blink_rate = ALPHA_BLINK_RATE_NOBLINK
 
list display_RAM = [0] * 16 * 4
 
list display_content = [' '] * (4 * 4 + 1)
 

Detailed Description

QwiicAlphanumeric.

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 a driver is created.
Returns
The

Constructor & Destructor Documentation

◆ __init__()

def qwiic_alphanumeric.QwiicAlphanumeric.__init__ (   self,
  address = None,
  i2c_driver = None 
)

Member Function Documentation

◆ begin()

def qwiic_alphanumeric.QwiicAlphanumeric.begin (   self,
  address_display_one = _QWIIC_ALPHANUMERIC_DEFAULT_ADDRESS,
  address_display_two = DEFAULT_NOTHING_ATTACHED,
  address_display_three = DEFAULT_NOTHING_ATTACHED,
  address_display_four = DEFAULT_NOTHING_ATTACHED 
)

Initialize the operation of the Qwiic Alphanumeric.

Assign addresses to displays and determine the number of displays connected to the bus. Run is_connected(). Initialize and clear displays.

Parameters
address_display_oneI2C address of first display
address_display_twoI2C address of the second display
address_dispplay_threeI2C address of the third display
address_display_fourI2C address of the fourth display
Returns
bool Returns true if a Qwiic Alphanumeric is connected to the system. False otherwise.

◆ clear()

def qwiic_alphanumeric.QwiicAlphanumeric.clear (   self)

Turn off all segments of all displays connected to bus.

Returns
bool True if display was updated correctly, false otherwise

◆ colon_off()

def qwiic_alphanumeric.QwiicAlphanumeric.colon_off (   self)

Turn the colon off for all displays on the bus.

Returns
bool true if all displays are successfully updated, false otherwise.

◆ colon_off_single()

def qwiic_alphanumeric.QwiicAlphanumeric.colon_off_single (   self,
  display_number 
)

Turn the colon off for a single display.

Parameters
display_numbernumber of display to update.
Returns
bool true if display updated successfully, false otherwise.

◆ colon_on()

def qwiic_alphanumeric.QwiicAlphanumeric.colon_on (   self)

Turn the colon on for all displays on the bus.

Returns
bool true if displays successfully updated, false otherwise.

◆ colon_on_single()

def qwiic_alphanumeric.QwiicAlphanumeric.colon_on_single (   self,
  display_number 
)

Turn the colon on for a single display.

Parameters
display_numbernumber of display to update.
Returns
bool true if display updated successfully, false otherwise.

◆ decimal_off()

def qwiic_alphanumeric.QwiicAlphanumeric.decimal_off (   self)

Turn the decimal point off for all displays on the bus.

Returns
bool true if displays are updated successfully, false otherwise.

◆ decimal_off_single()

def qwiic_alphanumeric.QwiicAlphanumeric.decimal_off_single (   self,
  display_number 
)

Turn the decimal point off for a single display.

Parameters
display_numberthe number of display to turn the decimal point off for.
Returns
bool true if decimal is successfully turned off, false otherwise.

◆ decimal_on()

def qwiic_alphanumeric.QwiicAlphanumeric.decimal_on (   self)

Turn the decimal on for all displays on the bus.

Returns
bool true if displays are updated successfully, false otherwise.

◆ decimal_on_single()

def qwiic_alphanumeric.QwiicAlphanumeric.decimal_on_single (   self,
  display_number 
)

Turn the decimal point on for a single display.

Parameters
display_numberthe number of display to turn the decimal on for.
Returns
bool true if decimal is successfully turned on, false otherwise.

◆ disable_system_clock()

def qwiic_alphanumeric.QwiicAlphanumeric.disable_system_clock (   self)

Turn off the system oscillator for all displays on the bus.

Returns
bool True if all clocks successfully disabled, false otherwise.

◆ disable_system_clock_single()

def qwiic_alphanumeric.QwiicAlphanumeric.disable_system_clock_single (   self,
  display_number 
)

Turn off the system oscillator for standby mode.

Parameters
display_numbernumber of display on I2C bus to disable the system clock for.
Returns
bool True if setting updated successfully, false otherwise.

◆ display_off()

def qwiic_alphanumeric.QwiicAlphanumeric.display_off (   self)

Turn off all displays on the I2C bus.

Returns
bool True if all displays are successfully turned off, false otherwise.

◆ display_off_single()

def qwiic_alphanumeric.QwiicAlphanumeric.display_off_single (   self,
  display_number 
)

Turn a single alphanumeric display off.

Parameters
display_numberthe number of display to be updated
Returns
bool True if display is successfully turned off, false otherwise

◆ display_on()

def qwiic_alphanumeric.QwiicAlphanumeric.display_on (   self)

Turn on all displays on the I2C bus.

Returns
bool True if displays are successfully turned on, false otherwise.

◆ display_on_single()

def qwiic_alphanumeric.QwiicAlphanumeric.display_on_single (   self,
  display_number 
)

Turn a single alphanumeric display on.

Parameters
display_numberthe number of display to be updated
Returns
bool True if display is successfully turned on, false otherwise

◆ enable_system_clock()

def qwiic_alphanumeric.QwiicAlphanumeric.enable_system_clock (   self)

Turn on the system oscillator for all displays on the I2C bus.

Returns
bool True if all clocks successfully enabled, false otherwise.

◆ enable_system_clock_single()

def qwiic_alphanumeric.QwiicAlphanumeric.enable_system_clock_single (   self,
  display_number 
)

Turn on the system oscillator for normal operation mode.

Parameters
display_numbernumber of display on I2C bus to enable the system clock for.
Returns
bool True if setting updated successfully, false otherwise.

◆ illuminate_char()

def qwiic_alphanumeric.QwiicAlphanumeric.illuminate_char (   self,
  segments_to_turn_on,
  digit 
)

Fiven a binary set of segments and a digit, store this data into the RAM array.

Parameters
segments_to_turn_onlist of segments to illuminate which create an alphanumeric character
digitdigit on which to illuminate this char (list of segments)
Returns
Void nothing

◆ illuminate_segment()

def qwiic_alphanumeric.QwiicAlphanumeric.illuminate_segment (   self,
  segment,
  digit 
)

Given a segment and a digit, set the matching bit within the RAM of the Holtek RAM set.

Parameters
segmentthe segment to illuminate. There are 14 segments available, so A-N
digitthe digit on the display to turn the segment on. There are 4 digits per display
Returns
Void nothing

◆ initialize()

def qwiic_alphanumeric.QwiicAlphanumeric.initialize (   self)

Run through initialization sequence for each display connected on the I2C bus Enable clocks, set brightness default to full brightness, turn off blinking, and turn all displays on.

Returns
bool True if all function calls passed, False if there's a failure somewhere

◆ is_connected()

def qwiic_alphanumeric.QwiicAlphanumeric.is_connected (   self,
  display_number 
)

Check that dispplays are responding on the I2C bus.

Parameters
display_numberThe number of the display on the bus
Returns
bool True if the device is connected, false otherwise.

◆ look_up_display_address()

def qwiic_alphanumeric.QwiicAlphanumeric.look_up_display_address (   self,
  display_number 
)

This function connects the display number to its coressponding address.

Parameters
display_numbernumber of display on I2C bus. The left-most display is zero and display number increments by 1 with each additional display on bus.
Returns
int The I2C address of given display. 0 if display_number is not valid

◆ print()

def qwiic_alphanumeric.QwiicAlphanumeric.print (   self,
  print_string 
)

Print a whole string to the alphanumeric display(s)

Parameters
print_stringstring to be printed
Returns
bool true if update_display() is successful, false otherwise

◆ print_char()

def qwiic_alphanumeric.QwiicAlphanumeric.print_char (   self,
  display_char,
  digit 
)

Print a character, for a given digit, on display.

Parameters
display_charthe character to be printed to display
digitthe digit position where character should be printed
Returns
Void nothing

◆ set_blink_rate()

def qwiic_alphanumeric.QwiicAlphanumeric.set_blink_rate (   self,
  rate 
)

Set the blink rate of all displays on the bus as defined by the datasheet.

Parameters
rateBlink frequency in Hz. Valid options are defined by datasheet: 2.0, 1.0, or 0.5 Hz. Any other input to this function will result in steady alphanumeric display (no blink).
Returns
bool True if blink setting is successfully updated, false otherwise.

◆ set_blink_rate_single()

def qwiic_alphanumeric.QwiicAlphanumeric.set_blink_rate_single (   self,
  display_number,
  rate 
)

Set the blink rate of a single display on the bus.

Parameters
display_numberthe number of display to be updated
rateBlink frequency in Hz. Valid options are defined by datasheet: 2.0, 1.0, or 0.5 Hz. Any other input to this function will result in steady alphanumeric display (no blink).
Returns
bool True if blink setting is successfully updated, false otherwise.

◆ set_brightness()

def qwiic_alphanumeric.QwiicAlphanumeric.set_brightness (   self,
  duty 
)

This function sets the brightness of all displays on the bus.

Duty cycle over 16.

Parameters
dutyValid between 0 (1/16 brightnss) and 15 (full brightness)
Returns
bool True if brightness is successfully updated, false otherwise.

◆ set_brightness_single()

def qwiic_alphanumeric.QwiicAlphanumeric.set_brightness_single (   self,
  display_number,
  duty 
)

Set the brightness of a single display.

Parameters
display_numberThe number of display on the I2C bus.
dutyOver 16. Valid between 0 (display off) and 15 (full brightness)
Returns
bool True if brightness is successfully updated, false otherwise.

◆ set_colon_on_off()

def qwiic_alphanumeric.QwiicAlphanumeric.set_colon_on_off (   self,
  display_number,
  turn_on_colon 
)

Set or clear the colon on/off bit.

Parameters
display_numbernumber of display to update.
turn_on_colonboolean variable. If true, colon will turn on. If false, colon will turn off.

◆ set_decimal_on_off()

def qwiic_alphanumeric.QwiicAlphanumeric.set_decimal_on_off (   self,
  display_number,
  turn_on_decimal 
)

Set or clear the decimal on/off bit.

Parameters
display_numberthe number of display to update.
turn_on_decimalboolean variable. If true, will turn decimal on. If false, will turn decimal off.
Returns
bool true if the display is updated successfully, false otherwise.

◆ set_display_on_off()

def qwiic_alphanumeric.QwiicAlphanumeric.set_display_on_off (   self,
  display_number,
  turn_on_display 
)

Set or clear the display on/off bit of a given display number.

Parameters
display_numberthe number of display to be updated
turn_on_displayboolean variable. If true, will turn display on. If false, will turn display off
Returns
bool True if display is successfully updated, false otherwise.

◆ shift_left()

def qwiic_alphanumeric.QwiicAlphanumeric.shift_left (   self,
  shift_amt = 1 
)

Shift the display content to the left a number of digits.

Parameters
shift_amtthe number of digits to shift the string
Returns
bool true if display updates successfully, false otherwise.

◆ shift_right()

def qwiic_alphanumeric.QwiicAlphanumeric.shift_right (   self,
  shift_amt = 1 
)

Shift the display content to the right a number of digits.

Parameters
shift_amtthe number of digits to shift the string
Returns
bool true if display updates successfully, false otherwise.

◆ update_display()

def qwiic_alphanumeric.QwiicAlphanumeric.update_display (   self)

Push the contents of display_RAM out on to the various displays in 16 byte chunks.

Returns
bool true if displays are updated successfully, false otherwise.

◆ write_RAM()

def qwiic_alphanumeric.QwiicAlphanumeric.write_RAM (   self,
  address,
  reg,
  buff 
)

Write LED updates to the RAM of the LED driver IC.

Parameters
addressI2C address of the display
regthe location in RAM to write to
buffthe bytes to be written
Returns
bool true if RAM has been written to successfully, false otherwise.

◆ write_RAM_byte()

def qwiic_alphanumeric.QwiicAlphanumeric.write_RAM_byte (   self,
  address,
  data_to_write 
)

Member Data Documentation

◆ address

qwiic_alphanumeric.QwiicAlphanumeric.address

◆ ALPHA_BLINK_RATE_0_5HZ

int qwiic_alphanumeric.QwiicAlphanumeric.ALPHA_BLINK_RATE_0_5HZ = 0b11
static

◆ ALPHA_BLINK_RATE_1HZ

int qwiic_alphanumeric.QwiicAlphanumeric.ALPHA_BLINK_RATE_1HZ = 0b10
static

◆ ALPHA_BLINK_RATE_2HZ

int qwiic_alphanumeric.QwiicAlphanumeric.ALPHA_BLINK_RATE_2HZ = 0b01
static

◆ ALPHA_BLINK_RATE_NOBLINK

int qwiic_alphanumeric.QwiicAlphanumeric.ALPHA_BLINK_RATE_NOBLINK = 0b00
static

◆ ALPHA_CMD_DIMMING_SETUP

int qwiic_alphanumeric.QwiicAlphanumeric.ALPHA_CMD_DIMMING_SETUP = 0b11100000
static

◆ ALPHA_CMD_DISPLAY_SETUP

int qwiic_alphanumeric.QwiicAlphanumeric.ALPHA_CMD_DISPLAY_SETUP = 0b10000000
static

◆ ALPHA_CMD_SYSTEM_SETUP

int qwiic_alphanumeric.QwiicAlphanumeric.ALPHA_CMD_SYSTEM_SETUP = 0b00100000
static

◆ ALPHA_COLON_OFF

int qwiic_alphanumeric.QwiicAlphanumeric.ALPHA_COLON_OFF = 0b0
static

◆ ALPHA_COLON_ON

int qwiic_alphanumeric.QwiicAlphanumeric.ALPHA_COLON_ON = 0b1
static

◆ ALPHA_DECIMAL_OFF

int qwiic_alphanumeric.QwiicAlphanumeric.ALPHA_DECIMAL_OFF = 0b0
static

◆ ALPHA_DECIMAL_ON

int qwiic_alphanumeric.QwiicAlphanumeric.ALPHA_DECIMAL_ON = 0b1
static

◆ ALPHA_DISPLAY_OFF

int qwiic_alphanumeric.QwiicAlphanumeric.ALPHA_DISPLAY_OFF = 0b0
static

◆ ALPHA_DISPLAY_ON

int qwiic_alphanumeric.QwiicAlphanumeric.ALPHA_DISPLAY_ON = 0b1
static

◆ alphanumeric_segs

list qwiic_alphanumeric.QwiicAlphanumeric.alphanumeric_segs = []
static

◆ available_addresses

qwiic_alphanumeric.QwiicAlphanumeric.available_addresses = _AVAILABLE_I2C_ADDRESS
static

◆ blink_rate

int qwiic_alphanumeric.QwiicAlphanumeric.blink_rate = ALPHA_BLINK_RATE_NOBLINK
static

◆ colon_on_off [1/2]

int qwiic_alphanumeric.QwiicAlphanumeric.colon_on_off = 0
static

◆ colon_on_off [2/2]

qwiic_alphanumeric.QwiicAlphanumeric.colon_on_off

◆ decimal_on_off [1/2]

int qwiic_alphanumeric.QwiicAlphanumeric.decimal_on_off = 0
static

◆ decimal_on_off [2/2]

qwiic_alphanumeric.QwiicAlphanumeric.decimal_on_off

◆ DEFAULT_NOTHING_ATTACHED

int qwiic_alphanumeric.QwiicAlphanumeric.DEFAULT_NOTHING_ATTACHED = 0xFF
static

◆ device_name

qwiic_alphanumeric.QwiicAlphanumeric.device_name = _DEFAULT_NAME
static

◆ digit_position [1/2]

int qwiic_alphanumeric.QwiicAlphanumeric.digit_position = 0
static

◆ digit_position [2/2]

qwiic_alphanumeric.QwiicAlphanumeric.digit_position

◆ display_content

list qwiic_alphanumeric.QwiicAlphanumeric.display_content = [' '] * (4 * 4 + 1)
static

◆ display_on_off [1/2]

int qwiic_alphanumeric.QwiicAlphanumeric.display_on_off = 0
static

◆ display_on_off [2/2]

qwiic_alphanumeric.QwiicAlphanumeric.display_on_off

◆ display_RAM

list qwiic_alphanumeric.QwiicAlphanumeric.display_RAM = [0] * 16 * 4
static

◆ number_of_displays [1/2]

int qwiic_alphanumeric.QwiicAlphanumeric.number_of_displays = 1
static

◆ number_of_displays [2/2]

qwiic_alphanumeric.QwiicAlphanumeric.number_of_displays

◆ SEG_A

int qwiic_alphanumeric.QwiicAlphanumeric.SEG_A = 0x0001
static

◆ SEG_B

int qwiic_alphanumeric.QwiicAlphanumeric.SEG_B = 0x0002
static

◆ SEG_C

int qwiic_alphanumeric.QwiicAlphanumeric.SEG_C = 0x0004
static

◆ SEG_D

int qwiic_alphanumeric.QwiicAlphanumeric.SEG_D = 0x0008
static

◆ SEG_E

int qwiic_alphanumeric.QwiicAlphanumeric.SEG_E = 0x0010
static

◆ SEG_F

int qwiic_alphanumeric.QwiicAlphanumeric.SEG_F = 0x0020
static

◆ SEG_G

int qwiic_alphanumeric.QwiicAlphanumeric.SEG_G = 0x0040
static

◆ SEG_H

int qwiic_alphanumeric.QwiicAlphanumeric.SEG_H = 0x0080
static

◆ SEG_I

int qwiic_alphanumeric.QwiicAlphanumeric.SEG_I = 0x0100
static

◆ SEG_J

int qwiic_alphanumeric.QwiicAlphanumeric.SEG_J = 0x0200
static

◆ SEG_K

int qwiic_alphanumeric.QwiicAlphanumeric.SEG_K = 0x0400
static

◆ SEG_L

int qwiic_alphanumeric.QwiicAlphanumeric.SEG_L = 0x0800
static

◆ SEG_M

int qwiic_alphanumeric.QwiicAlphanumeric.SEG_M = 0x1000
static

◆ SEG_N

int qwiic_alphanumeric.QwiicAlphanumeric.SEG_N = 0x2000
static

◆ SFE_ALPHANUM_UNKNOWN_CHAR

int qwiic_alphanumeric.QwiicAlphanumeric.SFE_ALPHANUM_UNKNOWN_CHAR = 95
static

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