Address reviews

This commit is contained in:
Kaitlyn Kenwell
2023-12-14 09:36:22 -05:00
parent b60b3f4eb8
commit e27e00f628
19 changed files with 307 additions and 41 deletions

View File

@ -213,6 +213,16 @@ pub struct FirmwareState<'d, STATE> {
}
impl<'d, STATE: NorFlash> FirmwareState<'d, STATE> {
/// Create a firmware state instance from a FirmwareUpdaterConfig with a buffer for magic content and state partition.
///
/// # Safety
///
/// The `aligned` buffer must have a size of STATE::WRITE_SIZE, and follow the alignment rules for the flash being read from
/// and written to.
pub fn from_config<DFU: NorFlash>(config: FirmwareUpdaterConfig<DFU, STATE>, aligned: &'d mut [u8]) -> Self {
Self::new(config.state, aligned)
}
/// Create a firmware state instance with a buffer for magic content and state partition.
///
/// # Safety

View File

@ -219,6 +219,16 @@ pub struct BlockingFirmwareState<'d, STATE> {
}
impl<'d, STATE: NorFlash> BlockingFirmwareState<'d, STATE> {
/// Creates a firmware state instance from a FirmwareUpdaterConfig, with a buffer for magic content and state partition.
///
/// # Safety
///
/// The `aligned` buffer must have a size of STATE::WRITE_SIZE, and follow the alignment rules for the flash being read from
/// and written to.
pub fn from_config<DFU: NorFlash>(config: FirmwareUpdaterConfig<DFU, STATE>, aligned: &'d mut [u8]) -> Self {
Self::new(config.state, aligned)
}
/// Create a firmware state instance with a buffer for magic content and state partition.
///
/// # Safety

View File

@ -33,7 +33,7 @@ pub enum State {
Boot,
/// Bootloader has swapped the active partition with the dfu partition and will attempt boot.
Swap,
/// Application has received a DFU_DETACH request over USB, and is rebooting into the bootloader to apply a DFU.
/// Application has received a request to reboot into DFU mode to apply an update.
DfuDetach,
}