Skip to content

Commit 16ac2e6

Browse files
committed
bus: update docs, document features.
1 parent 37a8e61 commit 16ac2e6

File tree

2 files changed

+21
-27
lines changed

2 files changed

+21
-27
lines changed

embedded-hal-bus/README.md

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,47 @@
55

66
# `embedded-hal-bus`
77

8-
Bus/Device connection mechanisms for [`embedded-hal`](https://crates.io/crates/embedded-hal), a Hardware Abstraction Layer (HAL) for embedded systems.
8+
Bus sharing utilities for [`embedded-hal`](https://crates.io/crates/embedded-hal), a Hardware Abstraction Layer (HAL) for embedded systems.
99

10-
It is possible to connect several peripherals to a bus like SPI or I2C.
11-
To support this, `embedded-hal` provides the `SpiBus` and `SpiDevice` traits in the case of SPI, for example.
10+
`embedded-hal` provides traits for SPI and I2C buses and devices. This crate provides hardware-independent adapters for sharing a single bus between multiple devices, compatible with the traits.
1211

13-
`embedded-hal` trait implementations for microcontrollers should implement the `...Bus` traits.
14-
However, device drivers should use the `...Device` traits, _not the `...Bus` traits_ if at all possible
12+
This project is developed and maintained by the [HAL team](https://github.com/rust-embedded/wg#the-hal-team).
13+
14+
## SPI
15+
16+
To support bus sharing, `embedded-hal` provides the `SpiBus` and `SpiDevice` traits. `SpiBus` represents an entire bus,
17+
while `SpiDevice` represents a device on that bus. For further details on these traits, please consult the
18+
[`embedded-hal` documentation](https://docs.rs/embedded-hal/1.0.0-alpha.9/embedded_hal/spi/index.html).
19+
20+
`embedded-hal` trait implementations for microcontrollers should implement the `SpiBus` trait.
21+
However, device drivers should use the `SpiDevice` traits, _not the `SpiBus` traits_ if at all possible
1522
in order to allow for sharing of the bus they are connected to.
1623

17-
This crate provides mechanisms to connect a `...Bus` and a `...Device`.
24+
This crate provides mechanisms to connect a `SpiBus` and a `SpiDevice`.
1825

19-
For further details on these traits, please consult the [`embedded-hal` documentation](https://docs.rs/embedded-hal).
26+
## I2C
2027

21-
This project is developed and maintained by the [HAL team](https://github.com/rust-embedded/wg#the-hal-team).
28+
In the case of I2C, the same `I2c` `embedded-hal` trait represents either an entire bus, or a device on a bus. This crate
29+
provides mechanisms to obtain multiple `I2c` instances out of a single `I2c` instance, sharing the bus.
2230

23-
## [API reference]
31+
## Features
2432

25-
[API reference]: https://docs.rs/embedded-hal-bus
33+
- `std`: enable shared bus implementations using `std::sync::Mutex`.
2634

2735
## Minimum Supported Rust Version (MSRV)
2836

29-
3037
This crate is guaranteed to compile on stable Rust 1.59 and up. It *might*
3138
compile with older versions but that may change in any new patch release.
3239

3340
See [here](../docs/msrv.md) for details on how the MSRV may be upgraded.
3441

35-
3642
## License
3743

3844
Licensed under either of
3945

4046
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
41-
http://www.apache.org/licenses/LICENSE-2.0)
42-
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
47+
<http://www.apache.org/licenses/LICENSE-2.0>)
48+
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
4349

4450
at your option.
4551

embedded-hal-bus/src/lib.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
1-
//! Bus/Device connection mechanisms for [`embedded-hal`], a Hardware Abstraction Layer (HAL) for embedded systems.
2-
//!
3-
//! It is possible to connect several peripherals to a bus like SPI or I2C.
4-
//! To support this, `embedded-hal` provides the `SpiBus` and `SpiDevice` traits in the case of SPI, for example.
5-
//!
6-
//! `embedded-hal` trait implementations for microcontrollers should implement the `...Bus` traits.
7-
//! However, device drivers should use the `...Device` traits, _not the `...Bus` traits_ if at all possible
8-
//! in order to allow for sharing of the bus they are connected to.
9-
//!
10-
//! This crate provides mechanisms to connect a `...Bus` and a `...Device`.
11-
//!
12-
//! For further details on these traits, please consult the [`embedded-hal` documentation](https://docs.rs/embedded-hal).
13-
1+
#![doc = include_str!("../README.md")]
142
#![warn(missing_docs)]
153
#![cfg_attr(not(feature = "std"), no_std)]
164

0 commit comments

Comments
 (0)