The INA219 is a high-side current shunt and power monitor with an I2C interface. The INA219 monitors both shunt drop and supply voltage, with programmable conversion times and filtering. A programmable calibration value, combined with an internal multiplier, enables direct readouts in amperes. An additional multiplying register calculates power in watts. The I2C interface features 16 programmable addresses.

Committer:
mazgch
Date:
Fri Nov 22 08:36:36 2013 +0000
Revision:
2:a123ae7c1e4b
Parent:
1:2816fc874abc
update

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mazgch 2:a123ae7c1e4b 1 #pragma once
mazgch 2:a123ae7c1e4b 2
mazgch 0:81c08f01f0fe 3 #include "mbed.h"
mazgch 0:81c08f01f0fe 4
mazgch 0:81c08f01f0fe 5 /* Supply measurement chip (TI INA 219)
mazgch 0:81c08f01f0fe 6 http://www.ti.com/product/ina219
mazgch 0:81c08f01f0fe 7
mazgch 0:81c08f01f0fe 8 The INA219 is a high-side current shunt and power monitor
mazgch 0:81c08f01f0fe 9 with an I2C interface. The INA219 monitors both shunt drop
mazgch 0:81c08f01f0fe 10 and supply voltage, with programmable conversion times and
mazgch 0:81c08f01f0fe 11 filtering. A programmable calibration value, combined with
mazgch 0:81c08f01f0fe 12 an internal multiplier, enables direct readouts in amperes.
mazgch 0:81c08f01f0fe 13 An additional multiplying register calculates power in watts.
mazgch 0:81c08f01f0fe 14 The I2C interface features 16 programmable addresse
mazgch 0:81c08f01f0fe 15 */
mazgch 0:81c08f01f0fe 16 class INA219
mazgch 0:81c08f01f0fe 17 {
mazgch 0:81c08f01f0fe 18 public:
mazgch 0:81c08f01f0fe 19 INA219(PinName sda, PinName scl,
mazgch 0:81c08f01f0fe 20 unsigned char adr /* range 0x80(1000000)-0x9E(1001111) */);
mazgch 0:81c08f01f0fe 21 bool detect(void);
mazgch 0:81c08f01f0fe 22 double getCurrent(void);
mazgch 0:81c08f01f0fe 23 double getVoltage(void);
mazgch 0:81c08f01f0fe 24 protected:
mazgch 0:81c08f01f0fe 25 bool _det;
mazgch 0:81c08f01f0fe 26 unsigned char _adr;
mazgch 0:81c08f01f0fe 27 I2C _i2c;
mazgch 1:2816fc874abc 28 };