firmware for my Touchscreen E-Paper Input Module for Framework Laptop 16
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

eepy-launcher: add about page

arthomnix b1f64dc5 27d116f9

+89 -11
+1
eepy-launcher/build.sh
··· 2 2 3 3 rm -rf out 4 4 mkdir out 5 + export EEPY_LAUNCHER_BUILD_DATE=$(date -I) 5 6 cargo build --release 6 7 elf2epb -i ../target/thumbv6m-none-eabi/release/eepy-launcher -o out/eepy-launcher.s00.epb 7 8 truncate -s 128K out/eepy-launcher.s00.epb
+4
eepy-launcher/src/ui/mod.rs
··· 3 3 use eepy_gui::draw_target::EpdDrawTarget; 4 4 use eepy_gui::element::Gui; 5 5 use eepy_sys::input_common::Event; 6 + use crate::ui::page::about::AboutPage; 6 7 use crate::ui::page::app_info::AppInfoPage; 7 8 use crate::ui::page::main::MainPage; 8 9 use crate::ui::page::scratchpad::ScratchpadPage; ··· 14 15 MainPage(MainPage), 15 16 ScratchpadPage(ScratchpadPage), 16 17 AppInfoPage(AppInfoPage), 18 + AboutPage(AboutPage), 17 19 } 18 20 19 21 impl MainGui { ··· 26 28 MainGui::MainPage(page) => page, 27 29 MainGui::ScratchpadPage(page) => page, 28 30 MainGui::AppInfoPage(page) => page, 31 + MainGui::AboutPage(page) => page, 29 32 } 30 33 } 31 34 ··· 34 37 MainGui::MainPage(page) => page, 35 38 MainGui::ScratchpadPage(page) => page, 36 39 MainGui::AppInfoPage(page) => page, 40 + MainGui::AboutPage(page) => page, 37 41 } 38 42 } 39 43 }
+56
eepy-launcher/src/ui/page/about.rs
··· 1 + use embedded_graphics::Drawable; 2 + use embedded_graphics::mono_font::{ascii, MonoTextStyle}; 3 + use embedded_graphics::pixelcolor::BinaryColor; 4 + use embedded_graphics::prelude::Point; 5 + use embedded_graphics::text::Text; 6 + use eepy_gui::draw_target::EpdDrawTarget; 7 + use eepy_gui::element::button::Button; 8 + use eepy_gui::element::{Gui, DEFAULT_TEXT_STYLE}; 9 + use eepy_sys::input_common::Event; 10 + use crate::ui::MainGui; 11 + use crate::ui::page::main::MainPage; 12 + 13 + const SMALL_ITALIC_TEXT_STYLE: MonoTextStyle<BinaryColor> = MonoTextStyle::new(&ascii::FONT_6X13_ITALIC, BinaryColor::On); 14 + 15 + pub(crate) struct AboutPage { 16 + back_button: Button<'static>, 17 + } 18 + 19 + impl Default for AboutPage { 20 + fn default() -> Self { 21 + Self { 22 + back_button: Button::with_default_style_auto_sized(Point::new(10, 10), "Back", true), 23 + } 24 + } 25 + } 26 + 27 + impl Gui for AboutPage { 28 + type Output = Option<MainGui>; 29 + 30 + fn draw_init(&self, target: &mut EpdDrawTarget) { 31 + Text::new(concat!("eepyOS (Launcher ", env!("CARGO_PKG_VERSION"), ")"), Point::new(5, 190), DEFAULT_TEXT_STYLE) 32 + .draw(target) 33 + .unwrap(); 34 + Text::new(concat!("built ", env!("EEPY_LAUNCHER_BUILD_DATE")), Point::new(40, 210), DEFAULT_TEXT_STYLE) 35 + .draw(target) 36 + .unwrap(); 37 + Text::new("(c) 2025 arthomnix - MIT licensed", Point::new(18, 300), SMALL_ITALIC_TEXT_STYLE) 38 + .draw(target) 39 + .unwrap(); 40 + Text::new("https://tangled.org/@arthomnix.dev/eepy", Point::new(3, 316), SMALL_ITALIC_TEXT_STYLE) 41 + .draw(target) 42 + .unwrap(); 43 + self.back_button.draw_init(target); 44 + } 45 + 46 + fn tick(&mut self, target: &mut EpdDrawTarget, ev: Event) -> Self::Output { 47 + let bb_out = self.back_button.tick(target, ev); 48 + if bb_out.clicked { 49 + return Some(MainGui::MainPage(MainPage::new())); 50 + } else if bb_out.needs_refresh { 51 + target.refresh(true); 52 + } 53 + 54 + None 55 + } 56 + }
+26 -10
eepy-launcher/src/ui/page/main.rs
··· 7 7 use eepy_sys::header::Programs; 8 8 use eepy_sys::input_common::Event; 9 9 use crate::ui::MainGui; 10 + use crate::ui::page::about::AboutPage; 10 11 use crate::ui::page::app_info::AppInfoPage; 11 12 use crate::ui::page::scratchpad::ScratchpadPage; 12 13 13 14 pub(crate) struct MainPage { 14 15 scratchpad_button: Button<'static>, 16 + about_button: Button<'static>, 15 17 app_buttons: [Option<(Button<'static>, u8)>; 32], 16 18 } 17 19 18 20 impl MainPage { 19 - fn app_button(x: usize, y: usize, label: &'static str) -> Button<'static> { 21 + fn grid_button(x: usize, y: usize, label: &'static str, touch_feedback_immediate_release: bool) -> Button<'static> { 20 22 let x_coord = 10 + 115 * x as i32; 21 23 let y_coord = 8 + 25 * y as i32; 22 24 Button::with_default_style( 23 25 Rectangle::new(Point::new(x_coord, y_coord), Size::new(105, 20)), 24 26 label, 25 - false, 27 + touch_feedback_immediate_release, 26 28 ) 27 29 } 28 30 31 + fn app_button(x: usize, y: usize, label: &'static str) -> Button<'static> { 32 + Self::grid_button(x, y, label, false) 33 + } 34 + 29 35 pub(crate) fn refresh_buttons(&mut self) { 30 36 let mut programs = Programs::new(); 31 37 ··· 48 54 49 55 pub(crate) fn new() -> Self { 50 56 let mut res = Self { 51 - scratchpad_button: Button::with_default_style( 52 - Rectangle::new(Point::new(10, 8), Size::new(105, 20)), 53 - "Scratchpad", 54 - true 55 - ), 57 + scratchpad_button: Self::grid_button(0, 0, "Scratchpad", true), 58 + about_button: Self::grid_button(1, 15, "About", true), 56 59 app_buttons: [const { None }; 32], 57 60 }; 58 61 res.refresh_buttons(); ··· 65 68 66 69 fn draw_init(&self, draw_target: &mut EpdDrawTarget) { 67 70 self.scratchpad_button.draw_init(draw_target); 71 + 72 + if self.app_buttons[31].is_none() { 73 + self.about_button.draw_init(draw_target); 74 + } 75 + 68 76 for b in &self.app_buttons { 69 77 if let Some((button, _)) = b { 70 78 button.draw_init(draw_target); ··· 75 83 fn tick(&mut self, draw_target: &mut EpdDrawTarget, ev: Event) -> Self::Output { 76 84 let mut needs_refresh = false; 77 85 78 - let s = self.scratchpad_button.tick(draw_target, ev); 79 - if s.clicked { 86 + let sp_out = self.scratchpad_button.tick(draw_target, ev); 87 + if sp_out.clicked { 80 88 return Some(MainGui::ScratchpadPage(ScratchpadPage::new())); 81 - } else if s.needs_refresh { 89 + } else if sp_out.needs_refresh { 82 90 draw_target.refresh(true); 83 91 } 92 + 93 + let about_out = self.about_button.tick(draw_target, ev); 94 + if about_out.clicked { 95 + return Some(MainGui::AboutPage(AboutPage::default())); 96 + } else if about_out.needs_refresh { 97 + draw_target.refresh(true); 98 + } 99 + 84 100 85 101 for b in &mut self.app_buttons[1..] { 86 102 if let Some((button, s)) = b {
+2 -1
eepy-launcher/src/ui/page/mod.rs
··· 1 1 pub(super) mod main; 2 2 pub(super) mod scratchpad; 3 - pub(super) mod app_info; 3 + pub(super) mod app_info; 4 + pub(super) mod about;