AceSegment
0.7.0
A framework for rendering seven segment LED displays using the TM1637, MAX7219, HT16K33, or 74HC595 controller chips
|
Hardware SPI interface to talk to one or two 74HC595 Shift Register chip(s), using the predefined SPI
global instance.
More...
#include <HardSpiInterface.h>
Public Member Functions | |
HardSpiInterface (T_SPI &spi, uint8_t latchPin) | |
void | begin () const |
Initialize the HardSpiInterface. More... | |
void | end () const |
void | send8 (uint8_t value) const |
Send 8 bits, including latching LOW and HIGH. | |
void | send16 (uint16_t value) const |
Send 16 bits, including latching LOW and HIGH. | |
void | send16 (uint8_t msb, uint8_t lsb) const |
Send two 8-bit bytes as a single 16-bit stream, including latching LOW and HIGH. | |
Hardware SPI interface to talk to one or two 74HC595 Shift Register chip(s), using the predefined SPI
global instance.
This is currently not meant to be general-purpose SPI interface. For different SPI configurations, it is probably easiest to just copy this file, make the necessary changes, then substitute the new class in places where this class is used.
The maximum speed of MAX7219 is 16MHz so this class sets the SPI speed to 8MHz. It's not clear if the SPI speed is worth making into a configurable parameter. Such a change needs to done a bit carefully, because it should be a template parameter so that SPISettings
is a compile-time constant which allows compile-time optimizations to happen.
The ESP32 has 2 user-accessible SPI buses (HSPI and VSPI), and so does the STM32F1 (SPI1 and SPI2). By default, the predefined SPI instance is used, but a user-defined secondary SPI instance can be passed into the constructor.
T_SPI | the class of the hardware SPI instance, usually SPIClass |
Definition at line 54 of file HardSpiInterface.h.
|
inline |
Initialize the HardSpiInterface.
The hardware SPI object must be initialized using SPI.begin()
as well.
Definition at line 83 of file HardSpiInterface.h.