motacon

Dependents:   HelloWorld_MotorKaisei

INA226.hpp

Committer:
tosihisa
Date:
2012-11-24
Revision:
0:3a05c5755625
Child:
1:e0ebc6af5e04

File content as of revision 0:3a05c5755625:

/*
 * Copyright (c) 2011 Toshihisa T
 * Released under the MIT License: http://mbed.org/license/mit
 */
#ifndef __INA226_INCLUDE    // {
#define __INA226_INCLUDE
#include "mbed.h"
class INA226 {
    public:
        INA226(I2C &i2c_,int addr_ = 0x80,int freq_ = 100000);
        int isExist(void);
        int rawRead(char pointer_addr,unsigned short *val_);
        int rawWrite(char pointer_addr,unsigned short val_);
        int getVoltage(double *V_);
        int getCurrent(double *I_);
        int setCurrentCalibration(unsigned short val = 0x0A00);

    private:
        I2C &i2c;
        int i2c_addr;
        int freq;
};
#endif  // }