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<LedMatrix, &'static str>
pub fn new(
options: Option<LedMatrixOptions>,
rt_options: Option<LedRuntimeOptions>
) -> Result<LedMatrix, &'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();
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;
}