Trait embassy_embedded_hal::SetConfig

source ·
pub trait SetConfig {
    type Config;
    type ConfigError;

    // Required method
    fn set_config(
        &mut self,
        config: &Self::Config
    ) -> Result<(), Self::ConfigError>;
}
Expand description

Set the configuration of a peripheral driver.

This trait is intended to be implemented by peripheral drivers such as SPI and I2C. It allows changing the configuration at runtime.

The exact type of the “configuration” is defined by each individual driver, since different drivers support different options. Therefore it is defined as an associated type.

For example, it is used by SpiDeviceWithConfig and I2cDeviceWithConfig to allow different devices on the same bus to use different communication settings.

Required Associated Types§

source

type Config

The configuration type used by this driver.

source

type ConfigError

The error type that can occur if set_config fails.

Required Methods§

source

fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError>

Set the configuration of the driver.

Implementors§