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§
sourcetype ConfigError
type ConfigError
The error type that can occur if set_config
fails.
Required Methods§
sourcefn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError>
fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError>
Set the configuration of the driver.