AceSegment
0.11.0
A library for rendering seven segment LED displays using the TM1637, TM1638, MAX7219, HT16K33, or 74HC595 controller chips
|
An LedMatrix that whose group pins are attached to one 74HC595 shift register and the element pins are attached to another 74HC595 shift register. More...
#include <LedMatrixDualHc595.h>
Public Member Functions | |
LedMatrixDualHc595 (const T_SPII &spiInterface, uint8_t elementOnPattern, uint8_t groupOnPattern, uint8_t byteOrder, const uint8_t *remapArrayInverted=nullptr) | |
Constructor. More... | |
void | begin () const |
void | end () const |
void | draw (uint8_t group, uint8_t elementPattern) const |
Write out the group and element patterns in a single 16-bit stream. More... | |
void | enableGroup (uint8_t group) const |
Turn on the given group, using the previous segment pattern. More... | |
void | disableGroup (uint8_t group) const |
Turn off the given group. More... | |
void | clear () const |
Clear the entire display. | |
![]() | |
LedMatrixBase (uint8_t elementOnPattern, uint8_t groupOnPattern) | |
void | begin () const |
Configure the pins for the given LED wiring. | |
void | end () const |
Turn off the pins by doing the opposite of begin(). | |
void | draw (uint8_t, uint8_t) const |
Write element patterns for the given group. | |
void | disableGroup (uint8_t) const |
Disable the elements of given group. | |
void | enableGroup (uint8_t) const |
Enable the elements of given group. | |
void | clear () const |
Clear everything. | |
Friends | |
class | ::LedMatrixDualHc595Test_draw |
class | ::LedMatrixDualHc595Test_enableGroup |
class | ::LedMatrixDualHc595Test_disableGroup |
Additional Inherited Members | |
![]() | |
const uint8_t | mElementXorMask |
const uint8_t | mGroupXorMask |
An LedMatrix that whose group pins are attached to one 74HC595 shift register and the element pins are attached to another 74HC595 shift register.
The 2 shift registers are daisy chained so that they can be accessed in a serial transfer of 16-bits using hardware or software SPI.
The group pins are assumed to be connected to the most significant byte. The element pins are connected to the least signficiant byte.
T_SPII | class that implements the SPI interface, usually one of the classes in the AceSPI library: SimpleSpiInterface, SimpleSpiFastInterface, HardSpiInterface, HardSpiFastInterface. |
Definition at line 56 of file LedMatrixDualHc595.h.
|
inline |
Constructor.
spiInterface | object that knows how to send SPI packets |
elementOnPattern | bit pattern that turns on the elements |
groupOnpattern | bit pattern that turns on the groups |
byteOrder | determine order of group and element bytes |
remapArrayInverted | (optional, nullable) a map of the physical positions to their logical positions, which is the inverse of the remapArray used by Tm1637Module and Max7219Module |
Definition at line 68 of file LedMatrixDualHc595.h.
|
inline |
Turn off the given group.
Useful for blinking a group.
Definition at line 128 of file LedMatrixDualHc595.h.
|
inline |
Write out the group and element patterns in a single 16-bit stream.
The byteOrder parameter determines whether the group bits are in the high byte and element bits in the low byte, or flipped around.
The group
is the desired physical location of elementPattern
. We need to send that pattern to the logical position which will cause it to appear in the correct physical position. That turns out to be a mapping of the physical-to-logical address, which is the inverse of the remapping operation performed in Tm1637Module and Max7219Module. In those classes, we have random access to all the logical segment/element patterns. In this class, we are given just a single digit, but we don't have random access to the other digit patterns, so the remapArray must go the other way. The direction of the remapArray conversion is quite subtle, and it took me 2-3 attempts to get this right. In many (most?) cases, the remapArray and the remapArrayInverted are identical because the digit reordering is caused by pair-wise swapping of the LED modules pins to the controller chip pins. But in the general case, this class needs the inverted mapping.
group | the desired physical position of the elementPattern |
elementPattern | the element (i.e. segment) pattern |
Definition at line 109 of file LedMatrixDualHc595.h.
|
inline |
Turn on the given group, using the previous segment pattern.
Useful for blinking a group (e.g. a digit of an LED segment module).
Definition at line 123 of file LedMatrixDualHc595.h.