Crate ina226

source ·
Expand description

This is a platform agnostic Rust driver for the INA226, an I2C output current/voltage/power monitor with alerts, using the embedded-hal traits.

This driver allows you to:

§The device

The INA226 is a current shunt and power monitor with an I2C™- or SMBUS-compatible interface. The device monitors both a shunt voltage drop and bus supply voltage. Programmable calibration value, conversion times, and averaging, combined with an internal multiplier, enable direct readouts of current in amperes and power in watts.

The INA226 senses current on common-mode bus voltages that can vary from 0 V to 36 V, independent of the supply voltage. The device operates from a single 2.7-V to 5.5-V supply, drawing a typical of 330 µA of supply current. The device is specified over the operating temperature range between –40°C and 125°C and features up to 16 programmable addresses on the I2C-compatible interface.

Datasheet:

Structs§

  • The state of the configuration register.
  • INA226 voltage/current/power monitor
  • The Mask/Enable Register selects the function that is enabled to control the Alert pin as well as how that pin functions. If multiple functions are enabled, the highest significant bit position Alert Function (D15-D11) takes priority and responds to the Alert Limit Register.

Enums§

  • Determines the number of samples that are collected and averaged.
  • Selects continuous, triggered, or power-down mode of operation.
  • Sets the conversion time for the bus voltage measurement.
  • Sets the conversion time for the shunt voltage measurement.

Constants§