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.
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 bool detect(void); 00022 double getCurrent(void); 00023 double getVoltage(void); 00024 protected: 00025 bool _det; 00026 unsigned char _adr; 00027 I2C _i2c; 00028 };
Generated on Sun Jul 24 2022 22:49:42 by 1.7.2