amebazii::types::flash

Struct Flash

Source
pub struct Flash { /* private fields */ }
Expand description

Represents a flash image, including calibration data and partitions.

Implementations§

Source§

impl Flash

Source

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.
Source

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.
Source

pub fn get_partition(&self, part_type: PartitionType) -> Option<&Partition>

Retrieves a partition by its type.

§Parameters:
  • part_type: The partition type to search for in the flash.
§Returns:
  • Some(&Partition) if the partition exists, otherwise None.
Source

pub fn has_partition(&self, part_type: PartitionType) -> bool

Checks whether a partition of the specified type exists.

§Parameters:
  • part_type: The partition type to check.
§Returns:
  • true if the partition exists, otherwise false.
Source

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.
Source

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 as SystemData.
Source

pub fn set_boot_partition(&mut self, boot_image: BootImage)

Sets the boot partition with the given boot image.

§Arguments
  • boot_image - A BootImage object containing the bootloader image data.
Source

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 - An OTAImage object containing the first firmware image to be stored.
Source

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 - An OTAImage object containing the second firmware image to be stored.
Source

pub fn set_partition_table(&mut self, pt_image: PartitionTableImage)

Sets the partition table with the provided partition table image.

§Arguments
  • pt_image - A PartitionTableImage object representing the partition table to be stored.

Trait Implementations§

Source§

impl Default for Flash

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl FromStream for Flash

Source§

fn read_from<R>(&mut self, reader: &mut R) -> Result<(), Error>
where R: Read + Seek,

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

Source§

fn write_to<W>(&self, writer: &mut W) -> Result<(), Error>
where W: Write + Seek,

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.

Auto Trait Implementations§

§

impl Freeze for Flash

§

impl RefUnwindSafe for Flash

§

impl Send for Flash

§

impl Sync for Flash

§

impl Unpin for Flash

§

impl UnwindSafe for Flash

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.