firmware for my Touchscreen E-Paper Input Module for Framework Laptop 16
1use embedded_graphics::Drawable;
2use embedded_graphics::mono_font::{ascii, MonoTextStyle};
3use embedded_graphics::pixelcolor::BinaryColor;
4use embedded_graphics::prelude::Point;
5use embedded_graphics::text::Text;
6use eepy_gui::draw_target::EpdDrawTarget;
7use eepy_gui::element::button::Button;
8use eepy_gui::element::{Gui, DEFAULT_TEXT_STYLE};
9use eepy_sys::input_common::Event;
10use eepy_sys::misc::get_serial;
11use crate::ui::MainGui;
12use crate::ui::page::main::MainPage;
13
14const SMALL_ITALIC_TEXT_STYLE: MonoTextStyle<BinaryColor> = MonoTextStyle::new(&ascii::FONT_6X13_ITALIC, BinaryColor::On);
15
16pub(crate) struct AboutPage {
17 back_button: Button<'static>,
18}
19
20impl Default for AboutPage {
21 fn default() -> Self {
22 Self {
23 back_button: Button::with_default_style_auto_sized(Point::new(10, 10), "Back", true),
24 }
25 }
26}
27
28impl Gui for AboutPage {
29 type Output = Option<MainGui>;
30
31 fn draw_init(&self, target: &mut EpdDrawTarget) {
32 Text::new(concat!("eepyOS (Launcher ", env!("CARGO_PKG_VERSION"), ")"), Point::new(5, 190), DEFAULT_TEXT_STYLE)
33 .draw(target)
34 .unwrap();
35 Text::new(concat!("built ", env!("EEPY_LAUNCHER_BUILD_DATE")), Point::new(27, 210), SMALL_ITALIC_TEXT_STYLE)
36 .draw(target)
37 .unwrap();
38 Text::new("Serial number: ", Point::new(27, 240), SMALL_ITALIC_TEXT_STYLE)
39 .draw(target)
40 .unwrap();
41 Text::new(get_serial(), Point::new(27 + 6 * "Serial number: ".len() as i32, 240), SMALL_ITALIC_TEXT_STYLE)
42 .draw(target)
43 .unwrap();
44 Text::new("(c) 2025 arthomnix - MIT licensed", Point::new(18, 384), SMALL_ITALIC_TEXT_STYLE)
45 .draw(target)
46 .unwrap();
47 Text::new("https://tangled.org/@arthomnix.dev/eepy", Point::new(3, 400), SMALL_ITALIC_TEXT_STYLE)
48 .draw(target)
49 .unwrap();
50 self.back_button.draw_init(target);
51 }
52
53 fn tick(&mut self, target: &mut EpdDrawTarget, ev: Event) -> Self::Output {
54 let bb_out = self.back_button.tick(target, ev);
55 if bb_out.clicked {
56 return Some(MainGui::MainPage(MainPage::new()));
57 } else if bb_out.needs_refresh {
58 target.refresh(true);
59 }
60
61 None
62 }
63}