Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a8bce9e
Add interrupts and interrupts mask
billythedummy Nov 25, 2020
fc81e28
add accelerometer interrupt settings
billythedummy Nov 25, 2020
08a664b
add interrupt settings
billythedummy Nov 25, 2020
a25c79a
need to be in config mode to change interrupt configs, add interrupt …
billythedummy Nov 25, 2020
4c21382
ACC_AM, cargo fmt
billythedummy Feb 8, 2021
0b79810
add acc config
billythedummy Feb 8, 2021
332fba7
add set_acc_config
billythedummy Jun 22, 2021
2ed96c8
make acc config fields pub
billythedummy Jun 22, 2021
3ba93a2
Merge remote-tracking branch 'billythedummy/master' into feat/configs…
elpiel Apr 2, 2025
564860b
feat: Interrupts for Accelerometer and Gyroscope
elpiel Apr 6, 2025
aa6a77b
chore: move SYS_TRIGGER register values to separate struct
elpiel Apr 11, 2025
8896678
chore: update defmt impl for status code
elpiel Jul 31, 2025
684563c
feat: async impl
elpiel Jul 31, 2025
b75abe3
feat: Acc/gyr/mag config
elpiel Aug 6, 2025
dbcca66
fix: FromPrimitive + conflicting default impl
elpiel Aug 6, 2025
8a0cbe5
fix: compilation
elpiel Aug 6, 2025
28098af
chore: custom defmt::Format impls
elpiel Aug 6, 2025
afe8d5c
fix: reg. value and try to fix interrupts
elpiel Aug 17, 2025
5a3f02d
fix: lints
elpiel Nov 20, 2025
97ecac6
fix: enable blocking feature by default
elpiel Nov 20, 2025
6fc24ec
fix: allow clippy type_complexity for dof9 & dof9_fixex
elpiel Nov 20, 2025
c358eb3
fix: interrupts reg value test
elpiel Nov 20, 2025
3305423
fix(ci): install x86_64-musl
elpiel Nov 20, 2025
daed0e7
fix(ci): install musl-tools for nightly with fuzz tool
elpiel Nov 20, 2025
be2969f
fix(ci): use cargo install for cargo-fuzz because of musl
elpiel Nov 20, 2025
30ffa6f
fiix(ci): bump msrv
elpiel Nov 20, 2025
3b6c532
fix: features and calibrate example
elpiel Nov 20, 2025
9fbf4c5
fix: cargo.toml features
elpiel Nov 20, 2025
322778b
fix(ci): remove musl target
elpiel Nov 20, 2025
5dd453a
fix(ci): docs build
elpiel Nov 20, 2025
0584c10
fix(fuzz): bno055 dependency
elpiel Nov 20, 2025
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
27 changes: 13 additions & 14 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Rust

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

env:
CARGO_TERM_COLOR: always
Expand All @@ -19,7 +19,7 @@ jobs:
submodules: true
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt, clippy, rust-docs
components: rustfmt, clippy, rust-docs

- name: Rustfmt lints
run: cargo fmt --all -- --check
Expand All @@ -28,7 +28,7 @@ jobs:
run: cargo clippy --no-deps -- -D warnings

- name: Build docs
run: RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features --no-deps
run: RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --features std,serde,async,defmt --no-deps

build:
runs-on: ubuntu-latest
Expand All @@ -38,11 +38,11 @@ jobs:
- stable
- beta
- nightly
- "1.65" # MSRV
- "1.80" # MSRV

steps:
- name: Checkout Sources
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Install Rust (thumbv7em)
uses: dtolnay/rust-toolchain@master
with:
Expand All @@ -54,17 +54,16 @@ jobs:
run: cargo build --features "std"
- name: Build - serde
run: cargo build --features "serde"
- name: Build - defmt-03
run: cargo build --features "defmt-03"
- name: Build - examples
run: cargo build --examples
- name: Build - defmt
run: cargo build --features "defmt"
- name: Build - examples (blocking)
run: cargo build --examples --no-default-features -F blocking
- name: Run tests
run: cargo test
# Cargo binstall currently installs musl binary and requires additional setup.
- name: Install cargo-fuzz
# pre-build binaries
uses: taiki-e/install-action@v2
with:
tool: cargo-fuzz
if: ${{ matrix.rust == 'nightly' }}
run: cargo +nightly install cargo-fuzz
- name: Fuzz (nightly only)
if: ${{ matrix.rust == 'nightly' }}
run: |
Expand Down
20 changes: 15 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ license-file = "LICENSE"
readme = "README.md"

# linux-embedded-hal requires 1.65 because of nix
rust-version = "1.65"
rust-version = "1.80"

[dependencies]
byteorder = { version = "1", default-features = false }
Expand All @@ -28,16 +28,26 @@ bitflags = "2"
num-traits = { version = "0.2.15", default-features = false, features = ["libm"] }
num-derive = "0.4.1"

defmt = { version = "0.3", optional = true }
defmt = { version = "1", optional = true }

embedded-hal = { version = "1.0" }
embedded-hal-async = { version = "1.0", optional = true }

maybe-async = "0.2"

[features]
default = []
default = ["async"]
std = []

defmt-03 = ["dep:defmt", "embedded-hal/defmt-03"]
async = ["dep:embedded-hal-async"]
blocking = ["maybe-async/is_sync"]

defmt = ["dep:defmt", "embedded-hal/defmt-03"]
serde = ["dep:serde", "mint/serde"]

[dev-dependencies]
linux-embedded-hal = "0.4"
linux-embedded-hal = { version = "0.4", features = ["async-tokio"] }

[[example]]
name = "calibrate"
required-features = ["blocking"]
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,24 @@ If your microcontroller is faster in starting up you might have to delay before
By default, this crate is `no_std` compatible. However, you can enable `std` features by enabling the `std` feature flag.
At the moment this only adds `std::error::Error` trait implementation for the `Error` type.

### `blocking`
Enables the blocking API but cannot enable it with the `async` features.
Use `default-features = false` to disable `async`.

### `async` (default)
Enables the async API based on `embedded-hal-async@1` and cannot be enabled if `blocking` is enabled as well.

### `serde`

The `serde` flag adds implementation of `Serialize` / `Deserialize` to `BNO055Calibration`.

**Note:** `serde` itself is `no_std` compatible, however not all serializers are (e.g. `serde-json` is not but `serde-json-core` is),
so be careful that you're not enabling `serde`'s `std` feature by accident (see [here](https://serde.rs/no-std.html#no-std-support) for a complete explanation).

## `defmt`
The `defmt` flag adds implementation of `defmt::Format` to most structures and enums.


## Usage

1. Add a dependency to `Cargo.toml`:
Expand Down
10 changes: 10 additions & 0 deletions examples/calibrate.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
//! Run calibration using linux i2c-0 device.
//! `linux_embedded_hal::I2cdev` doesn't support `async`.
//!
//! `cargo run --example calibrate --no-default-features -F blocking`
//!
//! Make sure to run the necessary steps to allow the IMU to auto-calibrate.
//! See Datasheet section 3.11 Page 51, https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bno055-ds000.pdf (As of 2021-07-02)
use bno055::{BNO055OperationMode, Bno055};
use linux_embedded_hal::{Delay, I2cdev};
use mint::{EulerAngles, Quaternion};

#[cfg(not(feature = "blocking"))]
compile_error!("You must disable default features and enable 'blocking' to run the example: 'cargo run --example calibrate --no-default-features -F blocking'");

fn main() {
let dev = I2cdev::new("/dev/i2c-0").unwrap();
let mut delay = Delay {};
Expand Down
2 changes: 2 additions & 0 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ embedded-hal = "1.0"

[dependencies.bno055]
path = ".."
default-features = false
features = ["blocking"]

# Prevent this from interfering with workspaces
[workspace]
Expand Down
Loading