Skip to content

Async driver for the QMI8658 6-axis IMU sensor built on embedded-hal-async

License

Notifications You must be signed in to change notification settings

photon-circus/ph-qmi8658-imu

QMI8658 IMU Driver

CI Docs.rs License: MIT

Asynchronous Rust driver for the QMI8658C 6-axis IMU (accelerometer + gyroscope) from QST Corporation, plus ESP32-S3 example applications. Built on embedded-hal-async for use in #![no_std] environments.

Features

  • Async I2C and SPI transports via embedded-hal-async
  • Configurable accelerometer (up to 16 g) and gyroscope (up to 2048 dps)
  • FIFO buffering with burst reads and frame-level parsing
  • Interrupt routing, wake-on-motion, and sync-sample data locking
  • Self-test, calibration, and on-demand calibration support
  • Integer scaling helpers (no floats required); optional fixed-point conversions
  • Targets ESP32 (Xtensa & RISC-V) and ARM Cortex-M

MSRV: 1.92.0API docs on docs.rs

Repository Layout

Path Description
crates/qmi8658 Driver crate (ph-qmi8658)
apps/qa-runner Hardware test runner for ESP32-S3
apps/imu-example FIFO-based example app for ESP32-S3

Documentation

Quick Start

Add the dependency:

[dependencies]
ph-qmi8658 = "0.1"

Initialize the driver and read sensor data:

use ph_qmi8658::{Config, I2cConfig, Qmi8658Address, Qmi8658I2c};
use embedded_hal_async::delay::DelayNs;
use embedded_hal_async::i2c::I2c;

async fn example<I2C: I2c, D: DelayNs>(i2c: I2C, delay: &mut D) -> Result<(), ph_qmi8658::Error> {
  let config = Config::new();
  let i2c_config = I2cConfig::new(Qmi8658Address::Primary.addr());
  let mut imu: Qmi8658I2c<I2C> = Qmi8658I2c::with_i2c_config(i2c, None, None, config, i2c_config);
  imu.init(delay).await?;

  // Read accelerometer, gyroscope, temperature, and timestamp in one burst.
  let block = imu.read_raw_block().await?;
  let _ = block;
  Ok(())
}

See the driver README for configuration, FIFO, interrupt, scaling, and advanced usage examples.

Example Apps

Build targets from their directories:

QA runner:

cd apps/qa-runner
cargo build

FIFO example:

cd apps/imu-example
cargo build

Flash:

espflash flash --monitor --log-format defmt

License

MIT. See LICENSE.

About

Async driver for the QMI8658 6-axis IMU sensor built on embedded-hal-async

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages