pub struct Flash { /* private fields */ }
Expand description
Represents a flash image, including calibration data and partitions.
Implementations§
Source§impl Flash
impl Flash
Sourcepub fn get_calibration_pattern(&self) -> &[u8; 16]
pub fn get_calibration_pattern(&self) -> &[u8; 16]
Returns a reference to the calibration pattern.
This function is used to retrieve the 16-byte calibration pattern for the flash image.
§Returns:
- A reference to the 16-byte array holding the calibration pattern.
Sourcepub fn get_calibration_pattern_mut(&mut self) -> &mut [u8; 16]
pub fn get_calibration_pattern_mut(&mut self) -> &mut [u8; 16]
Returns a mutable reference to the calibration pattern.
This function allows modification of the calibration pattern for the flash image.
§Returns:
- A mutable reference to the 16-byte array holding the calibration pattern.
Sourcepub fn get_partition(&self, part_type: PartitionType) -> Option<&Partition>
pub fn get_partition(&self, part_type: PartitionType) -> Option<&Partition>
Sourcepub fn has_partition(&self, part_type: PartitionType) -> bool
pub fn has_partition(&self, part_type: PartitionType) -> bool
Sourcepub fn set_partition(&mut self, part_type: PartitionType, partition: Partition)
pub fn set_partition(&mut self, part_type: PartitionType, partition: Partition)
Sets the partition for the specified type.
§Parameters:
part_type
: The type of partition to set.partition
: The partition data to store.
Sourcepub fn set_system_partition(&mut self, system_data: SystemData)
pub fn set_system_partition(&mut self, system_data: SystemData)
Sets the system partition with the provided system data.
§Arguments
system_data
- The data to be written to the system partition, represented asSystemData
.
Sourcepub fn set_boot_partition(&mut self, boot_image: BootImage)
pub fn set_boot_partition(&mut self, boot_image: BootImage)
Sets the boot partition with the given boot image.
§Arguments
boot_image
- ABootImage
object containing the bootloader image data.
Sourcepub fn set_fw1(&mut self, fw1_image: OTAImage)
pub fn set_fw1(&mut self, fw1_image: OTAImage)
Sets the first firmware partition with the provided firmware image.
This method configures the first firmware partition (Fw1
) by passing an OTAImage
object
representing the firmware image to the internal set_partition
method.
§Arguments
fw1_image
- AnOTAImage
object containing the first firmware image to be stored.
Sourcepub fn set_fw2(&mut self, fw2_image: OTAImage)
pub fn set_fw2(&mut self, fw2_image: OTAImage)
Sets the second firmware partition with the given firmware image.
This method configures the second firmware partition (Fw2
) by passing an OTAImage
object
representing the firmware image. It ensures that the firmware data is correctly placed in the
Fw2
partition.
§Arguments
fw2_image
- AnOTAImage
object containing the second firmware image to be stored.
Sourcepub fn set_partition_table(&mut self, pt_image: PartitionTableImage)
pub fn set_partition_table(&mut self, pt_image: PartitionTableImage)
Sets the partition table with the provided partition table image.
§Arguments
pt_image
- APartitionTableImage
object representing the partition table to be stored.
Trait Implementations§
Source§impl FromStream for Flash
impl FromStream for Flash
Source§fn read_from<R>(&mut self, reader: &mut R) -> Result<(), Error>
fn read_from<R>(&mut self, reader: &mut R) -> Result<(), Error>
Reads the flash image from the provided reader.
This function reads the entire flash image, including the calibration pattern, partitions,
and partition records. It populates the Flash
struct with the data read from the stream.
§Parameters:
reader
: The input stream from which the flash image is read.
§Returns:
Ok(())
if the flash image was successfully read and parsed.Err(Error)
if there was an issue reading the flash image.
Source§impl ToStream for Flash
impl ToStream for Flash
Source§fn write_to<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_to<W>(&self, writer: &mut W) -> Result<(), Error>
Writes the flash image to the provided writer.
This function writes the entire flash image, including the calibration pattern, partitions,
and partition records. It populates the Flash
struct with the data read from the stream.
§Parameters:
writer
: The output stream to which the flash image is written.
§Returns:
Ok(())
if the flash image was successfully written.Err(Error)
if there was an issue writing the flash image.