|
SBK_HT16K33 library 2.0.0
Standalone Arduino library to control HT16K33 LED matrices or bar meters via I2C. Can be used directly or as a driver for SBK_BarDrive animations.
|
I2C driver wrapper for HT16K33 compatible with SBK_BarMeter and SBK_BarDrive. More...
#include <SBK_HT16K33.h>
Public Member Functions | |
| SBK_HT16K33 (uint8_t devsNum=1) | |
| Construct a new SBK_HT16K33 instance. | |
| ~SBK_HT16K33 () | |
| Destructor. Frees allocated buffer memory. | |
| void | setDriverRows (uint8_t devIdx, uint8_t rowsCount=8) |
| Set the number of active rows (anode outputs) for a specific HT16K33 device. | |
| uint8_t | maxRows (uint8_t devIdx) const |
| Returns the number of active row lines (anode outputs) for a specific HT16K33 device. | |
| uint8_t | maxColumns () const |
| Returns the number of active column lines (cathode outputs = C0–C7) configured for this instance. | |
| uint8_t | maxSegments (uint8_t devIdx) const |
| Returns the total number of addressable LED segments for the specified device. | |
| uint8_t | setAddress (uint8_t devIdx, uint8_t addr) |
| Set the I2C address for a specific HT16K33 device. | |
| void | begin () |
| Initialize the HT16K33 device at a given I2C address. | |
| void | clear (uint8_t devIdx) |
| Clear the display buffer for the specified device. | |
| void | clear () |
| Clear the display buffers for all devices. | |
| void | setBrightness (uint8_t devIdx, uint8_t brightness) |
| Set the brightness level (0–15) for a specific device. | |
| void | setBrightness (uint8_t brightness) |
| Set the brightness level (0–15) for all devices. | |
| uint8_t | devsNum () const |
| Returns the number of active HT16K33 devices managed by this driver instance. | |
| void | setLed (uint8_t devIdx, uint8_t rowIdx, uint8_t colIdx, bool state) |
| Set the state of an individual LED for a specific device. | |
| bool | getLed (uint8_t devIdx, uint8_t rowIdx, uint8_t colIdx) const |
| Get the current state of an LED from the internal display buffer. | |
| void | show (uint8_t devIdx) |
| Push the internal display buffer to a specific device. | |
| void | show () |
| Push the internal display buffer to all devices. | |
I2C driver wrapper for HT16K33 compatible with SBK_BarMeter and SBK_BarDrive.
| SBK_HT16K33::SBK_HT16K33 | ( | uint8_t | devsNum = 1 | ) |
Construct a new SBK_HT16K33 instance.
| devsNum | Number of HT16K33 devices included this driver instance (up to 8). Default is 1. |
| void SBK_HT16K33::clear | ( | ) |
Clear the display buffers for all devices.
This clears the internal LED state buffers across all managed HT16K33 devices. Call .show() afterward to push the changes to the physical displays.
| void SBK_HT16K33::clear | ( | uint8_t | devIdx | ) |
Clear the display buffer for the specified device.
| devIdx | Index of the target device (0–7). |
This clears the internal buffer for a single HT16K33 device. Call .show(devIdx) to apply the cleared state to the hardware.
|
inline |
Returns the number of active HT16K33 devices managed by this driver instance.
| bool SBK_HT16K33::getLed | ( | uint8_t | devIdx, |
| uint8_t | rowIdx, | ||
| uint8_t | colIdx ) const |
Get the current state of an LED from the internal display buffer.
| devIdx | Not used (for API compatibility only). |
| rowIdx | Row index (0–7). |
| colIdx | Column index (0–15). |
This function reads the last known LED state from the driver’s RAM buffer. It does not query the physical device directly.
|
inline |
Returns the number of active column lines (cathode outputs = C0–C7) configured for this instance.
Each column corresponds to a HT16K33 C-line (C0–C7), controlling the cathode side of the LEDs. This defines how many columns (scan lines) are used in the matrix.
|
inline |
Returns the number of active row lines (anode outputs) for a specific HT16K33 device.
| devIdx | Index of the target device (0–7). |
Each row corresponds to a physical R-line (R0–R15) on the HT16K33 chip, which controls the anode side of the matrix. The number of active rows depends on the chip package:
This function returns the current row configuration for the specified device, which can be set using setDriverRows().
|
inline |
Returns the total number of addressable LED segments for the specified device.
| devIdx | Index of the device (0–7). |
Computed as: maxRows(devIdx) × maxColumns()
This represents the number of individually addressable LEDs (or matrix pixels) available on the specified HT16K33 device, depending on its configured row count.
HT16K33 supports up to:
| uint8_t SBK_HT16K33::setAddress | ( | uint8_t | devIdx, |
| uint8_t | addr ) |
Set the I2C address for a specific HT16K33 device.
By default, device 0 uses address 0x70, device 1 uses 0x71, ..., up to device 7 using 0x77. This function allows you to override that default address mapping.
| devIdx | Device Index (0–7). |
| addr | I2C address to assign (must be in range 0x70–0x77). |
| void SBK_HT16K33::setBrightness | ( | uint8_t | brightness | ) |
Set the brightness level (0–15) for all devices.
| brightness | Brightness level (0 = dimmest, 15 = brightest). |
This function applies the specified brightness level to all HT16K33 devices managed by this driver instance.
| void SBK_HT16K33::setBrightness | ( | uint8_t | devIdx, |
| uint8_t | brightness ) |
Set the brightness level (0–15) for a specific device.
| devIdx | Index of the target device (0–7). |
| brightness | Brightness level (0 = dimmest, 15 = brightest). |
This function sets the brightness for a single HT16K33 device. It is API-compatible with the MAX72xx interface used in SBK_BarDrive.
|
inline |
Set the number of active rows (anode outputs) for a specific HT16K33 device.
| devIdx | Index of the target device (0–7). |
| rowsCount | Number of active row lines (must be 8, 12, or 16).Default is 8. |
HT16K33 comes in multiple package variants that determine the number of available anode outputs:
Use this function to limit the active row count per device if you're using a smaller variant.
| void SBK_HT16K33::setLed | ( | uint8_t | devIdx, |
| uint8_t | rowIdx, | ||
| uint8_t | colIdx, | ||
| bool | state ) |
Set the state of an individual LED for a specific device.
| devIdx | Index of the target device (0–7). |
| rowIdx | Row index (0 to maxRows(devIdx) - 1). |
| colIdx | Column index (0 to maxColumns() - 1). |
| state | true = LED ON, false = LED OFF. |
This function updates the internal buffer for a single LED on a specific HT16K33 device. You must call .show() to apply the changes to the physical display.
| void SBK_HT16K33::show | ( | ) |
Push the internal display buffer to all devices.
This sends the buffered LED states to all HT16K33 devices managed by this driver. Use this to update the entire display after modifying any LED states.
| void SBK_HT16K33::show | ( | uint8_t | devIdx | ) |
Push the internal display buffer to a specific device.
| devIdx | Index of the target device (0–7). |
This sends the buffered LED states to the physical HT16K33 display for the specified device only.