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();
Errors

If the underlying C++ library returns a null pointer when trying to create the CLedMatrix.

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

Casts the value.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Casts the value.

Casts the value.

Casts the value.

Performs the conversion.

Performs the conversion.

Casts the value.

OverflowingCasts the value.

Casts the value.

Casts the value.

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.

Casts the value.

UnwrappedCasts the value.

Casts the value.

WrappingCasts the value.