From 7f1497414649382bde3adaf6c1cdd3cb36780a63 Mon Sep 17 00:00:00 2001 From: finga Date: Sat, 2 Apr 2022 18:35:48 +0200 Subject: [PATCH] fw-rust: Remove unnecessary `Draw` trait --- firmware/rust/src/screen/home.rs | 6 ++---- firmware/rust/src/screen/mod.rs | 4 ---- firmware/rust/src/screen/setup.rs | 6 ++---- firmware/rust/src/screen/splash.rs | 5 ++--- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/firmware/rust/src/screen/home.rs b/firmware/rust/src/screen/home.rs index b54c704..03aa376 100644 --- a/firmware/rust/src/screen/home.rs +++ b/firmware/rust/src/screen/home.rs @@ -1,4 +1,4 @@ -use super::{Draw, Event, Screens, Setup, Splash}; +use super::{Event, Screens, Setup, Splash}; use crate::{ assets::{OFF, ON, PLL_A, PLL_B}, lcd::Lcd, @@ -93,10 +93,8 @@ impl Home { Event::None } -} -impl Draw for Home { - fn draw(&self, lcd: &mut Lcd) { + pub fn draw(&self, lcd: &mut Lcd) { match &self.active { Selection::Ch1 => { lcd.print_inverted(0, 0, "CH1"); diff --git a/firmware/rust/src/screen/mod.rs b/firmware/rust/src/screen/mod.rs index 80a5181..e8ab78c 100644 --- a/firmware/rust/src/screen/mod.rs +++ b/firmware/rust/src/screen/mod.rs @@ -23,10 +23,6 @@ pub enum Event { None, } -pub trait Draw { - fn draw(&self, lcd: &mut Lcd); -} - pub enum Screens { Splash(Splash), Home(Home), diff --git a/firmware/rust/src/screen/setup.rs b/firmware/rust/src/screen/setup.rs index dd38809..4de2cf8 100644 --- a/firmware/rust/src/screen/setup.rs +++ b/firmware/rust/src/screen/setup.rs @@ -1,4 +1,4 @@ -use super::{Draw, Event, Home, Screens}; +use super::{Event, Home, Screens}; use crate::{eeprom, lcd::Lcd, Input, BACKLIGHT, CONTRAST}; enum Selection { @@ -106,10 +106,8 @@ impl Setup { Event::None } -} -impl Draw for Setup { - fn draw(&self, lcd: &mut Lcd) { + pub fn draw(&self, lcd: &mut Lcd) { match &self.active { Selection::Contrast => { lcd.fill_area(0, 0, 33, 2, 0xFF); diff --git a/firmware/rust/src/screen/splash.rs b/firmware/rust/src/screen/splash.rs index fcbbafa..d31774d 100644 --- a/firmware/rust/src/screen/splash.rs +++ b/firmware/rust/src/screen/splash.rs @@ -1,4 +1,3 @@ -use super::Draw; use crate::{ assets::{ONDERS_ORG, SACRED_CHAO}, lcd::Lcd, @@ -9,8 +8,8 @@ use nb::block; pub struct Splash; -impl Draw for Splash { - fn draw(&self, lcd: &mut Lcd) { +impl Splash { + pub fn draw(&self, lcd: &mut Lcd) { let mut delay = Delay::::new(); for (i, page) in SACRED_CHAO.iter().enumerate() {