aboutsummaryrefslogtreecommitdiff
path: root/embassy-embedded-hal/src/lib.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-07-19 05:59:36 +0000
committerGitHub <[email protected]>2022-07-19 05:59:36 +0000
commit26fdfdb00a1819f4a21c8d0fe1220c079983eecc (patch)
treef5eac13ddbed4e67aa1b1a6243b880f233658352 /embassy-embedded-hal/src/lib.rs
parente5d3f01bc444c257dbdfc75e504767e8e13d2a02 (diff)
parentd2f4a9bf8df8de9f51b29659b464b4509af47dc6 (diff)
Merge #869
869: Add some docs. r=Dirbaio a=Dirbaio bors r+ Co-authored-by: Dario Nieuwenhuis <[email protected]>
Diffstat (limited to 'embassy-embedded-hal/src/lib.rs')
-rw-r--r--embassy-embedded-hal/src/lib.rs17
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")]
5pub mod adapter; 8pub mod adapter;
6 9
7pub mod shared_bus; 10pub 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.
9pub trait SetConfig { 23pub 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}