Skip to content

WIP: Rust BMI270 embedded-hal-async driver

License

Notifications You must be signed in to change notification settings

calrov-software/bmi270-async

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust BMI260/270 driver

stability-wip

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

Quick start

// ...

/// Create a new Bmi270 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 = Bmi270::new_i2c(i2c, I2cAddr::Alternative, Burst::Other(255)).await;

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

/// Initialize the senor.
/// During this process a configuration of > 8kB is uploaded to the sensor.
bmi.init(&config::BMI270_CONFIG_FILE).await.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).await.unwrap();

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

// ...

About

WIP: Rust BMI270 embedded-hal-async driver

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%