This is a platform agnostic Rust driver for the BMP180 pressure sensor using the embedded-hal
traits.
This driver allows you to:
- Measure the pressure in pascals. See:
pressure_pa()
. - Measure the pressure in hectopascals. See:
pressure_hpa()
. - Measure the pressure in kilopascals. See:
pressure_kpa()
. - Measure the temperature in celsius. See:
temperature_celsius()
.
The BMP180 is the function compatible successor of the BMP085, a new generation of high precision digital pressure sensors for consumer applications.
The ultra-low power, low voltage electronics of the BMP180 is optimized for use in mobile phones, PDAs, GPS navigation devices and outdoor equipment. With a low altitude noise of merely 0.25m at fast conversion time, the BMP180 offers superior performance. The I2C interface allows for easy system integration with a microcontroller.
The BMP180 is based on piezo-resistive technology for EMC robustness, high accuracy and linearity as well as long term stability.
Documentation:
- Datasheets: BMP180
To use this driver, import this crate and an embedded_hal
implementation,
then instantiate the appropriate device.
use linux_embedded_hal::I2cdev;
use mlx9061x::{Mlx9061x, SlaveAddr};
fn main() {
// Create a delay abstraction based on SysTick
let mut delayObj = hal::delay::Delay::new(cp.SYST, &clocks);
let i2c = I2c::new(dp.I2C1, (scl, sda), 100.kHz(), &clocks); //100 kHz I2C Bus speed
let mut sensor = bmp180::BMP180BarometerThermometer::new(i2c, boxy , bmp180::BMP180PressureMode::BMP180Standard);
loop {
let pressure_in_hpa: f32 = barometer.pressure_hpa();
let pressure_temp_celsius: f32 = barometer.temperature_celsius();
}
}
For questions, issues, feature requests, and other changes, please file an issue in the github project.
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
- BSD-3-Clause license (LICENSE-BSD-3-Clause)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be triple licensed as above, without any additional terms or conditions.