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
impl SystemData
Sourcepub fn get_bt_paramdata(&self) -> DataRefType<'_, 32>
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).
Sourcepub fn get_spic_calibcfg(&self) -> DataRefType<'_, 48>
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).
Sourcepub fn set_pt_paramdata(&mut self, data: DataType<32>)
pub fn set_pt_paramdata(&mut self, data: DataType<32>)
Sourcepub fn set_spic_calibcfg(&mut self, data: DataType<48>)
pub fn set_spic_calibcfg(&mut self, data: DataType<48>)
Trait Implementations§
Source§impl Debug for SystemData
impl Debug for SystemData
Source§impl Default for SystemData
impl Default for SystemData
Source§fn default() -> Self
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
: DefaultForceOldImage
values.spi_cfg
: DefaultSpiConfig
values.flash_info
: DefaultFlashInfo
values.ulog_baud
:0xFFFF_FFFF
.spic_calibcfg
:None
.bt_parameter_data
:None
.
Source§impl FromStream for SystemData
impl FromStream for SystemData
Source§impl ToStream for SystemData
impl ToStream for SystemData
Source§impl TryInto<SystemData> for SystemDataCfg
impl TryInto<SystemData> for SystemDataCfg
Source§fn try_into(self) -> Result<SystemData, Self::Error>
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
: TheSystemDataCfg
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();