Merge pull request #33 from VersBinarii/graphics

Add clear_screen function
This commit is contained in:
Yuri Iozzelli 2022-04-19 07:51:18 +02:00 committed by GitHub
commit d896467aec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -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())
}
}

View file

@ -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<IFACE, RESET> Ili9341<IFACE, RESET> {