|
5 | 5 |
|
6 | 6 | # `embedded-hal-bus`
|
7 | 7 |
|
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. |
9 | 9 |
|
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. |
12 | 11 |
|
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 |
15 | 22 | in order to allow for sharing of the bus they are connected to.
|
16 | 23 |
|
17 |
| -This crate provides mechanisms to connect a `...Bus` and a `...Device`. |
| 24 | +This crate provides mechanisms to connect a `SpiBus` and a `SpiDevice`. |
18 | 25 |
|
19 |
| -For further details on these traits, please consult the [`embedded-hal` documentation](https://docs.rs/embedded-hal). |
| 26 | +## I2C |
20 | 27 |
|
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. |
22 | 30 |
|
23 |
| -## [API reference] |
| 31 | +## Features |
24 | 32 |
|
25 |
| -[API reference]: https://docs.rs/embedded-hal-bus |
| 33 | +- `std`: enable shared bus implementations using `std::sync::Mutex`. |
26 | 34 |
|
27 | 35 | ## Minimum Supported Rust Version (MSRV)
|
28 | 36 |
|
29 |
| - |
30 | 37 | This crate is guaranteed to compile on stable Rust 1.59 and up. It *might*
|
31 | 38 | compile with older versions but that may change in any new patch release.
|
32 | 39 |
|
33 | 40 | See [here](../docs/msrv.md) for details on how the MSRV may be upgraded.
|
34 | 41 |
|
35 |
| - |
36 | 42 | ## License
|
37 | 43 |
|
38 | 44 | Licensed under either of
|
39 | 45 |
|
40 | 46 | - 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>) |
43 | 49 |
|
44 | 50 | at your option.
|
45 | 51 |
|
|
0 commit comments