API Reference¶
qwiic_alphanumeric¶
Python module for the SparkFun Qwiic Alphanumeric displays.
This package is a port of the existing [SparkFun Alphanumeric Display Arduino Library](https://github.com/sparkfun/SparkFun_Alphanumeric_Display_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_alphanumeric.QwiicAlphanumeric(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 a driver is created.
- Returns
The QwiicAlphanumeric device object.
- Return type
Object
- begin(address_display_one=112, address_display_two=255, address_display_three=255, address_display_four=255)[source]¶
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_one – I2C address of first display
address_display_two – I2C address of the second display
address_dispplay_three – I2C address of the third display
address_display_four – I2C address of the fourth display
- Returns
Returns true if a Qwiic Alphanumeric is connected to the system. False otherwise.
- Return type
bool
- clear()[source]¶
Turn off all segments of all displays connected to bus
- Returns
True if display was updated correctly, false otherwise
- Return type
bool
- colon_off()[source]¶
Turn the colon off for all displays on the bus
- Returns
true if all displays are successfully updated, false otherwise.
- Return type
bool
- colon_off_single(display_number)[source]¶
Turn the colon off for a single display
- Parameters
display_number – number of display to update.
- Returns
true if display updated successfully, false otherwise.
- Return type
bool
- colon_on()[source]¶
Turn the colon on for all displays on the bus
- Returns
true if displays successfully updated, false otherwise.
- Return type
bool
- colon_on_single(display_number)[source]¶
Turn the colon on for a single display
- Parameters
display_number – number of display to update.
- Returns
true if display updated successfully, false otherwise.
- Return type
bool
- decimal_off()[source]¶
Turn the decimal point off for all displays on the bus
- Returns
true if displays are updated successfully, false otherwise.
- Return type
bool
- decimal_off_single(display_number)[source]¶
Turn the decimal point off for a single display
- Parameters
display_number – the number of display to turn the decimal point off for.
- Returns
true if decimal is successfully turned off, false otherwise.
- Return type
bool
- decimal_on()[source]¶
Turn the decimal on for all displays on the bus
- Returns
true if displays are updated successfully, false otherwise.
- Return type
bool
- decimal_on_single(display_number)[source]¶
Turn the decimal point on for a single display
- Parameters
display_number – the number of display to turn the decimal on for.
- Returns
true if decimal is successfully turned on, false otherwise.
- Return type
bool
- disable_system_clock()[source]¶
Turn off the system oscillator for all displays on the bus
- Returns
True if all clocks successfully disabled, false otherwise.
- Return type
bool
- disable_system_clock_single(display_number)[source]¶
Turn off the system oscillator for standby mode
- Parameters
display_number – number of display on I2C bus to disable the system clock for.
- Returns
True if setting updated successfully, false otherwise.
- Return type
bool
- display_off()[source]¶
Turn off all displays on the I2C bus
- Returns
True if all displays are successfully turned off, false otherwise.
- Return type
bool
- display_off_single(display_number)[source]¶
Turn a single alphanumeric display off
- Parameters
display_number – the number of display to be updated
- Returns
True if display is successfully turned off, false otherwise
- Return type
bool
- display_on()[source]¶
Turn on all displays on the I2C bus
- Returns
True if displays are successfully turned on, false otherwise.
- Return type
bool
- display_on_single(display_number)[source]¶
Turn a single alphanumeric display on
- Parameters
display_number – the number of display to be updated
- Returns
True if display is successfully turned on, false otherwise
- Return type
bool
- enable_system_clock()[source]¶
Turn on the system oscillator for all displays on the I2C bus
- Returns
True if all clocks successfully enabled, false otherwise.
- Return type
bool
- enable_system_clock_single(display_number)[source]¶
Turn on the system oscillator for normal operation mode
- Parameters
display_number – number of display on I2C bus to enable the system clock for.
- Returns
True if setting updated successfully, false otherwise.
- Return type
bool
- illuminate_char(segments_to_turn_on, digit)[source]¶
Fiven a binary set of segments and a digit, store this data into the RAM array
- Parameters
segments_to_turn_on – list of segments to illuminate which create an alphanumeric character
digit – digit on which to illuminate this char (list of segments)
- Returns
nothing
- Return type
Void
- illuminate_segment(segment, digit)[source]¶
Given a segment and a digit, set the matching bit within the RAM of the Holtek RAM set
- Parameters
segment – the segment to illuminate. There are 14 segments available, so A-N
digit – the digit on the display to turn the segment on. There are 4 digits per display
- Returns
nothing
- Return type
Void
- initialize()[source]¶
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
True if all function calls passed, False if there’s a failure somewhere
- Return type
bool
- is_connected(display_number)[source]¶
Check that dispplays are responding on the I2C bus.
- Parameters
display_number – The number of the display on the bus
- Returns
True if the device is connected, false otherwise.
- Return type
bool
- look_up_display_address(display_number)[source]¶
This function connects the display number to its coressponding address
- Parameters
display_number – number of display on I2C bus. The left-most display is zero and display number increments by 1 with each additional display on bus.
- Returns
The I2C address of given display. 0 if display_number is not valid
- Return type
int
- print(print_string)[source]¶
Print a whole string to the alphanumeric display(s)
- Parameters
print_string – string to be printed
- Returns
true if update_display() is successful, false otherwise
- Return type
bool
- print_char(display_char, digit)[source]¶
Print a character, for a given digit, on display
- Parameters
display_char – the character to be printed to display
digit – the digit position where character should be printed
- Returns
nothing
- Return type
Void
- set_blink_rate(rate)[source]¶
Set the blink rate of all displays on the bus as defined by the datasheet.
- Parameters
rate – Blink 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
True if blink setting is successfully updated, false otherwise.
- Return type
bool
- set_blink_rate_single(display_number, rate)[source]¶
Set the blink rate of a single display on the bus
- Parameters
display_number – the number of display to be updated
rate – Blink 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
True if blink setting is successfully updated, false otherwise.
- Return type
bool
- set_brightness(duty)[source]¶
This function sets the brightness of all displays on the bus. Duty cycle over 16.
- Parameters
duty – Valid between 0 (display off) and 15 (full brightness)
- Returns
True if brightness is successfully updated, false otherwise.
- Return type
bool
- set_brightness_single(display_number, duty)[source]¶
Set the brightness of a single display
- Parameters
display_number – The number of display on the I2C bus.
duty – Over 16. Valid between 0 (display off) and 15 (full brightness)
- Returns
True if brightness is successfully updated, false otherwise.
- Return type
bool
- set_colon_on_off(display_number, turn_on_colon)[source]¶
Set or clear the colon on/off bit
- Parameters
display_number – number of display to update.
turn_on_colon – boolean variable. If true, colon will turn on. If false, colon will turn off.
:return true if display updated successfully, false otherwise. :rtype: bool
- set_decimal_on_off(display_number, turn_on_decimal)[source]¶
Set or clear the decimal on/off bit
- Parameters
display_number – the number of display to update.
turn_on_decimal – boolean variable. If true, will turn decimal on. If false, will turn decimal off.
- Returns
true if the display is updated successfully, false otherwise.
- Return type
bool
- set_display_on_off(display_number, turn_on_display)[source]¶
Set or clear the display on/off bit of a given display number
- Parameters
display_number – the number of display to be updated
turn_on_display – boolean variable. If true, will turn display on. If false, will turn display off
- Returns
True if display is successfully updated, false otherwise.
- Return type
bool
- shift_left(shift_amt=1)[source]¶
Shift the display content to the left a number of digits
- Parameters
shift_amt – the number of digits to shift the string
- Returns
true if display updates successfully, false otherwise.
- Return type
bool
- shift_right(shift_amt=1)[source]¶
Shift the display content to the right a number of digits
- Parameters
shift_amt – the number of digits to shift the string
- Returns
true if display updates successfully, false otherwise.
- Return type
bool