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

  dinPin | Data input pin (MOSI)
  clkPin | Clock pin (SCK)
  csPin | Chip select pin (CS/SS)
  numDigits | Number 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

  mode | Display 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

  times | Number of blinks (default: 3)
  delayMs | Delay 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

  delayMs | Delay 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

  from | Starting value
  to | Ending value
  delayMs | Delay 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

  from | Starting value
  to | Ending value
  delayMs | Delay 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

  text | Text 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

  number | Floating point value to display
  decimals | Number 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

  number | Integer value to display

Definition at line 184 of file MAX7219_CH32.cpp.

## ◆ display() [4/4]

void MAX7219::display | ( | long | number | ) |

Display long number.

Parameters

  number | Long 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

  position | Digit position (0-based)
  character | Character to display
  dp | true 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

  position | Digit position (0-based)
  value | Numeric value (0-9)
  dp | true 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

  value | Value 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

  value | Value 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

  hours | Hours (0-99)
  minutes | Minutes (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

  hours | Hours (0-99)
  minutes | Minutes (0-59)
  seconds | Seconds (0-59)

Definition at line 262 of file MAX7219_CH32.cpp.

## ◆ fadeIn()

void MAX7219::fadeIn | ( | uint16_t | delayMs = 50 | ) |

Fade in animation.

Parameters

  delayMs | Delay 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

  delayMs | Delay 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

  text | Text to scroll
  delayMs | Delay 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

  number | Number to scroll
  delayMs | Delay 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

  alignment | Alignment 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

  level | Brightness 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

  mode | Display 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

  on | true 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

  position | Digit position (0-based)
  value | Raw digit value
  dp | true 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

  position | Digit position (0-based)
  segments | Bit 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:

- src/MAX7219_CH32.h
- src/MAX7219_CH32.cpp