[−][src]Trait tiny_led_matrix::Matrix
Description of a device's LED layout.
This describes the correspondence between the visible layout of LEDs and the pins controlling them.
Example implementation
struct SimpleMatrix (); impl Matrix for SimpleMatrix { const MATRIX_COLS: usize = 2; const MATRIX_ROWS: usize = 3; const IMAGE_COLS: usize = 3; const IMAGE_ROWS: usize = 2; fn image_coordinates(col: usize, row: usize) -> Option<(usize, usize)> { Some((row, col)) } }
Associated Constants
const MATRIX_COLS: usize
The number of pins connected to LED columns.
At present this can be at most 16.
const MATRIX_ROWS: usize
The number of pins connected to LED rows.
This should normally be a small number (eg 3).
const IMAGE_COLS: usize
The number of visible LED columns.
const IMAGE_ROWS: usize
The number of visible LED rows.
Required methods
fn image_coordinates(col: usize, row: usize) -> Option<(usize, usize)>
Returns the image coordinates (x, y) to use for the LED at (col, row).
Returns None if (col, row) doesn't control an LED.
Otherwise the return value is in (0..IMAGE_COLS, 0..IMAGE_ROWS), with (0, 0) representing the top left.
Panics
Panics if the provided col and row are out of range 0..MATRIX_COLS and 0..MATRIX_ROWS.