12 unstable releases (3 breaking)
0.4.0 | Jan 5, 2022 |
---|---|
0.3.1 | Dec 4, 2021 |
0.2.2 | Sep 26, 2020 |
0.1.5 | Aug 31, 2020 |
0.1.1 | Feb 12, 2018 |
#651 in Hardware support
1MB
5K
SLoC
rpi-led-matrix
Safe rust bindings on top of the C++ library rpi-rgb-led-matrix
.
Usage
The examples have more detailed usage, but here is basic usage to get things rendering on your display.
use rpi_led_matrix::{LedMatrix, LedColor};
let matrix = LedMatrix::new(None, None).unwrap();
let mut canvas = matrix.offscreen_canvas();
for red in 0..255 {
for green in 0..255 {
for blue in 0..255 {
canvas.fill(&LedColor { red, green, blue });
canvas = matrix.swap(canvas);
}
}
}
Note that if you have wirings other than the libraries "default", you will need to construct arguments to the library to specify the layout. See LedMatrixOptions
for more information.
Documentation
lib.rs
:
Rust bindings for the C++ library rpi-rgb-led-matrix.
Example Usage
use rpi_led_matrix::{LedMatrix, LedColor};
let matrix = LedMatrix::new(None, None).unwrap();
let mut canvas = matrix.offscreen_canvas();
for red in (0..255).step_by(16) {
for green in (0..255).step_by(16) {
for blue in (0..255).step_by(16) {
canvas.fill(&LedColor { red, green, blue });
canvas = matrix.swap(canvas);
}
}
}
Features
embeddedgraphics
(default)
pulls in the embedded-graphics
crate and implements
DrawTarget
so that you can use all of the
embedded-graphics
abstractions.
args
Pulls in clap
, enabling the args
module which adds LED matrix arguments for
configuration to your clap::App
.
c-stubs
Passthrough argument to rpi-led-matrix-sys
. See their documentation for more info.
stdcpp-static-link
Passthrough argument to rpi-led-matrix-sys
. See their documentation for more info.