INA226 Library
Dependents: HYBRYD2018_IZU_ROCKET Hybrid_IZU2019 SWAN_IZU2019_v1 Hybrid_OB2021_MAIN
INA226.h
- Committer:
- zebrin1422
- Date:
- 2017-07-15
- Revision:
- 3:ea79e6a72ec3
- Parent:
- 2:eccb118370eb
- Child:
- 5:76dc889ffe3c
File content as of revision 3:ea79e6a72ec3:
#ifndef INA226 #define INA226 #define SLV_WRITE 0b10001000 #define SLV_READ 0b10001001 #define check_reg 0xFE #define Ctrl_reg 0x00 #define V_shunt_reg 0x01 #define V_bus_reg 0x02 #define power_reg 0x03 #define current_reg 0x04 #define cal_reg 0x05 //I2C i2c(PB_7, PB_6); // sda, scl //Serial pc(USBTX, USBRX); //tx, rx /** * @bref INA226 Class * @author Seiya Maemura */ class myINA226 { public: myINA226(I2C &i2cBus); void set_callibretion(unsigned int val = 0x0AAA); int Connection_check(); void setup(int i); void get_Voltage_current(float *V_bus, float *current); float get_Shunt_voltage(); float get_Bus_voltage(); float get_current(); float get_power(); private: I2C *i2c; float vlotage,current; unsigned int val[4]; char *cal,buff[4],reg,check[2]; }; #endif