[][src]Struct rpi_led_matrix::LedMatrix

pub struct LedMatrix { /* fields omitted */ }

The Rust handle for the RGB matrix.

use rpi_led_matrix::{LedMatrix, LedColor};
let matrix = LedMatrix::new(None, None).unwrap();

Implementations

impl LedMatrix[src]

pub fn new(
    options: Option<LedMatrixOptions>,
    rt_options: Option<LedRuntimeOptions>
) -> Result<LedMatrix, &'static str>
[src]

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

pub fn canvas(&self) -> LedCanvas[src]

Retrieves the on screen canvas.

pub fn offscreen_canvas(&self) -> LedCanvas[src]

Retrieves the offscreen canvas. Used in conjunction with swap.

pub fn swap(&self, canvas: LedCanvas) -> LedCanvas[src]

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

impl Drop for LedMatrix[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.