Skip to content

Commit 797dc95

Browse files
committed
Document embedded-hal-bus features in README.md and Cargo.toml
1 parent f0eec21 commit 797dc95

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

embedded-hal-bus/Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,24 @@ repository = "https://github.com/rust-embedded/embedded-hal"
1515
version = "0.2.0"
1616

1717
[features]
18+
# Enable shared bus implementations using `std::sync::Mutex`, and implement `std::error::Error` for `DeviceError`
1819
std = []
20+
# Enable shared bus implementations that require Atomic CAS operations
1921
atomic-device = []
22+
# Enable `embedded-hal-async` support.
2023
async = ["dep:embedded-hal-async"]
24+
# Derive `defmt::Format` from `defmt` 0.3 for enums and structs. See https://github.com/knurling-rs/defmt for more info
2125
defmt-03 = ["dep:defmt-03", "embedded-hal/defmt-03", "embedded-hal-async?/defmt-03"]
26+
# Enable critical-section feature in portable-atomic.
27+
#
28+
# `portable-atomic` emulates atomic CAS functionality, allowing `embedded-hal-bus` to use `atomic-device` on hardware that does not natively support atomic CAS.
29+
# This feature requires a critical-section implementation, which is most often provided by your arch crate (cortex-m / riscv / msp430 / avr-device / etc) when the `critical-section-single-core` feature is enabled.
30+
# A list of critical-section impls is available [in the critical section docs](https://github.com/rust-embedded/critical-section?tab=readme-ov-file#usage-in-no-std-binaries)
2231
portable-atomic-critical-section = ["atomic-device", "portable-atomic/critical-section"]
32+
# Enable unsafe-assume-single-core feature of portable-atomic.
33+
#
34+
# `portable-atomic` emulates atomic CAS functionality, allowing `embedded-hal-bus` to use `atomic-device` on hardware that does not natively support atomic CAS.
35+
# This feature is only safe on single core systems
2336
portable-atomic-unsafe-assume-single-core = ["atomic-device", "portable-atomic/unsafe-assume-single-core"]
2437

2538
[dependencies]

embedded-hal-bus/README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,20 @@ provides mechanisms to obtain multiple `I2c` instances out of a single `I2c` ins
3030

3131
## Optional Cargo features
3232

33-
- **`std`**: enable shared bus implementations using `std::sync::Mutex`, and implement
34-
`std::error::Error` for `DeviceError`.
3533
- **`async`**: enable `embedded-hal-async` support.
34+
- **`atomic-device`**: enable shared bus implementations that require Atomic CAS operations.
3635
- **`defmt-03`**: Derive `defmt::Format` from `defmt` 0.3 for enums and structs.
36+
- **`portable-atomic-critical-section`**: Enable critical-section feature in portable-atomic.
37+
38+
`portable-atomic` emulates atomic CAS functionality, allowing `embedded-hal-bus` to use `atomic-device` on hardware that does not natively support atomic CAS.
39+
This feature requires a critical-section implementation, which is most often provided by your arch crate (cortex-m / riscv / msp430 / avr-device / etc) when the `critical-section-single-core` feature is enabled.
40+
A list of critical-section impls is available [in the critical section docs](https://github.com/rust-embedded/critical-section?tab=readme-ov-file#usage-in-no-std-binaries)
41+
- **`portable-atomic-unsafe-assume-single-core`**: Enable unsafe-assume-single-core feature of portable-atomic.
42+
43+
`portable-atomic` emulates atomic CAS functionality, allowing `embedded-hal-bus` to use `atomic-device` on hardware that does not natively support atomic CAS.
44+
This feature is only safe on single core systems
45+
- **`std`**: enable shared bus implementations using `std::sync::Mutex`, and implement
46+
`std::error::Error` for `DeviceError`.
3747

3848
## Minimum Supported Rust Version (MSRV)
3949

0 commit comments

Comments
 (0)