| Crates.io | icm20948-async |
| lib.rs | icm20948-async |
| version | 0.5.1 |
| created_at | 2023-10-08 19:57:18.185395+00 |
| updated_at | 2025-12-12 14:35:15.778846+00 |
| description | Async driver for the ICM20948 (Imu+Mag) for no_std environments |
| homepage | |
| repository | https://github.com/peterkrull/icm20948-async |
| max_upload_size | |
| id | 997418 |
| size | 40,157 |
This driver crate for the ICM20948 uses the embedded-hal-async traits to achieve completely non-blocking access to the ICM20948. The crate uses generics to automatically expose the relevant methods, when various hardware features are configured, for example when the magnetometer is enabled.
The current feature set is basic, but allows for reading the main sensors and writing the most important values. Below is the feature list, with supported features checked off. The rest are on the to-do list.
use icm20948_async::{IcmBuilder, GyrUnit, GyrDlp, AccRange};
let mut imu = IcmBuilder::new_i2c(i2c, delay)
.gyr_unit(GyrUnit::Rps) // Set gyroscope to output rad/s
.gyr_dlp(GyrDlp::Hz196) // Set gyroscope low-pass filter
.acc_range(AccRange::Gs8) // Set accelerometer measurement range
.set_address(0x69) // Set address (0x68 or 0x69)
.initialize_9dof() // Initialize with magnetometer
.await?;
loop {
let measurement = imu.read_9dof().await?;
// We now have:
// measurement.acc: [f32; 3]
// measurement.gyr: [f32; 3]
// measurement.mag: [f32; 3]
}