Skip to main content

max_measurement_micros

Function max_measurement_micros 

Source
pub fn max_measurement_micros(
    temperature: Oversampling,
    pressure: Oversampling,
    humidity: Oversampling,
) -> u32
Expand description

The longest one measurement cycle can take, in microseconds.

This is the datasheet’s maximum: 1.25 ms, plus 2.3 ms per temperature sample, plus 2.3 ms per pressure sample and 0.575 ms, plus 2.3 ms per humidity sample and 0.575 ms, each term only for a measurement that is not skipped. A driver waits this long after forcing a measurement before it polls the status register.

§Arguments

  • temperature - temperature oversampling.
  • pressure - pressure oversampling.
  • humidity - humidity oversampling.

§Returns

The maximum measurement time in microseconds.

§Examples

use pamoja_sensors::bme280::{max_measurement_micros, Oversampling};

// The datasheet's worked example: temperature x1, pressure x4, no humidity.
let micros = max_measurement_micros(Oversampling::X1, Oversampling::X4, Oversampling::Skipped);
assert_eq!(micros, 13_325);