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.

Dependents:   INA219TEST

Fork of INA219 by Michael Ammann

Committer:
x893
Date:
Mon Jun 30 08:27:27 2014 +0000
Revision:
3:c4a937ab46bf
Parent:
2:a123ae7c1e4b
Fix errors

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:
x893 3:c4a937ab46bf 19 INA219(PinName sda, PinName scl,
x893 3:c4a937ab46bf 20 unsigned char adr /* range 0x80(1000000)-0x9E(1001111) */,
x893 3:c4a937ab46bf 21 int hz);
mazgch 0:81c08f01f0fe 22 bool detect(void);
x893 3:c4a937ab46bf 23 I2C getI2C(void);
mazgch 0:81c08f01f0fe 24 double getCurrent(void);
mazgch 0:81c08f01f0fe 25 double getVoltage(void);
x893 3:c4a937ab46bf 26 unsigned short getRegister(unsigned char reg);
x893 3:c4a937ab46bf 27 bool getRegister(unsigned char reg, unsigned short *data);
x893 3:c4a937ab46bf 28 unsigned char Address;
mazgch 0:81c08f01f0fe 29 protected:
mazgch 0:81c08f01f0fe 30 I2C _i2c;
mazgch 1:2816fc874abc 31 };