Skip to content

Commit 76c43f5

Browse files
Added functions to turn on and turn off the display (#11)
* added functions to turn on and turn off teh display * Fix comments for on/off
1 parent cc825d8 commit 76c43f5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/display.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,16 @@ where
350350
pub fn rotation(&self) -> DisplayRotation {
351351
self.display_rotation
352352
}
353+
354+
/// Turn the display on (eg exiting sleep mode)
355+
pub fn turn_on(&mut self) -> Result<(), Error<CommE, PinE>> {
356+
Command::DisplayOn(true).send(&mut self.spi, &mut self.dc)
357+
}
358+
359+
/// Turn the display off (enter sleep mode)
360+
pub fn turn_off(&mut self) -> Result<(), Error<CommE, PinE>> {
361+
Command::DisplayOn(false).send(&mut self.spi, &mut self.dc)
362+
}
353363
}
354364

355365
#[cfg(feature = "graphics")]

0 commit comments

Comments
 (0)