#led-matrix #max7219 #driver #arduino #micro-controller #port #maxmatrix

maxmatrix_rs

A Rust driver for the MAX7219 LED matrix driver

3 releases

0.1.2 Jun 4, 2024
0.1.1 Jun 4, 2024
0.1.0 Jun 4, 2024

#961 in Hardware support

MIT license

13KB
228 lines

About

A Rust port of the MaxMatrix Library for Arduino Development

I ported this library from the C++ version. Credits go to riyas-org max7219 library

Installation

This Rust library has to be used with the Arduino Hal for Rust.

maxmatrix_rs = 0.1.2

lib.rs:

This Library enables communication between a Microcontroller and the MAX7219 LED Matrix Driver.

Example:

#![no_std]
#![no_main]

use panic_halt as _;

use maxmatrix_rs::*;

#[arduino_hal::entry]
fn main() -> ! {
    let dp = arduino_hal::Peripherals::take().unwrap();
    let pins = arduino_hal::pins!(dp);
   
    let din = pins.d3.into_output();
    let cs = pins.d5.into_output();
    let clk = pins.d6.into_output();

    let mut matrix = MaxMatrix::new(din, cs, clk, 4);
    matrix.init();

    loop {
        matrix.set_dot(0, 0, true);
        arduino_hal::delay_ms(500);
        matrix.set_dot(0, 0, false);
        arduino_hal::delay_ms(500);
    }
}

Dependencies

~71KB