Struct rpi_led_matrix::LedMatrix [−][src]
pub struct LedMatrix { /* fields omitted */ }
Expand description
The Rust handle for the RGB matrix.
use rpi_led_matrix::{LedMatrix, LedColor};
let matrix = LedMatrix::new(None, None).unwrap();
Implementations
pub fn new(
options: Option<LedMatrixOptions>,
rt_options: Option<LedRuntimeOptions>
) -> Result<Self, &'static str>
pub fn new(
options: Option<LedMatrixOptions>,
rt_options: Option<LedRuntimeOptions>
) -> Result<Self, &'static str>
Creates the rust handle for the RGB matrix, given the optional options.
use rpi_led_matrix::{LedMatrix, LedColor, LedMatrixOptions};
let mut options = LedMatrixOptions::new();
options.set_hardware_mapping("adafruit-hat-pwm");
let matrix = LedMatrix::new(Some(options), None).unwrap();
Errors
If the underlying C++ library returns a null pointer when trying to create
the CLedMatrix
.
Retrieves the offscreen canvas. Used in conjunction with swap.
Cleanly swaps the canvas on v-sync, returning the off-screen canvas for updating.
use rpi_led_matrix::{LedMatrix, LedColor};
let matrix = LedMatrix::new(None, None).unwrap();
let mut canvas = matrix.offscreen_canvas();
let mut color = LedColor { red: 0, green: 0, blue: 0 };
while(color.red < 255) {
canvas.fill(&color);
canvas = matrix.swap(canvas);
color.red += 1;
}
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for LedMatrix
impl UnwindSafe for LedMatrix
Blanket Implementations
Mutably borrows from an owned value. Read more
Casts the value.
Casts the value.
Casts the value.
OverflowingCasts the value.
Casts the value.
Casts the value.
Casts the value.
UnwrappedCasts the value.
Casts the value.
WrappingCasts the value.