SBK_MAX72xx library 2.0.5
Low-level driver for controlling multiple MAX7219/MAX7221 LED matrix chips via software SPI.
Loading...
Searching...
No Matches
SBK_MAX72xx Directory Reference

Directories

 
src

Detailed Description

SBK\_MAX72xx Library

Arduino-compatible driver for controlling MAX7219/MAX7221 LED matrix chips. Supports both software and hardware SPI implementations under a unified API, compatible with the SBK_BarDrive animation framework or standalone use.


✅ Features

  • Supports both hardware SPI (SBK_MAX72xxHard) and software SPI (SBK_MAX72xxSoft)
  • Control individual LEDs or full rows on daisy-chained MAX72xx chips
  • Internal buffer system for efficient display updates
  • Compatible with SBK_BarDrive for advanced LED bar meter animations

📦 Installation

  1. Download or clone this repository:

    git clone https://github.com/sbarabe/SBK_MAX72xx.git
  2. Copy it into your Arduino libraries/ folder

🧪 Example (Software SPI)

File: examples/simpleDemo/simpleDemo.ino

SBK_MAX72xxSoft matrix(4, 5, 6, 1); // data, clk, cs, 1 device
void setup() {
matrix.begin();
matrix.setBrightness(0, 10);
matrix.clear(0);
// Light up a diagonal
for (uint8_t i = 0; i < 8; i++) {
matrix.setLed(0, i, i, true);
}
matrix.show(0);
}
void loop() {
// nothing
}
Low-level driver for controlling multiple MAX7219/MAX7221 LED matrix chips via software SPI.
Controls multiple MAX7219/MAX7221 LED drivers via software SPI.
Definition SBK_MAX72xxSoft.h:52

🧪 Example (Hardware SPI)

File: examples/simpleDemo/simpleDemo.ino

SBK_MAX72xxHard matrix(10, 1); // CS pin, 1 device
void setup() {
matrix.begin();
matrix.setSPIClock(2000000); // Optional: Set SPI speed to 2 MHz
matrix.setBrightness(0, 12);
matrix.clear(0);
// Create an X pattern
for (uint8_t i = 0; i < 8; i++) {
matrix.setLed(0, i, i, true);
matrix.setLed(0, i, 7 - i, true);
}
matrix.show(0);
}
void loop() {
// nothing
}
Hardware SPI driver for controlling multiple MAX7219/MAX7221 LED matrix chips.
Controls multiple MAX7219/MAX7221 LED drivers via hardware SPI.
Definition SBK_MAX72xxHard.h:47

🔧 API Overview

Classes

Class Description
SBK_MAX72xxSoft Software SPI driver for MAX72xx chips
SBK_MAX72xxHard Hardware SPI driver for MAX72xx chips

Methods (Common)

Method Description
begin() Initialize SPI pins and MAX72xx chips
clear() Clear all devices
clear(device) Clear specific device
setLed() Set individual LED state
getLed() Get LED state from buffer
setRow() Set all bits in a row
setBrightness() Set display brightness
setScanLimit() Set number of visible digits (0-7)
setShutdown() Enable or disable a device
show() Push buffer content to all devices
show(device) Push buffer content to specific device

Additional (Hardware SPI Only)

Method Description
setSPIClock() Set SPI clock speed
end() End SPI session

🧩 Integration with SBK_BarDrive

To use with SBK_BarDrive:


🪪 License

This library is released under the MIT License.


🫠 Credits

  • Based on the original LedControl library by Eberhard Fahle
  • Extended and maintained by Samuel Barabé (Smart Builds & Kits)