a

Committer:
tosihisa
Date:
Sat Nov 24 18:29:15 2012 +0000
Revision:
1:e0ebc6af5e04
Parent:
0:3a05c5755625
Child:
2:8950b0f31d73
wrote doxygen comment.;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tosihisa 1:e0ebc6af5e04 1 /**
tosihisa 1:e0ebc6af5e04 2 * @section LICENSE
tosihisa 0:3a05c5755625 3 * Released under the MIT License: http://mbed.org/license/mit
tosihisa 1:e0ebc6af5e04 4 * Copyright (C) 2012 tosihisa
tosihisa 1:e0ebc6af5e04 5 *
tosihisa 1:e0ebc6af5e04 6 * @section DESCRIPTION
tosihisa 1:e0ebc6af5e04 7 * INA226 - Bi-Directional CURRENT/POWER MONITOR with I2C
tosihisa 1:e0ebc6af5e04 8 * http://strawberry-linux.com/catalog/items?code=12031
tosihisa 1:e0ebc6af5e04 9 *
tosihisa 0:3a05c5755625 10 */
tosihisa 0:3a05c5755625 11 #ifndef __INA226_INCLUDE // {
tosihisa 0:3a05c5755625 12 #define __INA226_INCLUDE
tosihisa 0:3a05c5755625 13 #include "mbed.h"
tosihisa 0:3a05c5755625 14 class INA226 {
tosihisa 0:3a05c5755625 15 public:
tosihisa 1:e0ebc6af5e04 16 /**
tosihisa 1:e0ebc6af5e04 17 * Constructor.
tosihisa 1:e0ebc6af5e04 18 *
tosihisa 1:e0ebc6af5e04 19 * @param i2c_ instance of I2C.
tosihisa 1:e0ebc6af5e04 20 * @param addr_ I2C slave address.
tosihisa 1:e0ebc6af5e04 21 * @param freq_ I2C frequency.
tosihisa 1:e0ebc6af5e04 22 */
tosihisa 0:3a05c5755625 23 INA226(I2C &i2c_,int addr_ = 0x80,int freq_ = 100000);
tosihisa 1:e0ebc6af5e04 24 /**
tosihisa 1:e0ebc6af5e04 25 * Check INA226 exist.
tosihisa 1:e0ebc6af5e04 26 *
tosihisa 1:e0ebc6af5e04 27 * @param none
tosihisa 1:e0ebc6af5e04 28 * @return 0:NOT EXIST / !0:EXIST
tosihisa 1:e0ebc6af5e04 29 */
tosihisa 0:3a05c5755625 30 int isExist(void);
tosihisa 1:e0ebc6af5e04 31 /**
tosihisa 1:e0ebc6af5e04 32 * INA226 raw level read.
tosihisa 1:e0ebc6af5e04 33 *
tosihisa 1:e0ebc6af5e04 34 * @param pointer_addr INA226 pointer address.
tosihisa 1:e0ebc6af5e04 35 * @param val_ read value.
tosihisa 1:e0ebc6af5e04 36 * @return 0:Read OK / !0:Read NG
tosihisa 1:e0ebc6af5e04 37 */
tosihisa 0:3a05c5755625 38 int rawRead(char pointer_addr,unsigned short *val_);
tosihisa 1:e0ebc6af5e04 39 /**
tosihisa 1:e0ebc6af5e04 40 * INA226 raw level write.
tosihisa 1:e0ebc6af5e04 41 *
tosihisa 1:e0ebc6af5e04 42 * @param pointer_addr INA226 pointer address.
tosihisa 1:e0ebc6af5e04 43 * @param val_ write value.
tosihisa 1:e0ebc6af5e04 44 * @return 0:Read OK / !0:Read NG
tosihisa 1:e0ebc6af5e04 45 */
tosihisa 0:3a05c5755625 46 int rawWrite(char pointer_addr,unsigned short val_);
tosihisa 1:e0ebc6af5e04 47 /**
tosihisa 1:e0ebc6af5e04 48 * Get voltage.
tosihisa 1:e0ebc6af5e04 49 *
tosihisa 1:e0ebc6af5e04 50 * @param V_ read value;
tosihisa 1:e0ebc6af5e04 51 * @return 0:Read OK / !0:Read NG
tosihisa 1:e0ebc6af5e04 52 */
tosihisa 0:3a05c5755625 53 int getVoltage(double *V_);
tosihisa 1:e0ebc6af5e04 54 /**
tosihisa 1:e0ebc6af5e04 55 * Get current.
tosihisa 1:e0ebc6af5e04 56 *
tosihisa 1:e0ebc6af5e04 57 * @param I_ read value;
tosihisa 1:e0ebc6af5e04 58 * @return 0:Read OK / !0:Read NG
tosihisa 1:e0ebc6af5e04 59 */
tosihisa 0:3a05c5755625 60 int getCurrent(double *I_);
tosihisa 1:e0ebc6af5e04 61 /**
tosihisa 1:e0ebc6af5e04 62 * Set current calibration.
tosihisa 1:e0ebc6af5e04 63 *
tosihisa 1:e0ebc6af5e04 64 * @param val write value;
tosihisa 1:e0ebc6af5e04 65 * @return 0:Read OK / !0:Read NG
tosihisa 1:e0ebc6af5e04 66 */
tosihisa 0:3a05c5755625 67 int setCurrentCalibration(unsigned short val = 0x0A00);
tosihisa 0:3a05c5755625 68
tosihisa 0:3a05c5755625 69 private:
tosihisa 0:3a05c5755625 70 I2C &i2c;
tosihisa 0:3a05c5755625 71 int i2c_addr;
tosihisa 0:3a05c5755625 72 int freq;
tosihisa 0:3a05c5755625 73 };
tosihisa 0:3a05c5755625 74 #endif // }