pub fn reporting(address: u8, lux: f32) -> WordPartExpand description
An OPT3001 that reads what it is asked to.
§Arguments
address- the address it answers to.lux- the illuminance it reports, which lands on the nearest step the part’s exponent and mantissa can represent.
§Returns
The part.
§Examples
use pamoja_hal::script::DelayLog;
use pamoja_sensors::opt3001::{sim, Opt3001, I2C_ADDRESS_GND};
let mut light = Opt3001::new(sim::reporting(I2C_ADDRESS_GND, 1200.0), I2C_ADDRESS_GND, DelayLog::new());
let reading = light.measure().expect("the part answers");
assert_eq!(reading.lux(), 1200.0);