add ship mode command

This commit is contained in:
bunnie 2021-04-22 18:07:27 +08:00
parent 65eab7d60f
commit ca63091f98
3 changed files with 10 additions and 1 deletions

View file

@ -62,7 +62,7 @@ pub(crate) enum Opcode {
PowerOffSoc,
/// Ship mode (battery disconnect)
//ShipMode,
ShipMode,
/// Is the battery charging?
//IsCharging,

View file

@ -59,6 +59,12 @@ impl Com {
).map(|_| ())
}
pub fn ship_mode(&self) -> Result<(), xous::Error> {
send_message(self.conn,
Message::new_scalar(Opcode::ShipMode.to_usize().unwrap(), 0, 0, 0, 0)
).map(|_| ())
}
pub fn get_wf200_fw_rev(&self) -> Result<(u8, u8, u8), xous::Error> {
let response = send_message(self.conn,
Message::new_blocking_scalar(Opcode::Wf200Rev.to_usize().unwrap(), 0, 0, 0, 0))?;

View file

@ -348,6 +348,9 @@ fn xmain() -> ! {
}
}
}
Some(Opcode::ShipMode) => {
com.txrx(ComState::POWER_SHIPMODE.verb);
}
Some(Opcode::Wf200Rev) => {
com.txrx(ComState::WFX_FW_REV_GET.verb);
let major = com.wait_txrx(ComState::LINK_READ.verb, Some(STD_TIMEOUT)) as u8;