Skip to content

Commit b4d4aae

Browse files
authored
Try #394:
2 parents 1f87498 + 6e285a4 commit b4d4aae

Some content is hidden

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

44 files changed

+939
-965
lines changed

.github/bors.toml

Lines changed: 10 additions & 6 deletions
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/ci-async.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/ci-bus.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/clippy-async.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/clippy-bus.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/clippy.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +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
18-
- uses: actions-rs/clippy-check@v1
19-
with:
20-
token: ${{ secrets.GITHUB_TOKEN }}
20+
- run: cargo clippy -- --deny=warnings

.github/workflows/rustfmt.yml

Lines changed: 1 addition & 6 deletions
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

Lines changed: 21 additions & 15 deletions
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

Lines changed: 9 additions & 22 deletions
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+
]

embedded-can/Cargo.toml

Lines changed: 16 additions & 0 deletions
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 Netowrk (CAN) devices."
7+
categories = ["embedded", "hardware-support", "no-std"]
8+
documentation = "https://docs.rs/embedded-hal-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"

embedded-can/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[![crates.io](https://img.shields.io/crates/d/embedded-hal-nb.svg)](https://crates.io/crates/embedded-hal-nb)
2+
[![crates.io](https://img.shields.io/crates/v/embedded-hal-nb.svg)](https://crates.io/crates/embedded-hal-nb)
3+
[![Documentation](https://docs.rs/embedded-hal-nb/badge.svg)](https://docs.rs/embedded-hal-nb)
4+
![Minimum Supported Rust Version](https://img.shields.io/badge/rustc-1.54+-blue.svg)
5+
6+
# `embedded-hal-nb`
7+
8+
A non-blocking Hardware Abstraction Layer (HAL) for embedded systems, using the `nb` crate.
9+
10+
This crate contains versions of some [`embedded-hal`] traits using `nb`, and shares its scope and [design goals].
11+
12+
This project is developed and maintained by the [HAL team][team].
13+
14+
## [API reference]
15+
16+
[API reference]: https://docs.rs/embedded-hal-nb
17+
18+
## Minimum Supported Rust Version (MSRV)
19+
20+
This crate is guaranteed to compile on stable Rust 1.54 and up. It *might*
21+
compile with older versions but that may change in any new patch release.
22+
23+
See [here](docs/msrv.md) for details on how the MSRV may be upgraded.
24+
25+
## License
26+
27+
Licensed under either of
28+
29+
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
30+
http://www.apache.org/licenses/LICENSE-2.0)
31+
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
32+
33+
at your option.
34+
35+
### Contribution
36+
37+
Unless you explicitly state otherwise, any contribution intentionally submitted
38+
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
39+
dual licensed as above, without any additional terms or conditions.
40+
41+
## Code of Conduct
42+
43+
Contribution to this crate is organized under the terms of the [Rust Code of
44+
Conduct][CoC], the maintainer of this crate, the [HAL team][team], promises
45+
to intervene to uphold that code of conduct.
46+
47+
[CoC]: ../CODE_OF_CONDUCT.md
48+
[team]: https://github.com/rust-embedded/wg#the-hal-team
49+
[`embedded-hal`]: https://crates.io/crates/embedded-hal
50+
[design goals]: https://docs.rs/embedded-hal/latest/embedded_hal/#design-goals

src/can/blocking.rs renamed to embedded-can/src/blocking.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
/// A blocking CAN interface that is able to transmit and receive frames.
44
pub trait Can {
55
/// Associated frame type.
6-
type Frame: crate::can::Frame;
6+
type Frame: crate::Frame;
77

88
/// Associated error type.
9-
type Error: crate::can::Error;
9+
type Error: crate::Error;
1010

1111
/// Puts a frame in the transmit buffer. Blocks until space is available in
1212
/// the transmit buffer.
File renamed without changes.

src/can/mod.rs renamed to embedded-can/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
//! Controller Area Network
1+
//! Controller Area Network (CAN) traits
2+
3+
#![warn(missing_docs)]
4+
#![no_std]
25

36
pub mod blocking;
47
pub mod nb;

src/can/nb.rs renamed to embedded-can/src/nb.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
/// A CAN interface that is able to transmit and receive frames.
44
pub trait Can {
55
/// Associated frame type.
6-
type Frame: crate::can::Frame;
6+
type Frame: crate::Frame;
77

88
/// Associated error type.
9-
type Error: crate::can::Error;
9+
type Error: crate::Error;
1010

1111
/// Puts a frame in the transmit buffer to be sent on the bus.
1212
///

0 commit comments

Comments
 (0)