Skip to content

Commit 6ed7a4c

Browse files
bors[bot]Dirbaio
andauthored
Merge #394
394: Split nb and can traits to separate crates. r=eldruin a=Dirbaio Following up from #177 (comment), this PR splits `nb` and `can` traits to separate crates. I propose keeping these crates (and `embedded-hal-async`) separate forever. (instead of merging EHA into EH when stable as we originally planned when we created EHA). Reasons for splitting `nb`: - its future is unclear. Some people who would like to see `nb` deprecated. By splitting, if we do deprecate it, we won't get stuck with it in the main `embedded-hal` crate forever. - It makes the module paths in the main crate cleaner. - Traits tied to a particular "execution model" in their own crates, which make the overall structure easier to understand IMO. Reasons for splitting `can`: - It has some open concerns: #381 #387 - Even if we do solve these, it's nice to have separate crates for the "more specialized" traits so that they can be major-bumped in the future if more concerns arise, without having to major-bump the main `embedded-hal` crate. TODO: - [x] Name it `embedded-can`, not `embedded-hal-can`. - [x] Move/remove docs/examples from the main crate that mention `nb`. - [x] Mention the subcrates from the main crate's docs. - [x] Add CI - [x] move `embedded-hal` to a subdir as well - [x] What should the nb, can crate versions be? 1.0? (no opinion on this from me). - [x] can: 0.4 - [x] nb: 1.0 Co-authored-by: Dario Nieuwenhuis <[email protected]>
2 parents bd0228b + d417c60 commit 6ed7a4c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+979
-1013
lines changed

.github/bors.toml

+10-6
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ block_labels = ["needs-decision"]
22
delete_merged_branches = true
33
required_approvals = 1
44
status = [
5-
"ci-linux (stable, x86_64-unknown-linux-gnu)",
6-
"ci-linux (stable, thumbv6m-none-eabi)",
7-
"ci-linux (stable, thumbv7m-none-eabi)",
8-
"ci-linux (1.54.0, x86_64-unknown-linux-gnu)",
9-
"ci-linux-test (stable)",
10-
"ci-linux-test (1.54.0, x86_64-unknown-linux-gnu)",
5+
"test (stable, x86_64-unknown-linux-gnu)",
6+
"test (stable, thumbv6m-none-eabi)",
7+
"test (stable, thumbv7m-none-eabi)",
8+
"test (1.54.0, x86_64-unknown-linux-gnu)",
9+
"test (1.54.0, thumbv6m-none-eabi)",
10+
"test (1.54.0, thumbv7m-none-eabi)",
11+
"test (nightly, x86_64-unknown-linux-gnu)",
12+
"test (nightly, thumbv6m-none-eabi)",
13+
"test (nightly, thumbv7m-none-eabi)",
14+
"clippy",
1115
"fmt",
1216
]

.github/workflows/changelog.yml

-20
This file was deleted.

.github/workflows/ci-async.yml

-32
This file was deleted.

.github/workflows/ci-bus.yml

-32
This file was deleted.

.github/workflows/ci.yml

-43
This file was deleted.

.github/workflows/clippy-async.yml

-19
This file was deleted.

.github/workflows/clippy-bus.yml

-19
This file was deleted.

.github/workflows/clippy.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ on:
55

66
name: Clippy check
77
jobs:
8-
clippy_check:
8+
clippy:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v2
1212
- uses: actions-rs/toolchain@v1
1313
with:
1414
profile: minimal
15-
toolchain: stable
15+
# embedded-hal-async needs nightly.
16+
# Use a pinned version to avoid spontaneous breakages (new clippy lints are added often)
17+
toolchain: nightly-2022-09-05
1618
override: true
1719
components: clippy
1820
- uses: actions-rs/clippy-check@v1

.github/workflows/rustfmt.yml

+1-6
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,4 @@ jobs:
1616
toolchain: nightly
1717
override: true
1818
components: rustfmt
19-
- uses: actions-rs/cargo@v1
20-
with:
21-
command: fmt
22-
args: --all -- --check
23-
- run: cargo fmt --all -- --check
24-
working-directory: embedded-hal-async
19+
- run: cargo fmt --check

.github/workflows/test.yml

+21-15
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,41 @@ on:
33
branches: [ staging, trying, master ]
44
pull_request:
55

6-
name: Test Suite
6+
name: Continuous integration
77

88
env:
99
RUSTFLAGS: '--deny warnings'
1010

1111
jobs:
12-
ci-linux-test:
12+
test:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
rust: [stable]
16+
# All generated code should be running on stable now
17+
rust:
18+
- stable
19+
- 1.54.0 # MSRV
20+
- nightly
1721

18-
include:
19-
- rust: 1.54.0
20-
TARGET: x86_64-unknown-linux-gnu
21-
22-
# Test nightly but don't fail
23-
- rust: nightly
24-
experimental: true
25-
TARGET: x86_64-unknown-linux-gnu
22+
# The default target we're compiling on and for
23+
target:
24+
- x86_64-unknown-linux-gnu
25+
- thumbv6m-none-eabi
26+
- thumbv7m-none-eabi
2627

2728
steps:
2829
- uses: actions/checkout@v2
2930
- uses: actions-rs/toolchain@v1
3031
with:
3132
profile: minimal
3233
toolchain: ${{ matrix.rust }}
33-
target: ${{ matrix.TARGET }}
34+
target: ${{ matrix.target }}
3435
override: true
35-
- uses: actions-rs/cargo@v1
36-
with:
37-
command: test
36+
37+
- run: sed -i '/nightly-only/d' Cargo.toml
38+
if: matrix.toolchain != 'nightly'
39+
40+
- run: cargo check --target=${{ matrix.target }}
41+
42+
- run: cargo test --target=${{ matrix.target }}
43+
if: contains(matrix.target, 'linux')

Cargo.toml

+9-22
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
1-
[package]
2-
authors = [
3-
"The Embedded HAL Team <[email protected]>",
4-
"Jorge Aparicio <[email protected]>",
5-
"Jonathan 'theJPster' Pallant <[email protected]>"
6-
]
7-
categories = ["asynchronous", "embedded", "hardware-support", "no-std"]
8-
description = " A Hardware Abstraction Layer (HAL) for embedded systems "
9-
documentation = "https://docs.rs/embedded-hal"
10-
edition = "2018"
11-
keywords = ["hal", "IO"]
12-
license = "MIT OR Apache-2.0"
13-
name = "embedded-hal"
14-
readme = "README.md"
15-
repository = "https://github.com/rust-embedded/embedded-hal"
16-
version = "1.0.0-alpha.8"
17-
18-
[dependencies]
19-
nb = "1"
1+
[workspace]
202

21-
[dev-dependencies.stm32f1]
22-
version = "0.14"
23-
features = ["stm32f103", "rt"]
3+
# CI removes lines containing 'nightly-only' when not building with nightly.
4+
members = [
5+
"embedded-hal",
6+
"embedded-hal-async", # nightly-only
7+
"embedded-hal-nb",
8+
"embedded-hal-bus",
9+
"embedded-can",
10+
]

README.md

+15-17
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
[![crates.io](https://img.shields.io/crates/d/embedded-hal.svg)](https://crates.io/crates/embedded-hal)
2-
[![crates.io](https://img.shields.io/crates/v/embedded-hal.svg)](https://crates.io/crates/embedded-hal)
3-
[![Documentation](https://docs.rs/embedded-hal/badge.svg)](https://docs.rs/embedded-hal)
4-
![Minimum Supported Rust Version](https://img.shields.io/badge/rustc-1.54+-blue.svg)
5-
61
# `embedded-hal`
72

83
> A Hardware Abstraction Layer (HAL) for embedded systems
94
10-
This project is developed and maintained by the [HAL team][team].
11-
12-
## [API reference]
13-
14-
[API reference]: https://docs.rs/embedded-hal
5+
This project is developed and maintained by the [HAL team][https://github.com/rust-embedded/wg#the-hal-team].
156

167
## Scope
178

@@ -26,14 +17,24 @@ platforms (e.g. Cortex-M microcontrollers, AVR microcontrollers, embedded Linux,
2617
The advantage for application developers is that by adopting `embedded-hal` they can unlock all
2718
these drivers for their platform.
2819

29-
`embedded-hal` is not tied to a specific execution model like blocking or non-blocking.
30-
3120
For functionality that goes beyond what is provided by `embedded-hal`, users are encouraged
3221
to use the target platform directly. Abstractions of common functionality can be proposed to be
3322
included into `embedded-hal` as described [in this guide](docs/how-to-add-a-new-trait.md), though.
3423

3524
See more about the design goals in [this documentation section](https://docs.rs/embedded-hal/latest/embedded_hal/#design-goals).
3625

26+
## Crates
27+
28+
The main `embedded-hal` project is not tied to a specific execution model like blocking or non-blocking.
29+
30+
| Crate | crates.io | Docs | |
31+
|-|-|-|-|
32+
| [embedded-hal](./embedded-hal) | [![crates.io](https://img.shields.io/crates/v/embedded-hal.svg)](https://crates.io/crates/embedded-hal) | [![Documentation](https://docs.rs/embedded-hal/badge.svg)](https://docs.rs/embedded-hal) | Core traits, blocking version |
33+
| [embedded-hal-async](./embedded-hal-async) | [![crates.io](https://img.shields.io/crates/v/embedded-hal-async.svg)](https://crates.io/crates/embedded-hal-async) | [![Documentation](https://docs.rs/embedded-hal-async/badge.svg)](https://docs.rs/embedded-hal-async) | Core traits, async version |
34+
| [embedded-hal-nb](./embedded-hal-nb) | [![crates.io](https://img.shields.io/crates/v/embedded-hal-nb.svg)](https://crates.io/crates/embedded-hal-nb) | [![Documentation](https://docs.rs/embedded-hal-nb/badge.svg)](https://docs.rs/embedded-hal-nb) | Core traits, polling version using the `nb` crate |
35+
| [embedded-hal-bus](./embedded-hal-bus) | [![crates.io](https://img.shields.io/crates/v/embedded-hal-bus.svg)](https://crates.io/crates/embedded-hal-bus) | [![Documentation](https://docs.rs/embedded-hal-bus/badge.svg)](https://docs.rs/embedded-hal-bus) | Utilities for sharing SPI and I2C buses |
36+
| [embedded-can](./embedded-can) | [![crates.io](https://img.shields.io/crates/v/embedded-can.svg)](https://crates.io/crates/embedded-can) | [![Documentation](https://docs.rs/embedded-can/badge.svg)](https://docs.rs/embedded-can) | Controller Area Network (CAN) traits |
37+
3738
## Releases
3839

3940
At the moment we are working towards a `1.0.0` release (see [#177]). During this process we will
@@ -94,9 +95,6 @@ dual licensed as above, without any additional terms or conditions.
9495

9596
## Code of Conduct
9697

97-
Contribution to this crate is organized under the terms of the [Rust Code of
98-
Conduct][CoC], the maintainer of this crate, the [HAL team][team], promises
98+
Contribution to this repository is organized under the terms of the [Rust Code of
99+
Conduct](CODE_OF_CONDUCT.md), the maintainers of this repository, the [HAL team](https://github.com/rust-embedded/wg#the-hal-team), promise
99100
to intervene to uphold that code of conduct.
100-
101-
[CoC]: CODE_OF_CONDUCT.md
102-
[team]: https://github.com/rust-embedded/wg#the-hal-team

embedded-can/Cargo.toml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[package]
2+
name = "embedded-can"
3+
version = "0.4.0"
4+
edition = "2018"
5+
6+
description = "HAL traits for Controller Area Network (CAN) devices."
7+
categories = ["embedded", "hardware-support", "no-std"]
8+
documentation = "https://docs.rs/embedded-can"
9+
keywords = ["hal", "IO"]
10+
license = "MIT OR Apache-2.0"
11+
readme = "README.md"
12+
repository = "https://github.com/rust-embedded/embedded-hal"
13+
14+
[dependencies]
15+
embedded-hal = { version = "=1.0.0-alpha.8", path = "../embedded-hal" }
16+
nb = "1"

0 commit comments

Comments
 (0)