Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.rs text eol=lf
*.ddsl text eol=lf
34 changes: 14 additions & 20 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,27 @@ jobs:

test:
runs-on: ubuntu-latest
name: ubuntu / stable / test
name: ubuntu / stable / test / ${{ matrix.features }}
strategy:
fail-fast: false
matrix:
include:
- features: default
args: ""
- features: all-features
args: "--all-features"
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: cargo test
run: cargo test
run: cargo test ${{ matrix.args }}
# After ensuring tests pass, finally ensure the test code itself contains no clippy warnings
- name: cargo clippy
run: |
cargo clippy --tests -- -Dwarnings
cargo clippy --tests ${{ matrix.args }} -- -Dwarnings

msrv:
# check that we can build using the minimal rust version that is specified by this crate
Expand All @@ -148,27 +154,15 @@ jobs:
strategy:
fail-fast: false
matrix:
msrv: ["1.85"] # We're relying on namespaced-features, which
# was released in 1.60
#
# We also depend on `fixed' which requires rust
# 1.71
#
# Additionally, we depend on embedded-hal-async
# which requires 1.75
#
# embassy-time requires 1.79 due to
# collapse_debuginfo
#
# device-driver requires 1.85 for rust2024
msrv: ["1.94"] # Required by device-driver 2.1.
name: ubuntu / ${{ matrix.msrv }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: Install MSRV
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: cargo +stable check
toolchain: ${{ matrix.msrv }}
- name: cargo check
run: cargo check
35 changes: 9 additions & 26 deletions .github/workflows/device-driver.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Keep src/device.rs in sync with device.ddsl.
permissions:
contents: read
on:
Expand All @@ -11,34 +12,16 @@ name: device-driver-pregen-check
jobs:
device-driver-pregen-check:
runs-on: ubuntu-latest
timeout-minutes: 20
name: device-driver-pregen-check
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: Install nightly with rustfmt
uses: dtolnay/rust-toolchain@nightly
persist-credentials: false
- name: Check generated device driver
uses: tullom/device-driver-pregen-check@v1.1.0
Comment thread
tullom marked this conversation as resolved.
with:
components: rustfmt
- name: Install device-driver-cli from crates.io
uses: baptiste0928/cargo-install@v3
with:
crate: device-driver-cli
version: '=1.0.9'
- name: Generate files
run: device-driver-cli --manifest device.yaml --device-name Device -o ci_gen_device.rs
- name: Format generated file with nightly rustfmt
# The committed pregen file is formatted with nightly rustfmt (see
# rustfmt.toml unstable options used by the nightly fmt CI job).
# Format the freshly generated file the same way before diffing,
# otherwise this check perpetually conflicts with `nightly / fmt`.
run: rustup run nightly rustfmt --edition 2024 ci_gen_device.rs
- name: Check that the files are the exact same
uses: LouisBrunner/diff-action@v2.0.0
with:
old: ci_gen_device.rs
new: src/device.rs
mode: strict
tolerance: same
source: device.ddsl
generated-file: src/device.rs
Comment thread
Copilot marked this conversation as resolved.
rust-defmt-feature: defmt
400 changes: 224 additions & 176 deletions AGENTS.md

Large diffs are not rendered by default.

73 changes: 30 additions & 43 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
[package]
name = "bq25773"
version = "0.2.1"
version = "0.3.0"
Comment thread
felipebalbi marked this conversation as resolved.
repository = "https://github.com/OpenDevicePartnership/bq25773"
license = "MIT"
description = "Platform-agnostic Rust driver for the Texas Instruments BQ25773 battery charge controller."
readme = "README.md"
keywords = ["battery", "charger", "i2c", "driver", "embedded-hal"]
categories = ["embedded", "hardware-support", "no-std"]
documentation = "https://docs.rs/bq25773"
include = ["/**/*.rs", "/Cargo.toml", "/README.md", "/LICENSE", "/device.yaml"]
include = ["/**/*.rs", "/Cargo.toml", "/README.md", "/LICENSE", "/device.ddsl"]
edition = "2024"
rust-version = "1.94"

[dependencies]
device-driver = { version = "1.0.9", default-features = false }
defmt = { version = "0.3", optional = true }
device-driver = { version = "2.1.1", default-features = false }
defmt = { version = "1", optional = true }
embedded-hal = "1.0.0"
embedded-hal-async = "1.0.0"
embedded-batteries-async = "0.3"
Expand Down Expand Up @@ -41,8 +42,8 @@ unreachable = "deny"
unwrap_used = "deny"

[features]
defmt-03 = [
defmt = [
"dep:defmt",
"device-driver/defmt-03",
"device-driver/defmt",
Comment thread
tullom marked this conversation as resolved.
"embedded-batteries-async/defmt",
]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A higher level API will be built on top of the lower level register accessor usi

## MSRV

Currently, rust `1.85` and up is supported.
Rust `1.94` and up is supported, as required by `device-driver` 2.1.

## License

Expand Down
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(missing_docs)]
fn main() {
println!("cargo:rebuild-if-changed=device.yaml");
println!("cargo:rerun-if-changed=device.ddsl");
}
Loading
Loading