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:
Tue Nov 19 05:31:39 2013 +0000
Revision:
0:81c08f01f0fe
Child:
1:2816fc874abc
draft;

Who changed what in which revision?

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