amebazii::types::sysctrl

Struct SystemData

Source
pub struct SystemData {
    pub ota2_addr: Option<u32>,
    pub ota2_size: Option<u32>,
    pub old_img_trap: ForceOldImage,
    pub spi_cfg: SpiConfig,
    pub flash_info: FlashInfo,
    pub ulog_baud: u32,
    /* private fields */
}
Expand description

Represents system data related to the device, including configuration for OTA, SPI, and other hardware settings.

The SystemData struct holds various fields representing the system’s configuration and settings:

  • OTA: Configurations for over-the-air (OTA) updates, including address and size of OTA2.
  • Force Old Image: Settings related to forcing the usage of an older firmware image.
  • SPI Configuration: Configuration for the Serial Peripheral Interface (SPI) bus.
  • Flash Information: Information about the flash memory, including ID and size.
  • Logging Baud Rate: Baud rate for UART logging.
  • Calibration Data: SPI calibration data and Bluetooth parameters.

This struct is designed to be serialized and deserialized from a stream, allowing for easy reading and writing of system settings, especially in embedded systems or firmware configuration.

Fields§

§ota2_addr: Option<u32>

Address of the OTA2 image, or None if OTA1 is active.

§ota2_size: Option<u32>

Size of the OTA2 image, or None if OTA1 is active.

§old_img_trap: ForceOldImage

Configuration for forcing the usage of an older image, including the pin, port, and active status.

§spi_cfg: SpiConfig

Configuration for the SPI bus, including IO mode and speed.

§flash_info: FlashInfo

Information about the flash memory, including ID and size.

§ulog_baud: u32

Baud rate for the UART logging interface.

Implementations§

Source§

impl SystemData

Source

pub fn get_bt_paramdata(&self) -> DataRefType<'_, 32>

Retrieves the Bluetooth parameter data as a reference.

§Returns:
  • A reference to the Bluetooth parameter data (if available).
Source

pub fn get_spic_calibcfg(&self) -> DataRefType<'_, 48>

Retrieves the SPI calibration configuration as a reference.

§Returns:
  • A reference to the SPI calibration data (if available).
Source

pub fn set_pt_paramdata(&mut self, data: DataType<32>)

Sets the Bluetooth parameter data.

§Parameters:
  • data: The new Bluetooth parameter data to set.
Source

pub fn set_spic_calibcfg(&mut self, data: DataType<48>)

Sets the SPI calibration configuration.

§Parameters:
  • data: The new SPI calibration data to set.

Trait Implementations§

Source§

impl Debug for SystemData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SystemData

Source§

fn default() -> Self

Returns the default SystemData instance with preset values.

Default values:

  • ota2_addr: None (indicating OTA1 is active).
  • ota2_size: None.
  • old_img_trap: Default ForceOldImage values.
  • spi_cfg: Default SpiConfig values.
  • flash_info: Default FlashInfo values.
  • ulog_baud: 0xFFFF_FFFF.
  • spic_calibcfg: None.
  • bt_parameter_data: None.
Source§

impl FromStream for SystemData

Source§

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

Reads SystemData from a stream (e.g., file, memory, or network).

§Parameters:
  • _reader: The reader from which data will be read (must implement Read and Seek).
§Returns:
  • A result indicating success or failure of the reading operation.
Source§

impl ToStream for SystemData

Source§

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

Writes SystemData to a stream (e.g., file, memory, or network).

§Parameters:
  • _writer: The writer to which data will be written (must implement Write and Seek).
§Returns:
  • A result indicating success or failure of the writing operation.
Source§

impl TryInto<SystemData> for SystemDataCfg

Source§

fn try_into(self) -> Result<SystemData, Self::Error>

Tries to convert SystemDataCfg into a SystemData instance.

This method attempts to convert the configuration (SystemDataCfg) into a complete SystemData object. It populates the SystemData fields based on the values in the configuration struct, ensuring that required fields are filled, and default values are used where no data is provided.

§Parameters
  • self: The SystemDataCfg instance to be converted.
§Returns

A Result<SystemData, Error>:

  • Ok(SystemData): The conversion succeeded, and the data is populated.
  • Err(Error): An error occurred during conversion, for example, invalid data during conversion (e.g., when trying to convert data that doesn’t fit the expected type).
§Example
let config = SystemDataCfg::default();
let sysdata: SystemData = config.try_into().unwrap();
Source§

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations§

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.