diff options
Diffstat (limited to 'embassy-boot/src')
| -rw-r--r-- | embassy-boot/src/firmware_updater/asynch.rs | 11 | ||||
| -rw-r--r-- | embassy-boot/src/firmware_updater/blocking.rs | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/embassy-boot/src/firmware_updater/asynch.rs b/embassy-boot/src/firmware_updater/asynch.rs index 0dc09e18d..66e311e38 100644 --- a/embassy-boot/src/firmware_updater/asynch.rs +++ b/embassy-boot/src/firmware_updater/asynch.rs | |||
| @@ -161,6 +161,17 @@ impl<'d, DFU: NorFlash, STATE: NorFlash> FirmwareUpdater<'d, DFU, STATE> { | |||
| 161 | Ok(()) | 161 | Ok(()) |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | /// Read a slice of data from the DFU storage peripheral, starting the read | ||
| 165 | /// operation at the given address offset, and reading `buf.len()` bytes. | ||
| 166 | /// | ||
| 167 | /// # Errors | ||
| 168 | /// | ||
| 169 | /// Returns an error if the arguments are not aligned or out of bounds. | ||
| 170 | pub async fn read_dfu(&mut self, offset: u32, buf: &mut [u8]) -> Result<(), FirmwareUpdaterError> { | ||
| 171 | self.dfu.read(offset, buf).await?; | ||
| 172 | Ok(()) | ||
| 173 | } | ||
| 174 | |||
| 164 | /// Mark to trigger firmware swap on next boot. | 175 | /// Mark to trigger firmware swap on next boot. |
| 165 | #[cfg(not(feature = "_verify"))] | 176 | #[cfg(not(feature = "_verify"))] |
| 166 | pub async fn mark_updated(&mut self) -> Result<(), FirmwareUpdaterError> { | 177 | pub async fn mark_updated(&mut self) -> Result<(), FirmwareUpdaterError> { |
diff --git a/embassy-boot/src/firmware_updater/blocking.rs b/embassy-boot/src/firmware_updater/blocking.rs index 08062b0d0..0fedac1ea 100644 --- a/embassy-boot/src/firmware_updater/blocking.rs +++ b/embassy-boot/src/firmware_updater/blocking.rs | |||
| @@ -196,6 +196,17 @@ impl<'d, DFU: NorFlash, STATE: NorFlash> BlockingFirmwareUpdater<'d, DFU, STATE> | |||
| 196 | Ok(()) | 196 | Ok(()) |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | /// Read a slice of data from the DFU storage peripheral, starting the read | ||
| 200 | /// operation at the given address offset, and reading `buf.len()` bytes. | ||
| 201 | /// | ||
| 202 | /// # Errors | ||
| 203 | /// | ||
| 204 | /// Returns an error if the arguments are not aligned or out of bounds. | ||
| 205 | pub fn read_dfu(&mut self, offset: u32, buf: &mut [u8]) -> Result<(), FirmwareUpdaterError> { | ||
| 206 | self.dfu.read(offset, buf)?; | ||
| 207 | Ok(()) | ||
| 208 | } | ||
| 209 | |||
| 199 | /// Mark to trigger firmware swap on next boot. | 210 | /// Mark to trigger firmware swap on next boot. |
| 200 | #[cfg(not(feature = "_verify"))] | 211 | #[cfg(not(feature = "_verify"))] |
| 201 | pub fn mark_updated(&mut self) -> Result<(), FirmwareUpdaterError> { | 212 | pub fn mark_updated(&mut self) -> Result<(), FirmwareUpdaterError> { |
