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

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 on screen canvas.

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

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.