rust: Add LCD shutdown function

This commit is contained in:
Wladimir J. van der Laan 2020-02-07 18:01:02 +00:00
parent 9e6c9f5a8f
commit 8806f01455

View File

@ -147,6 +147,7 @@ pub trait LCDHL {
fn set_direction(&mut self, dir: direction); fn set_direction(&mut self, dir: direction);
fn clear(&self, color: u16); fn clear(&self, color: u16);
fn draw_picture(&self, x1: u16, y1: u16, width: u16, height: u16, data: &[u32]); fn draw_picture(&self, x1: u16, y1: u16, width: u16, height: u16, data: &[u32]);
fn shutdown(&mut self);
} }
impl<'a, X: SPI> LCD<'a, X> { impl<'a, X: SPI> LCD<'a, X> {
@ -327,6 +328,10 @@ impl<X: SPI> LCDHL for LCD<'_, X> {
self.write_command(command::DISPLAY_ON); self.write_command(command::DISPLAY_ON);
} }
fn shutdown(&mut self) {
self.set_rst(false);
}
fn set_direction(&mut self, dir: direction) { fn set_direction(&mut self, dir: direction) {
if ((dir as u8) & DIR_XY_MASK) != 0 { if ((dir as u8) & DIR_XY_MASK) != 0 {
self.width = LCD_Y_MAX; self.width = LCD_Y_MAX;