Implement deep_sleep on Display

This commit is contained in:
Wesley Moore 2018-11-14 15:35:10 +11:00
parent 2b24889e83
commit 071a014ac1
No known key found for this signature in database
GPG key ID: BF67766C0BC2D0EE
2 changed files with 6 additions and 7 deletions

View file

@ -45,9 +45,9 @@ pub enum DeepSleepMode {
/// Not sleeping
Normal,
/// Deep sleep with RAM preserved
Mode1,
PreserveRAM,
/// Deep sleep RAM not preserved
Mode2,
DiscardRAM,
}
pub enum Command {
@ -233,8 +233,8 @@ impl Command {
DeepSleepMode(mode) => {
let mode = match mode {
self::DeepSleepMode::Normal => 0b00,
self::DeepSleepMode::Mode1 => 0b01,
self::DeepSleepMode::Mode2 => 0b11,
self::DeepSleepMode::PreserveRAM => 0b01,
self::DeepSleepMode::DiscardRAM => 0b11,
};
pack!(buf, 0x10, [mode])

View file

@ -1,6 +1,6 @@
use hal;
use command::{BufCommand, Command, DataEntryMode, IncrementAxis};
use command::{BufCommand, Command, DataEntryMode, DeepSleepMode, IncrementAxis};
use interface::DisplayInterface;
// Max display resolution is 160x296
@ -90,7 +90,6 @@ impl<I> Display<I> where I: DisplayInterface {
}
fn deep_sleep(&mut self) -> Result<(), I::Error> {
// TODO: Send DeepSleep command
unimplemented!()
Command::DeepSleepMode(DeepSleepMode::PreserveRAM).execute(&mut self.interface)
}
}