use embedded_graphics::{
Drawable,
mono_font::{MonoFont, MonoTextStyle, ascii::FONT_9X15_BOLD},
prelude::Point,
text::{Baseline, Text},
};
use embedded_hal::spi::SpiDevice;
use super::CydFrameEsp;
pub const DEFAULT_FONT: MonoFont<'static> = FONT_9X15_BOLD;
impl<D: SpiDevice<u8>> CydFrameEsp<'_, D> {
pub fn write_text(&mut self, text: &str) -> &mut Self {
Text::with_baseline(
text,
Point::zero(),
MonoTextStyle::new(self.font, self.foreground565),
Baseline::Top,
)
.draw(self)
.expect("drawing text to an Infallible CYD frame cannot fail");
self
}
}