Mitek ... / INA219

Dependents:   INA219TEST

Fork of INA219 by Michael Ammann

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers INA219.h Source File

INA219.h

00001 #pragma once 
00002 
00003 #include "mbed.h"
00004 
00005 /* Supply measurement chip (TI INA 219)
00006    http://www.ti.com/product/ina219
00007    
00008    The INA219 is a high-side current shunt and power monitor 
00009    with an I2C interface. The INA219 monitors both shunt drop
00010    and supply voltage, with programmable conversion times and 
00011    filtering. A programmable calibration value, combined with 
00012    an internal multiplier, enables direct readouts in amperes. 
00013    An additional multiplying register calculates power in watts. 
00014    The I2C interface features 16 programmable addresse
00015 */
00016 class INA219
00017 {
00018 public: 
00019     INA219(PinName sda, PinName scl,
00020         unsigned char adr /* range 0x80(1000000)-0x9E(1001111) */,
00021         int hz);
00022     bool detect(void);
00023     I2C getI2C(void);
00024     double getCurrent(void);
00025     double getVoltage(void);
00026     unsigned short getRegister(unsigned char reg);
00027     bool getRegister(unsigned char reg, unsigned short *data);
00028     unsigned char Address;
00029 protected:
00030     I2C _i2c;
00031 };