aboutsummaryrefslogtreecommitdiff
path: root/embassy-embedded-hal/src/lib.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2022-07-19 07:57:39 +0200
committerDario Nieuwenhuis <[email protected]>2022-07-19 07:58:29 +0200
commitd2f4a9bf8df8de9f51b29659b464b4509af47dc6 (patch)
treef5eac13ddbed4e67aa1b1a6243b880f233658352 /embassy-embedded-hal/src/lib.rs
parent3fb83898bc2ed0c8c9eccdf17a4852457b0bcebb (diff)
embassy-embedded-hal: docs
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}