From 0f9ea0473a6544c65a170160ea29acb323aaeb37 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 17 Mar 2022 17:56:42 +0800 Subject: [PATCH] add sleep/resume indicator for the blind --- services/llio/Cargo.toml | 1 + services/llio/src/main.rs | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/services/llio/Cargo.toml b/services/llio/Cargo.toml index e25dbe4a2..8b4acac67 100644 --- a/services/llio/Cargo.toml +++ b/services/llio/Cargo.toml @@ -32,5 +32,6 @@ chrono = "0.4" [features] debugprint = [] wfi_off = [] # useful for serial port debugging, forces power on so the UART characters can finish printing +tts = [] default = [] # "debugprint" #default = ["debugprint"] # , "fccagent" diff --git a/services/llio/src/main.rs b/services/llio/src/main.rs index 6a5e72c4d..d6e8cc65c 100644 --- a/services/llio/src/main.rs +++ b/services/llio/src/main.rs @@ -443,6 +443,10 @@ mod implementation { }, } } + /// this vibrates until the device sleeps + pub fn tts_sleep_indicate(&mut self) { + self.power_csr.wfo(utra::power::VIBE_VIBE, 1); + } pub fn xadc_vbus(&self) -> u16 { self.xadc_csr.rf(utra::trng::XADC_VBUS_XADC_VBUS) as u16 } @@ -597,7 +601,8 @@ mod implementation { pub fn set_usb_disable(&mut self, state: bool) { self.usb_disable = state; } - + pub fn tts_sleep_indicate(&mut self) { + } } } @@ -761,8 +766,12 @@ fn xmain() -> ! { match FromPrimitive::from_usize(msg.body.id()) { Some(Opcode::SuspendResume) => xous::msg_scalar_unpack!(msg, token, _, _, _, { llio.suspend(); + #[cfg(feature="tts")] + llio.tts_sleep_indicate(); // this happens after the suspend call because we don't want the sleep indicator to be restored on resume susres.suspend_until_resume(token).expect("couldn't execute suspend/resume"); llio.resume(); + #[cfg(feature="tts")] + llio.vibe(VibePattern::Double); lockstatus_force_update = true; // notify the status bar that yes, it does need to redraw the lock status, even if the value hasn't changed since the last read }), Some(Opcode::CrgMode) => msg_scalar_unpack!(msg, _mode, _, _, _, {