Control Surface  1.1.1
MIDI Control Surface library for Arduino
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
MAX7219SevenSegmentDisplay Class Reference

A class for 8-digit 7-segment displays with a MAX7219 driver. More...

#include <AH/Hardware/LEDs/MAX7219SevenSegmentDisplay.hpp>

Inheritance diagram for MAX7219SevenSegmentDisplay:
Collaboration diagram for MAX7219SevenSegmentDisplay:

Public Member Functions

 MAX7219SevenSegmentDisplay (pin_t loadPin)
 Create a MAX7219SevenSegmentDisplay. More...
 
void begin ()
 Initialize. More...
 
uint8_t display (long number, uint8_t startDigit=0, uint8_t endDigit=7)
 Display a long integer number to the display. More...
 
uint8_t display (const char *text, uint8_t startPos=0)
 Display a string of text to the display. More...
 
template<uint8_t N>
uint8_t display (const uint8_t(&characters)[N], uint8_t startPos=0)
 ? More...
 
void printHex (uint8_t digit, uint8_t value)
 Print a single hexadecimal digit. More...
 
void init ()
 Initialize the Arduino pins, SPI, and the MAX7219. More...
 
void clear ()
 Turn off all LEDs. More...
 
void send (uint8_t digit, uint8_t value)
 Send the value to the given digit. More...
 
void sendRaw (uint8_t opcode, uint8_t value)
 Send a raw opcode and value to the MAX7219. More...
 
void setIntensity (uint8_t intensity)
 Set the intensity of the LEDs. More...
 

Static Public Attributes

static constexpr uint8_t DECODEMODE = 9
 
static constexpr uint8_t INTENSITY = 10
 
static constexpr uint8_t SCANLIMIT = 11
 
static constexpr uint8_t SHUTDOWN = 12
 
static constexpr uint8_t DISPLAYTEST = 15
 

Private Attributes

pin_t loadPin
 
SPISettings settings = {SPI_MAX_SPEED, MSBFIRST, SPI_MODE0}
 

Detailed Description

A class for 8-digit 7-segment displays with a MAX7219 driver.

Definition at line 49 of file MAX7219SevenSegmentDisplay.hpp.

Constructor & Destructor Documentation

◆ MAX7219SevenSegmentDisplay()

MAX7219SevenSegmentDisplay ( pin_t  loadPin)
inline

Create a MAX7219SevenSegmentDisplay.

Parameters
loadPinThe pin connected to the load pin (C̄S̄) of the MAX7219.

Definition at line 57 of file MAX7219SevenSegmentDisplay.hpp.

Member Function Documentation

◆ begin()

void begin ( )
inline

Initialize.

See also
MAX7219::init

Definition at line 61 of file MAX7219SevenSegmentDisplay.hpp.

◆ display() [1/3]

uint8_t display ( long  number,
uint8_t  startDigit = 0,
uint8_t  endDigit = 7 
)
inline

Display a long integer number to the display.

The number will be right-aligned.

Parameters
numberThe number to display.
startDigitThe digit (zero-based, counting from the right) to start printing the number.
Digits: 7 6 5 4 3 2 1 0
endDigitThe last digit (zero-based, counting from the right) that can be printed. If the number is larger than endDigit - startDigit, the number is truncated on the left. If the number is smaller than endDigit - startDigit, the leftmost digits including endDigit are cleared.
Returns
The number of digits that have been overwritten (endDigit - startDigit).

Definition at line 83 of file MAX7219SevenSegmentDisplay.hpp.

◆ display() [2/3]

uint8_t display ( const char *  text,
uint8_t  startPos = 0 
)
inline

Display a string of text to the display.

Full stops are printed to the decimal point between characters.

Parameters
textThe null-terminated string to display.
startPosThe position to start printing.

Definition at line 108 of file MAX7219SevenSegmentDisplay.hpp.

◆ display() [3/3]

uint8_t display ( const uint8_t(&)  characters[N],
uint8_t  startPos = 0 
)
inline

?

Todo:
Find out what this function does, and write documentation.

Definition at line 141 of file MAX7219SevenSegmentDisplay.hpp.

◆ printHex()

void printHex ( uint8_t  digit,
uint8_t  value 
)
inline

Print a single hexadecimal digit.

Parameters
digitThe digit to print to [0, 7].
valueThe 4-bit value to print [0, 15].
Todo:
Rename to printHexChar and create function that actually prints longer hexadecimal numbers.

Definition at line 164 of file MAX7219SevenSegmentDisplay.hpp.

◆ init()

void init ( )
inlineinherited

Initialize the Arduino pins, SPI, and the MAX7219.

Todo:
Rename to begin.

Definition at line 43 of file MAX7219_Base.hpp.

◆ clear()

void clear ( )
inlineinherited

Turn off all LEDs.

Definition at line 58 of file MAX7219_Base.hpp.

◆ send()

void send ( uint8_t  digit,
uint8_t  value 
)
inlineinherited

Send the value to the given digit.

Parameters
digitThe digit or row to set [0, 7].
valueThe value to set the row to.

Definition at line 71 of file MAX7219_Base.hpp.

◆ sendRaw()

void sendRaw ( uint8_t  opcode,
uint8_t  value 
)
inlineinherited

Send a raw opcode and value to the MAX7219.

Parameters
opcodeThe opcode to send.
valueThe value to send.

Definition at line 83 of file MAX7219_Base.hpp.

◆ setIntensity()

void setIntensity ( uint8_t  intensity)
inlineinherited

Set the intensity of the LEDs.

Parameters
intensityThe intensity [0, 15].

Definition at line 98 of file MAX7219_Base.hpp.

Member Data Documentation

◆ DECODEMODE

constexpr uint8_t DECODEMODE = 9
staticconstexprinherited

Definition at line 33 of file MAX7219_Base.hpp.

◆ INTENSITY

constexpr uint8_t INTENSITY = 10
staticconstexprinherited

Definition at line 34 of file MAX7219_Base.hpp.

◆ SCANLIMIT

constexpr uint8_t SCANLIMIT = 11
staticconstexprinherited

Definition at line 35 of file MAX7219_Base.hpp.

◆ SHUTDOWN

constexpr uint8_t SHUTDOWN = 12
staticconstexprinherited

Definition at line 36 of file MAX7219_Base.hpp.

◆ DISPLAYTEST

constexpr uint8_t DISPLAYTEST = 15
staticconstexprinherited

Definition at line 37 of file MAX7219_Base.hpp.

◆ loadPin

pin_t loadPin
privateinherited

Definition at line 103 of file MAX7219_Base.hpp.

◆ settings

SPISettings settings = {SPI_MAX_SPEED, MSBFIRST, SPI_MODE0}
privateinherited

Definition at line 104 of file MAX7219_Base.hpp.


The documentation for this class was generated from the following file: