mirror of
https://github.com/yuri91/ili9341-rs.git
synced 2024-11-21 14:30:58 +00:00
Merge pull request #33 from VersBinarii/graphics
Add clear_screen function
This commit is contained in:
commit
d896467aec
2 changed files with 10 additions and 1 deletions
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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> {
|
||||
|
|
Loading…
Reference in a new issue