created module for display
WIP
This commit is contained in:
26
src/display.rs
Normal file
26
src/display.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use embedded_graphics::{
|
||||
mono_font::{MonoTextStyle, ascii::{FONT_9X18_BOLD, FONT_10X20}},
|
||||
pixelcolor::BinaryColor,
|
||||
prelude::{DrawTarget, Point, *},
|
||||
text::Text,
|
||||
};
|
||||
|
||||
pub struct CoMoDisplay<D: DrawTarget<Color = BinaryColor>> {
|
||||
display: D,
|
||||
}
|
||||
|
||||
impl<D: DrawTarget<Color = BinaryColor>> CoMoDisplay<D> {
|
||||
pub fn new(display: D) -> Self {
|
||||
Self { display }
|
||||
}
|
||||
|
||||
pub fn draw(&mut self) -> Result<(), D::Error> {
|
||||
let text_style = MonoTextStyle::new(&FONT_10X20, BinaryColor::On);
|
||||
|
||||
self.display.clear(BinaryColor::Off)?;
|
||||
|
||||
Text::new("18,6 Ips", Point::new(50, 40), text_style).draw(&mut self.display)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user