pub fn reporting(
address: u8,
shunt_milliohms: u32,
max_microamps: u32,
bus_millivolts: u32,
microamps: i32,
) -> WordPartExpand description
An INA219 that reads what it is asked to.
§Arguments
address- the address it answers to.shunt_milliohms- the shunt, as the driver is told withwith_shunt.max_microamps- the largest current, as the driver is told withwith_shunt.bus_millivolts- the bus voltage it reports.microamps- the current it reports; negative flows the other way through the shunt.
§Returns
The part. Its readings land on the steps its registers count in: 4 mV of bus, 10 µV of shunt, and the calibration’s current step.
§Examples
use pamoja_hal::script::DelayLog;
use pamoja_sensors::ina219::{sim, Ina219, BASE_ADDRESS};
let part = sim::reporting(BASE_ADDRESS, 100, 3_200_000, 5_000, 250_000);
let mut monitor = Ina219::new(part, BASE_ADDRESS, DelayLog::new());
let reading = monitor.measure().expect("the part answers");
assert_eq!(reading.bus_millivolts(), 5_000);