diff options
Diffstat (limited to 'embassy-embedded-hal/src/lib.rs')
| -rw-r--r-- | embassy-embedded-hal/src/lib.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/embassy-embedded-hal/src/lib.rs b/embassy-embedded-hal/src/lib.rs index d77c2d635..0c6f2786a 100644 --- a/embassy-embedded-hal/src/lib.rs +++ b/embassy-embedded-hal/src/lib.rs | |||
| @@ -1,12 +1,29 @@ | |||
| 1 | #![cfg_attr(not(feature = "std"), no_std)] | 1 | #![cfg_attr(not(feature = "std"), no_std)] |
| 2 | #![cfg_attr(feature = "nightly", feature(generic_associated_types, type_alias_impl_trait))] | 2 | #![cfg_attr(feature = "nightly", feature(generic_associated_types, type_alias_impl_trait))] |
| 3 | #![warn(missing_docs)] | ||
| 4 | |||
| 5 | //! Utilities to use `embedded-hal` traits with Embassy. | ||
| 3 | 6 | ||
| 4 | #[cfg(feature = "nightly")] | 7 | #[cfg(feature = "nightly")] |
| 5 | pub mod adapter; | 8 | pub mod adapter; |
| 6 | 9 | ||
| 7 | pub mod shared_bus; | 10 | pub mod shared_bus; |
| 8 | 11 | ||
| 12 | /// Set the configuration of a peripheral driver. | ||
| 13 | /// | ||
| 14 | /// This trait is intended to be implemented by peripheral drivers such as SPI | ||
| 15 | /// and I2C. It allows changing the configuration at runtime. | ||
| 16 | /// | ||
| 17 | /// The exact type of the "configuration" is defined by each individual driver, since different | ||
| 18 | /// drivers support different options. Therefore it is defined as an associated type. | ||
| 19 | /// | ||
| 20 | /// For example, it is used by [`SpiDeviceWithConfig`](crate::shared_bus::asynch::spi::SpiDeviceWithConfig) and | ||
| 21 | /// [`I2cDeviceWithConfig`](crate::shared_bus::asynch::i2c::I2cDeviceWithConfig) to allow different | ||
| 22 | /// devices on the same bus to use different communication settings. | ||
| 9 | pub trait SetConfig { | 23 | pub trait SetConfig { |
| 24 | /// The configuration type used by this driver. | ||
| 10 | type Config; | 25 | type Config; |
| 26 | |||
| 27 | /// Set the configuration of the driver. | ||
| 11 | fn set_config(&mut self, config: &Self::Config); | 28 | fn set_config(&mut self, config: &Self::Config); |
| 12 | } | 29 | } |
