MAX7219_CH32 Library 1.0.0
A lightweight library for controlling MAX7219 7-segment displays
Loading...
Searching...
No Matches
MAX7219 Class Reference

Main class for controlling MAX7219 7-segment displays. More...

#include <MAX7219_CH32.h>

Public Member Functions

 MAX7219 (uint8_t dinPin, uint8_t clkPin, uint8_t csPin, uint8_t numDigits=8)
 Constructor for MAX7219 display.
void begin ()
 Initialize the display with default mode.
void begin (uint8_t mode)
 Initialize the display with specific mode.
void setMode (uint8_t mode)
 Set decode mode.
uint8_t getMode ()
 Get current mode.
void setAlignment (uint8_t alignment)
 Set text alignment.
uint8_t getAlignment ()
 Get current alignment.
void setBrightness (uint8_t level)
 Set display brightness.
void setPower (bool on)
 Turn display on or off.
void clear ()
 Clear all digits.
void display (const char *text)
 Display text string.
void display (int number)
 Display integer.
void display (long number)
 Display long number.
void display (double number, uint8_t decimals=2)
 Display floating point number.
void displayAt (uint8_t position, uint8_t value, bool dp=false)
 Display value at specific position.
void displayAt (uint8_t position, char character, bool dp=false)
 Display character at specific position.
void displayTime (uint8_t hours, uint8_t minutes)
 Display time in HH:MM format.
void displayTime (uint8_t hours, uint8_t minutes, uint8_t seconds)
 Display time in HH:MM:SS format.
void displayHex (uint32_t value)
 Display value in hexadecimal format.
void displayBinary (uint8_t value)
 Display value in binary format.
void blink (uint8_t times=3, uint16_t delayMs=500)
 Blink the display.
void fadeIn (uint16_t delayMs=50)
 Fade in animation.
void fadeOut (uint16_t delayMs=50)
 Fade out animation.
void scroll (const char *text, uint16_t delayMs=200)
 Scroll text across display.
void scroll (long number, uint16_t delayMs=200)
 Scroll number across display.
void chase (uint16_t delayMs=100)
 Chase animation (digit-by-digit)
void countUp (long from, long to, uint16_t delayMs=100)
 Count up animation.
void countDown (long from, long to, uint16_t delayMs=100)
 Count down animation.
void setSegments (uint8_t position, uint8_t segments)
 Set raw segment pattern at position.
void setRawDigit (uint8_t position, uint8_t value, bool dp=false)
 Set raw digit value at position.

Detailed Description

Main class for controlling MAX7219 7-segment displays.

Definition at line 63 of file MAX7219_CH32.h.

Constructor & Destructor Documentation

◆ MAX7219()

MAX7219::MAX7219 ( uint8_t dinPin,
uint8_t clkPin,
uint8_t csPin,
uint8_t numDigits = 8 )

Constructor for MAX7219 display.

Parameters
dinPinData input pin (MOSI)
clkPinClock pin (SCK)
csPinChip select pin (CS/SS)
numDigitsNumber of digits (1-8, default: 8)

Definition at line 91 of file MAX7219_CH32.cpp.

Member Function Documentation

◆ begin() [1/2]

void MAX7219::begin ( )

Initialize the display with default mode.

Definition at line 104 of file MAX7219_CH32.cpp.

◆ begin() [2/2]

void MAX7219::begin ( uint8_t mode)

Initialize the display with specific mode.

Parameters
modeDisplay mode (MAX7219_MODE_DECODE or MAX7219_MODE_NO_DECODE)

Definition at line 108 of file MAX7219_CH32.cpp.

◆ blink()

void MAX7219::blink ( uint8_t times = 3,
uint16_t delayMs = 500 )

Blink the display.

Parameters
timesNumber of blinks (default: 3)
delayMsDelay between blinks in milliseconds (default: 500)

Definition at line 325 of file MAX7219_CH32.cpp.

◆ chase()

void MAX7219::chase ( uint16_t delayMs = 100)

Chase animation (digit-by-digit)

Parameters
delayMsDelay between steps in milliseconds (default: 100)

Definition at line 375 of file MAX7219_CH32.cpp.

◆ clear()

void MAX7219::clear ( )

Clear all digits.

Definition at line 160 of file MAX7219_CH32.cpp.

◆ countDown()

void MAX7219::countDown ( long from,
long to,
uint16_t delayMs = 100 )

Count down animation.

Parameters
fromStarting value
toEnding value
delayMsDelay between counts in milliseconds (default: 100)

Definition at line 398 of file MAX7219_CH32.cpp.

◆ countUp()

void MAX7219::countUp ( long from,
long to,
uint16_t delayMs = 100 )

Count up animation.

Parameters
fromStarting value
toEnding value
delayMsDelay between counts in milliseconds (default: 100)

Definition at line 389 of file MAX7219_CH32.cpp.

◆ display() [1/4]

void MAX7219::display ( const char * text)

Display text string.

Parameters
textText to display (null-terminated string)

Definition at line 173 of file MAX7219_CH32.cpp.

◆ display() [2/4]

void MAX7219::display ( double number,
uint8_t decimals = 2 )

Display floating point number.

Parameters
numberFloating point value to display
decimalsNumber of decimal places (default: 2)

Definition at line 192 of file MAX7219_CH32.cpp.

◆ display() [3/4]

void MAX7219::display ( int number)

Display integer.

Parameters
numberInteger value to display

Definition at line 184 of file MAX7219_CH32.cpp.

◆ display() [4/4]

void MAX7219::display ( long number)

Display long number.

Parameters
numberLong value to display

Definition at line 188 of file MAX7219_CH32.cpp.

◆ displayAt() [1/2]

void MAX7219::displayAt ( uint8_t position,
char character,
bool dp = false )

Display character at specific position.

Parameters
positionDigit position (0-based)
characterCharacter to display
dptrue to show decimal point (default: false)

Definition at line 214 of file MAX7219_CH32.cpp.

◆ displayAt() [2/2]

void MAX7219::displayAt ( uint8_t position,
uint8_t value,
bool dp = false )

Display value at specific position.

Parameters
positionDigit position (0-based)
valueNumeric value (0-9)
dptrue to show decimal point (default: false)

Definition at line 196 of file MAX7219_CH32.cpp.

◆ displayBinary()

void MAX7219::displayBinary ( uint8_t value)

Display value in binary format.

Parameters
valueValue to display in binary (requires 8 digits)

Definition at line 313 of file MAX7219_CH32.cpp.

◆ displayHex()

void MAX7219::displayHex ( uint32_t value)

Display value in hexadecimal format.

Parameters
valueValue to display in hex

Definition at line 286 of file MAX7219_CH32.cpp.

◆ displayTime() [1/2]

void MAX7219::displayTime ( uint8_t hours,
uint8_t minutes )

Display time in HH:MM format.

Parameters
hoursHours (0-99)
minutesMinutes (0-59)

Definition at line 241 of file MAX7219_CH32.cpp.

◆ displayTime() [2/2]

void MAX7219::displayTime ( uint8_t hours,
uint8_t minutes,
uint8_t seconds )

Display time in HH:MM:SS format.

Parameters
hoursHours (0-99)
minutesMinutes (0-59)
secondsSeconds (0-59)

Definition at line 262 of file MAX7219_CH32.cpp.

◆ fadeIn()

void MAX7219::fadeIn ( uint16_t delayMs = 50)

Fade in animation.

Parameters
delayMsDelay between brightness steps in milliseconds (default: 50)

Definition at line 334 of file MAX7219_CH32.cpp.

◆ fadeOut()

void MAX7219::fadeOut ( uint16_t delayMs = 50)

Fade out animation.

Parameters
delayMsDelay between brightness steps in milliseconds (default: 50)

Definition at line 343 of file MAX7219_CH32.cpp.

◆ getAlignment()

uint8_t MAX7219::getAlignment ( )

Get current alignment.

Returns
Current alignment mode

Definition at line 147 of file MAX7219_CH32.cpp.

◆ getMode()

uint8_t MAX7219::getMode ( )

Get current mode.

Returns
Current display mode

Definition at line 139 of file MAX7219_CH32.cpp.

◆ scroll() [1/2]

void MAX7219::scroll ( const char * text,
uint16_t delayMs = 200 )

Scroll text across display.

Parameters
textText to scroll
delayMsDelay between scroll steps in milliseconds (default: 200)

Definition at line 352 of file MAX7219_CH32.cpp.

◆ scroll() [2/2]

void MAX7219::scroll ( long number,
uint16_t delayMs = 200 )

Scroll number across display.

Parameters
numberNumber to scroll
delayMsDelay between scroll steps in milliseconds (default: 200)

Definition at line 369 of file MAX7219_CH32.cpp.

◆ setAlignment()

void MAX7219::setAlignment ( uint8_t alignment)

Set text alignment.

Parameters
alignmentAlignment mode (MAX7219_ALIGN_LEFT, MAX7219_ALIGN_RIGHT, or MAX7219_ALIGN_CENTER)

Definition at line 143 of file MAX7219_CH32.cpp.

◆ setBrightness()

void MAX7219::setBrightness ( uint8_t level)

Set display brightness.

Parameters
levelBrightness level (0-15, where 0 is dimmest and 15 is brightest)

Definition at line 151 of file MAX7219_CH32.cpp.

◆ setMode()

void MAX7219::setMode ( uint8_t mode)

Set decode mode.

Parameters
modeDisplay mode (MAX7219_MODE_DECODE or MAX7219_MODE_NO_DECODE)

Definition at line 133 of file MAX7219_CH32.cpp.

◆ setPower()

void MAX7219::setPower ( bool on)

Turn display on or off.

Parameters
ontrue to turn on, false to turn off

Definition at line 156 of file MAX7219_CH32.cpp.

◆ setRawDigit()

void MAX7219::setRawDigit ( uint8_t position,
uint8_t value,
bool dp = false )

Set raw digit value at position.

Parameters
positionDigit position (0-based)
valueRaw digit value
dptrue to show decimal point (default: false)

Definition at line 416 of file MAX7219_CH32.cpp.

◆ setSegments()

void MAX7219::setSegments ( uint8_t position,
uint8_t segments )

Set raw segment pattern at position.

Parameters
positionDigit position (0-based)
segmentsBit pattern for segments (DP-A-B-C-D-E-F-G)

Definition at line 410 of file MAX7219_CH32.cpp.


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