Skip to main content

pamoja_ina226_sim_reporting

Function pamoja_ina226_sim_reporting 

Source
#[unsafe(no_mangle)]
pub extern "C" fn pamoja_ina226_sim_reporting( address: u8, shunt_milliohms: u32, max_microamps: u32, bus_microvolts: u32, microamps: i32, ) -> *mut PamojaI2cPart
Expand description

Creates a simulated INA226 that reads what it is asked to, calibrated for the same shunt and largest current a driver is given.

§Arguments

  • address - the address it answers to.
  • shunt_milliohms - the shunt, as in the driver’s settings.
  • max_microamps - the largest current, as in the driver’s settings.
  • bus_microvolts - the bus voltage it reports.
  • microamps - the current it reports; negative flows the other way through the shunt.

§Returns

The part, which the caller releases with crate::hal::pamoja_i2c_part_free. Its readings land on the steps its registers count in: 1.25 mV of bus, 2.5 uV of shunt, and the calibration’s current step.