Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

Extending HT16K33 library for arrays of displays
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Extending HT16K33 library for arrays of displays

by tim11g on Sun Jul 26, 2020 4:44 pm

I'm using the CircuitPython libarary for the HT16K33 driving 14 segment LED displays.
A Raspberry Pi Zero W with Python3.7 provides the I2C.

I've got the basic configuration working and can use and address the 4 digit display.
My question is how to scale this up to a larger array. Each board is nicely designed to create an array of LED characters horizontally -- Suppose I want to array 3 backpacks for 12 characters.

From the hardware side, it's easy to set the I2C addresses on the backpacks with the A0-2 jumpers.
I can see from the code I would create the class for each by including the address:

Code: Select all | TOGGLE FULL SIZE
display0 = segments.Seg14x4(i2c, 0x70) 
display1 = segments.Seg14x4(i2c, 0x71) 
display2 = segments.Seg14x4(i2c, 0x72) 

But the methods in the class have the 4 digits hard-coded:
Code: Select all | TOGGLE FULL SIZE
        if not 0 <= index <= 3:


Rather than separately dealing with display0, display1, and display2 it seems like it would be cleaner to define a single display class that would support addressing display[0] through display[11], and hide the fact that the display is spread over 3 HT16K33 drivers at 3 I2C addresses.

Because the I2C address is set in the base class HT16K33, I'm not sure how I would structure a "Seg14xN" class that would support an arbitrary number of HT16K33 devices resulting in single logical display. Has anybody done this, or do you have any suggestions on the best way to proceed?

tim11g
 
Posts: 5
Joined: Sat Apr 08, 2017 1:23 pm

Please be positive and constructive with your questions and comments.