27 lines
676 B
Rust
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(())
|
|
}
|
|
}
|