stop3 working properly well

This commit is contained in:
Filipriec
2025-12-09 16:02:09 +01:00
parent 55398e8459
commit 72a731abef
4 changed files with 79 additions and 3 deletions

View File

@@ -27,6 +27,9 @@ pub enum LowPowerCmd {
StandbyFull, // 2
Standby, // 3
Shutdown, // 4
Stop3Wfi,
Stop3Wfe,
Stop3WfeNoClear,
}
pub static CMD_CH: Channel<CriticalSectionRawMutex, LowPowerCmd, 1> = Channel::new();
@@ -35,7 +38,7 @@ pub static CMD_CH: Channel<CriticalSectionRawMutex, LowPowerCmd, 1> = Channel::n
pub async fn uart_cmd_task() {
// Prompt once
let _ = PIPE_HW_TX
.write(b"Modes: 1=SB8, 2=SBfull, 3=SB, 4=SD\r\n")
.write(b"Modes: 1=SB8, 2=SBfull, 3=SB, 4=SD, 5=STOP3(WFI), 6=STOP3(WFE), 7=STOP3(WFE no clear)\r\n")
.await;
let mut b = [0u8; 1];
@@ -61,8 +64,22 @@ pub async fn uart_cmd_task() {
let _ = PIPE_HW_TX.write(b"ACK 4: shutdown\r\n").await;
CMD_CH.send(LowPowerCmd::Shutdown).await;
}
b'5' => {
let _ = PIPE_HW_TX.write(b"ACK 5: STOP3 with WFI\r\n").await;
CMD_CH.send(LowPowerCmd::Stop3Wfi).await;
}
b'6' => {
let _ = PIPE_HW_TX.write(b"ACK 6: STOP3 with WFE\r\n").await;
CMD_CH.send(LowPowerCmd::Stop3Wfe).await;
}
b'7' => {
let _ = PIPE_HW_TX.write(b"ACK 7: STOP3 with WFE (no event clear)\r\n").await;
CMD_CH.send(LowPowerCmd::Stop3WfeNoClear).await;
}
b'\r' | b'\n' | b' ' => {}
_ => { let _ = PIPE_HW_TX.write(b"ERR: use 1|2|3|4\r\n").await; }
_ => {
let _ = PIPE_HW_TX.write(b"ERR: use 1|2|3|4|5|6|7\r\n").await;
}
}
yield_now().await;
}