Expand description
§ms5611-rs
no_std driver for the TE Connectivity MS5611 barometric pressure sensor.
- Supports both I2C and SPI interfaces
- Async and blocking APIs via
embedded-haltraits - Second-order temperature compensation
- CRC validation of calibration data
§Usage
Add this to your Cargo.toml:
[dependencies]
ms5611-rs = "0.1"§Example
use ms5611_rs::{Ms5611, Oversampling};
// I2C (CSB pin high = address 0x76)
let mut sensor = Ms5611::new_i2c(i2c, true);
// Or SPI
let mut sensor = Ms5611::new_spi(spi);
// Initialize and measure (async)
sensor.init(&mut delay).await?;
let measurement = sensor.measure(Oversampling::Osr2048, &mut delay).await?;
// Or use blocking API
sensor.init_blocking(&mut delay)?;
let measurement = sensor.measure_blocking(Oversampling::Osr2048, &mut delay)?;
println!("Pressure: {} mbar, Temp: {} °C",
measurement.pressure_mbar, measurement.temperature_c);§Cargo Features
defmt-03: Enablesdefmt::Formatfor all public types
§Related Crates
§License
MIT or Apache-2.0 license, at your option.
Structs§
- I2cInterface
- I2C interface adapter for
MS56xxsensors. - Measurement
- The compensated measurement result.
- Ms5611
- MS5611 sensor driver.
- SpiInterface
- SPI interface adapter for
MS56xxsensors. Note that this does not handle the chip select (CS). The providedSpiDevicemust manage CS as appropriate.
Enums§
- Error
- Error type for
MS56xxoperations. - Oversampling
- Oversampling ratios for MS5607 and MS5611 (256-4096).