mirror of
https://github.com/embassy-rs/embassy.git
synced 2026-04-19 21:35:48 +00:00
feat: support firmware update control for esp-hosted
This commit is contained in:
@@ -24,6 +24,11 @@ pub struct Control<'a> {
|
||||
shared: &'a Shared,
|
||||
}
|
||||
|
||||
/// Handle for managing firmware update.
|
||||
pub struct UpdateControl<'a, 'd> {
|
||||
control: &'a mut Control<'d>,
|
||||
}
|
||||
|
||||
/// WiFi mode.
|
||||
#[allow(unused)]
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
@@ -146,6 +151,13 @@ impl<'a> Control<'a> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Initiate a firmware update.
|
||||
pub async fn update(&mut self) -> Result<UpdateControl<'_, 'a>, Error> {
|
||||
let req = proto::CtrlMsg_Req_OTABegin {};
|
||||
ioctl!(self, ReqOtaBegin, RespOtaBegin, req, resp);
|
||||
Ok(UpdateControl { control: self })
|
||||
}
|
||||
|
||||
/// duration in seconds, clamped to [10, 3600]
|
||||
async fn set_heartbeat(&mut self, duration: u32) -> Result<(), Error> {
|
||||
let req = proto::CtrlMsg_Req_ConfigHeartbeat {
|
||||
|
||||
Reference in New Issue
Block a user