Skip to main content

reporting

Function reporting 

Source
pub fn reporting(
    co2_ppm: u16,
    celsius: f32,
    relative_humidity: f32,
) -> CommandPart
Expand description

An SCD4x that reads what it is asked to.

§Arguments

  • co2_ppm - the carbon dioxide concentration it reports, in parts per million.
  • celsius - the temperature it reports.
  • relative_humidity - the humidity it reports, as a percentage.

§Returns

The part. Its temperature and humidity land on the nearest steps its 16-bit words represent.

§Examples

use pamoja_hal::script::DelayLog;
use pamoja_sensors::scd4x::{sim, Scd4x};

let mut sensor = Scd4x::new(sim::reporting(1_450, 24.0, 55.0), DelayLog::new());
let reading = sensor.measure().expect("the part answers");
assert_eq!(reading.co2_ppm, 1_450);