1月14日にRS485R_2をパブリッシュしようとしたらこれをパブリッシュしろと言われたのでしました。

Fork of INA226 by Toshihisa T

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers INA226.hpp Source File

INA226.hpp

00001 /**
00002  * @section LICENSE
00003  * Released under the MIT License: http://mbed.org/license/mit
00004  * Copyright (C) 2012 tosihisa
00005  *
00006  * @section DESCRIPTION
00007  * INA226 - Bi-Directional CURRENT/POWER MONITOR with I2C
00008  * http://strawberry-linux.com/catalog/items?code=12031
00009  *
00010  */
00011 #ifndef __INA226_INCLUDE    // {
00012 #define __INA226_INCLUDE
00013 #include "mbed.h"
00014 /**
00015  * INA226 Class.
00016  */
00017 class INA226 {
00018     public:
00019         /**
00020          * Constructor.
00021          *
00022          * @param i2c_ instance of I2C.
00023          * @param addr_ I2C slave address.
00024          * @param freq_ I2C frequency.
00025          */
00026         INA226(I2C &i2c_,int addr_ = 0x94,int freq_ = 100000);
00027         /**
00028          * Check INA226 exist.
00029          *
00030          * @param none
00031          * @return 0:NOT EXIST / !0:EXIST
00032          */
00033         int isExist(void);
00034         /**
00035          * INA226 raw level read.
00036          *
00037          * @param pointer_addr INA226 pointer address.
00038          * @param val_ read value.
00039          * @return 0:Read OK / !0:Read NG
00040          */
00041         int rawRead(char pointer_addr,unsigned short *val_);
00042         /**
00043          * INA226 raw level write.
00044          *
00045          * @param pointer_addr INA226 pointer address.
00046          * @param val_ write value.
00047          * @return 0:Read OK / !0:Read NG
00048          */
00049         int rawWrite(char pointer_addr,unsigned short val_);
00050         /**
00051          * Get voltage.
00052          *
00053          * @param V_ read value;
00054          * @return 0:Read OK / !0:Read NG
00055          */
00056         int getVoltage(double *V_);
00057         /**
00058          * Get current.
00059          *
00060          * @param I_ read value;
00061          * @return 0:Read OK / !0:Read NG
00062          */
00063         int getCurrent(double *I_);
00064         /**
00065          * Set current calibration.
00066          *
00067          * @param val write value;
00068          * @return 0:Read OK / !0:Read NG
00069          */
00070         int setCurrentCalibration(unsigned short val = 0x0A00);
00071 
00072     private:
00073         I2C &i2c;
00074         int i2c_addr;
00075         int freq;
00076 };
00077 #endif  // }