From d2f4a9bf8df8de9f51b29659b464b4509af47dc6 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Tue, 19 Jul 2022 07:57:39 +0200 Subject: embassy-embedded-hal: docs --- embassy-embedded-hal/src/lib.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'embassy-embedded-hal/src/lib.rs') 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 @@ #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(feature = "nightly", feature(generic_associated_types, type_alias_impl_trait))] +#![warn(missing_docs)] + +//! Utilities to use `embedded-hal` traits with Embassy. #[cfg(feature = "nightly")] pub mod adapter; pub mod shared_bus; +/// 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`](crate::shared_bus::asynch::spi::SpiDeviceWithConfig) and +/// [`I2cDeviceWithConfig`](crate::shared_bus::asynch::i2c::I2cDeviceWithConfig) to allow different +/// devices on the same bus to use different communication settings. pub trait SetConfig { + /// The configuration type used by this driver. type Config; + + /// Set the configuration of the driver. fn set_config(&mut self, config: &Self::Config); } -- cgit