Skip to content

Commit

Permalink
ll: add async
Browse files Browse the repository at this point in the history
  • Loading branch information
newAM authored Oct 10, 2022
1 parent e84b239 commit 89cb2b7
Show file tree
Hide file tree
Showing 9 changed files with 3,719 additions and 624 deletions.
6 changes: 3 additions & 3 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[alias]
test-all = "test --features std,log,eh0,eh1,time,chrono,num-rational,w5500-tls"
test-all = "test --features async,chrono,eh0,eh1,eha0,log,num-rational,std,time,w5500-tls"
test-dhcp = "test -p w5500-dhcp --features log,std"
test-ll = "test -p w5500-ll --features eh0,eh1,std"
test-hl = "test -p w5500-hl --features eh0,eh1,std"
test-ll = "test -p w5500-ll --all-features"
test-hl = "test -p w5500-hl --all-features"
test-mqtt = "test -p w5500-mqtt --features log,std,w5500-tls"
test-regsim = "test -p w5500-regsim"
test-sntp = "test -p w5500-sntp --features std,log,eh0,eh1,time,chrono,num-rational"
Expand Down
40 changes: 28 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,19 @@ jobs:
name: Build
runs-on: ubuntu-latest
env: {"RUSTFLAGS": "-D warnings"}
strategy:
matrix:
toolchain:
- "stable"
- "nightly"
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- run: cargo build
- run: cargo build --all-features
if: ${{ matrix.toolchain == 'nightly' }}
- run: cargo build -p testsuite

build_no_std:
Expand All @@ -28,14 +36,18 @@ jobs:
env: {"RUSTFLAGS": "-D warnings"}
strategy:
matrix:
toolchain:
- "stable"
- "nightly"
target:
- "thumbv6m-none-eabi"
- "thumbv7em-none-eabi"
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
target: ${{ matrix.target }}
toolchain: ${{ matrix.toolchain }}
- run: cargo build --target ${{ matrix.target }} -p w5500-ll
- run: cargo build --target ${{ matrix.target }} -p w5500-hl
- run: cargo build --target ${{ matrix.target }} -p w5500-dhcp
Expand Down Expand Up @@ -65,6 +77,10 @@ jobs:
- run: cargo build --target ${{ matrix.target }} -p w5500-sntp --features chrono
- run: cargo build --target ${{ matrix.target }} -p w5500-sntp --features num-rational
- run: cargo build --target ${{ matrix.target }} -p w5500-mqtt --features w5500-tls
- run: cargo build --target ${{ matrix.target }} -p w5500-ll --features async
if: ${{ matrix.toolchain == 'nightly' }}
- run: cargo build --target ${{ matrix.target }} -p w5500-ll --features eha0
if: ${{ matrix.toolchain == 'nightly' }}
- run: cargo build --target ${{ matrix.target }} -p w5500-tls --features p256-cm4
if: ${{ matrix.target == 'thumbv7em-none-eabi' }}
- run: cargo build --target ${{ matrix.target }} -p w5500-mqtt --features w5500-tls,p256-cm4
Expand All @@ -76,15 +92,15 @@ jobs:
env: {"RUSTFLAGS": "-D warnings"}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@nightly
- run: cargo test-all

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- run: cargo clippy --all-features -- --deny warnings
Expand Down Expand Up @@ -136,7 +152,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@nightly
- name: Publish
run: |
cd ll
Expand All @@ -157,7 +173,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@nightly
- name: Publish
run: |
cd hl
Expand All @@ -178,7 +194,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@nightly
- name: Publish
run: |
cd dhcp
Expand All @@ -199,7 +215,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@nightly
- name: Publish
run: |
cd regsim
Expand All @@ -220,7 +236,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@nightly
- name: Publish
run: |
cd dns
Expand All @@ -241,7 +257,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@nightly
- name: Publish
run: |
cd mqtt
Expand All @@ -262,7 +278,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@nightly
- name: Publish
run: |
cd sntp
Expand All @@ -283,7 +299,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@nightly
- name: Publish
run: |
cd tls
Expand Down
2 changes: 2 additions & 0 deletions ll/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- Added support for `embedded-hal` version `1.0.0-alpha.9` with the `eh1` feature.
- Added support for `embedded-hal-async` version `0.1.0-alpha.1` with the `eha0` feature.
- Added an `aio` module with async traits.

### Changed
- Changed the `embedded-hal` version `0.2` feature name to `eh0`.
Expand Down
13 changes: 11 additions & 2 deletions ll/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,24 @@ homepage = "https://github.com/newAM/w5500-rs"

[features]
std = []
async = []
eha0 = ["async", "dep:eha0", "dep:eh1"]
eh1 = ["dep:eh1"]

[dependencies]
defmt = { version = "0.3", optional = true }
eh0 = { package = "embedded-hal", version = "0.2.7", optional = true }
eh1 = { package = "embedded-hal", version = "=1.0.0-alpha.9", optional = true }
defmt = { version = "0.3", optional = true }
eha0 = { package = "embedded-hal-async", version = "=0.1.0-alpha.2", optional = true }

[dev-dependencies]
ehm0 = { package = "embedded-hal-mock", version = "0.8" }
ehm1 = { package = "embedded-hal-mock", git = "https://github.com/newAM/embedded-hal-mock", branch = "1.0.0-alpha.9" }

[dev-dependencies.ehm1]
package = "embedded-hal-mock"
git = "https://github.com/newAM/embedded-hal-mock"
branch = "async"
features = ["embedded-hal-async"]

[package.metadata.docs.rs]
all-features = true
Expand Down
7 changes: 7 additions & 0 deletions ll/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,26 @@ assert_eq!(version, 0x04);

All features are disabled by default.

* `async`: **Nightly only.** Enables the asynchronous [`aio::Registers`]
trait.
* `defmt`: Enable formatting most types with `defmt`.
* `eh0`: Enables the [`eh0`] module which contains
implementations of the [`Registers`] trait
using the `embedded-hal` version 0.2 traits.
* `eh1`: Enables the [`eh1`] module which contains
implementations of the [`Registers`] trait
using the `embedded-hal` version 1 traits.
* `eha0`: **Nightly only.**
Implements the [`aio::Registers`] trait for types in the [`eh1`] module
using the `embedded-hal-async` alpha traits.
* `std`: Enables conversion between [`std::net`] and [`w5500_ll::net`] types.
This is for testing purposes only, the `std` flag will not work on
embedded systems because it uses the standard library.

[`std::net`]: https://doc.rust-lang.org/std/net/index.html
[Wiznet W5500]: https://www.wiznet.io/product-item/w5500/
[`aio::Registers`]: https://docs.rs/w5500-ll/latest/w5500_ll/aio/trait.Registers.html
[`aio`]: https://docs.rs/w5500-ll/latest/w5500_ll/aio/index.html
[`eh0`]: https://docs.rs/w5500-ll/latest/w5500_ll/eh0/index.html
[`eh1`]: https://docs.rs/w5500-ll/latest/w5500_ll/eh1/index.html
[`Registers`]: https://docs.rs/w5500-ll/latest/w5500_ll/trait.Registers.html
Expand Down
Loading

0 comments on commit 89cb2b7

Please sign in to comment.