diff --git a/src/graphics_core.rs b/src/graphics_core.rs index fcd2e55..e3f9493 100644 --- a/src/graphics_core.rs +++ b/src/graphics_core.rs @@ -1,5 +1,4 @@ use crate::Ili9341; - use embedded_graphics_core::{ pixelcolor::{raw::RawU16, Rgb565}, prelude::*, @@ -82,4 +81,8 @@ where Ok(()) } } + + fn clear(&mut self, color: Self::Color) -> Result<(), Self::Error> { + self.clear_screen(RawU16::from(color).into_inner()) + } } diff --git a/src/lib.rs b/src/lib.rs index 294f6e3..0bd3f0c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -313,6 +313,12 @@ where self.landscape = mode.is_landscape(); Ok(()) } + + /// Fill entire screen with specfied color u16 value + pub fn clear_screen(&mut self, color: u16) -> Result { + let color = core::iter::repeat(color).take(self.width * self.height); + self.draw_raw_iter(0, 0, self.width as u16, self.height as u16, color) + } } impl Ili9341 {