pub trait LedPixelShape {
fn size() -> Size;
fn pixel_index(point: Point) -> Option<usize>;
fn pixel_len() -> usize { ... }
}
Available on crate features
embedded-graphics-core
and unstable
only.Expand description
LED pixel shape
Required Methods§
sourcefn pixel_index(point: Point) -> Option<usize>
fn pixel_index(point: Point) -> Option<usize>
Convert from point
to the index.
Returns None
if it is out of the bounds.
Provided Methods§
sourcefn pixel_len() -> usize
fn pixel_len() -> usize
Returns the number of pixels
Examples found in repository?
src/lib_embedded_graphics.rs (line 76)
73 74 75 76 77 78 79 80 81 82 83 84 85
pub fn new(channel_num: u8, gpio_num: u32) -> Result<Self, Ws2812Esp32RmtDriverError> {
let driver = Ws2812Esp32RmtDriver::new(channel_num, gpio_num)?;
let data = std::iter::repeat(0)
.take(S::pixel_len() * CDev::BPP)
.collect::<Vec<_>>();
Ok(Self {
driver,
data,
brightness: u8::MAX,
changed: true,
_phantom: Default::default(),
})
}