pub struct MS8607<I2C> { /* private fields */ }
Expand description
A platform agnostic Rust driver for the MS8607 Pressure, Temperature, and Humidity Sensor from TE Connectivity.
Example
// Create a new instance of the MS8607 driver
let mut ms8607 = MS8607::new(i2c);
// Initialize and calibrate the sensor
let begin = ms8607.begin(&mut delay);
// Init OK, sensor foun
// Get measurements
let (pres, temp, hum) = ms8607.get_measurements(&mut delay).unwrap();
hprintln!("Pressure: {pres:.2} Pa, Temperature: {temp:.2} C, Humidity: {hum:.2} %RH\r");
Implementations§
source§impl<I2C, E> MS8607<I2C>where
I2C: Write<Error = E> + WriteRead<Error = E>,
impl<I2C, E> MS8607<I2C>where
I2C: Write<Error = E> + WriteRead<Error = E>,
sourcepub fn begin<Delay>(&mut self, delay: &mut Delay) -> Result<(), Error<E>>where
Delay: DelayMs<u16>,
pub fn begin<Delay>(&mut self, delay: &mut Delay) -> Result<(), Error<E>>where
Delay: DelayMs<u16>,
Sets up the hardware and initializes I2C
sourcepub fn enable_humidity_clock_stretching(&mut self, enable_stretching: bool)
pub fn enable_humidity_clock_stretching(&mut self, enable_stretching: bool)
Allow the MS8607 to hold the clock line low until it completes the requested measurements
Arguments
enable_stretching: true to enable clock stretching, false to disable
sourcepub fn set_humidity_resolution(
&mut self,
resolution: Ms8607HumidityResolution
) -> Result<(), Error<E>>
pub fn set_humidity_resolution(
&mut self,
resolution: Ms8607HumidityResolution
) -> Result<(), Error<E>>
sourcepub fn set_pressure_resolution(&mut self, resolution: Ms8607PressureResolution)
pub fn set_pressure_resolution(&mut self, resolution: Ms8607PressureResolution)
sourcepub fn get_humidity_resolution(
&mut self
) -> Result<Ms8607HumidityResolution, Error<E>>
pub fn get_humidity_resolution(
&mut self
) -> Result<Ms8607HumidityResolution, Error<E>>
Get the currently set resolution for humidity readings
sourcepub fn get_pressure_resolution(&self) -> Ms8607PressureResolution
pub fn get_pressure_resolution(&self) -> Ms8607PressureResolution
Get the currently set resolution for pressure readings