tiny_led_matrix/
control.rs

1//! The interface that [`Display`] needs to control an LED matrix.
2//!
3//! [`Display`]: crate::display::Display
4
5
6/// The interface that [`Display`] needs to work with an LED matrix.
7///
8/// Assumes the matrix is organised by rows and columns, in such a way that
9/// LEDs from at most one row are lit at any time.
10///
11/// [`Display`]: crate::display::Display
12
13pub trait DisplayControl {
14
15    /// Performs any required hardware initialisation.
16    ///
17    /// This is intended to be called once, before using a display with this
18    /// DisplayControl.
19    fn initialise_for_display(&mut self);
20
21    /// Lights LEDs in a single matrix row.
22    ///
23    /// In the specified row, lights exactly the LEDs listed in `cols`.
24    /// Turns off all LEDs in the other matrix rows.
25    ///
26    /// In `cols`, the least-significant bit represents column 0, and so on.
27    fn display_row_leds(&mut self, row: usize, cols: u32);
28
29    /// Lights additional LEDs in the current matrix row.
30    ///
31    /// Affects the row most recently passed to `display_row_leds()`.
32    /// Lights the LEDs listed in `cols`, in addition to any already lit.
33    ///
34    /// In `cols`, the least-significant bit represents column 0, and so on.
35    fn light_current_row_leds(&mut self, cols: u32);
36
37}
38