#imu #embedded-hal #bmi260 #bmi270

bmi2

embedded-hal driver for the bmi270/260 IMU

2 releases

new 0.1.1 Feb 20, 2025
0.1.0 Feb 19, 2025

#350 in Hardware support

41 downloads per month

MIT license

190KB
3K SLoC

bmi2

stability-wip

This is an embedded-hal driver for the Bosch BMI260/270 inertial measurement unit.

Quick start

// ...

/// Create a new Bmi2 device using I2C with its alternative address (0x69).
/// Configure the max data burst to 255 bytes:
/// - used for the upload of the configuration during initialization.
/// - This is a limitation from your device or its HAL. 
let mut bmi = Bmi2::new_i2c(i2c, I2cAddr::Alternative, Burst::Other(255));

/// Get the chip id. Should be 0x24 or 36 in decimal
let chip_id = bmi.get_chip_id().unwrap();

/// Initialize the senor.
/// During this process a configuration of > 8kB is uploaded to the sensor.
/// Alternatively, for the BMI260 call its dedicated config:
/// bmi.init(&config::BMI260_CONFIG_FILE).unwrap();
bmi.init(&config::BMI270_CONFIG_FILE).unwrap();

/// Enable power for the accelerometer and the gyroscope.
let pwr_ctrl = PwrCtrl { aux_en: false, gyr_en: true, acc_en: true, temp_en: false };
bmi.set_pwr_ctrl(pwr_ctrl).unwrap();

/// Read the raw data
let data = bmi.get_data().unwrap();

// ...

Dependencies

~90KB