Skip to main content

current_register_from_shunt

Function current_register_from_shunt 

Source
pub fn current_register_from_shunt(shunt: i16, calibration: u16) -> i16
Expand description

Reproduces the chip’s current calculation from a shunt reading and calibration.

This is the datasheet’s Current = ShuntVoltage * CalibrationRegister / 2048, so a simulator can fill the current register the way the chip would.

§Arguments

  • shunt - the signed shunt voltage register.
  • calibration - the programmed calibration register.

§Returns

The signed current register the chip would hold.