Files
discount-como/src/display.rs
2026-01-28 19:30:45 +01:00

27 lines
676 B
Rust

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