Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of INA226 by
Revision 1:e0ebc6af5e04, committed 2012-11-24
- Comitter:
- tosihisa
- Date:
- Sat Nov 24 18:29:15 2012 +0000
- Parent:
- 0:3a05c5755625
- Child:
- 2:8950b0f31d73
- Commit message:
- wrote doxygen comment.;
Changed in this revision
| INA226.cpp | Show annotated file Show diff for this revision Revisions of this file |
| INA226.hpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/INA226.cpp Sat Nov 24 18:15:16 2012 +0000 +++ b/INA226.cpp Sat Nov 24 18:29:15 2012 +0000 @@ -1,8 +1,13 @@ -/* - * Copyright (c) 2011 Toshihisa T +/** + * @section LICENSE * Released under the MIT License: http://mbed.org/license/mit + * Copyright (C) 2012 tosihisa + * + * @section DESCRIPTION + * INA226 - Bi-Directional CURRENT/POWER MONITOR with I2C + * http://strawberry-linux.com/catalog/items?code=12031 + * */ - #include "mbed.h" #include "INA226.hpp"
--- a/INA226.hpp Sat Nov 24 18:15:16 2012 +0000
+++ b/INA226.hpp Sat Nov 24 18:29:15 2012 +0000
@@ -1,18 +1,69 @@
-/*
- * Copyright (c) 2011 Toshihisa T
+/**
+ * @section LICENSE
* Released under the MIT License: http://mbed.org/license/mit
+ * Copyright (C) 2012 tosihisa
+ *
+ * @section DESCRIPTION
+ * INA226 - Bi-Directional CURRENT/POWER MONITOR with I2C
+ * http://strawberry-linux.com/catalog/items?code=12031
+ *
*/
#ifndef __INA226_INCLUDE // {
#define __INA226_INCLUDE
#include "mbed.h"
class INA226 {
public:
+ /**
+ * Constructor.
+ *
+ * @param i2c_ instance of I2C.
+ * @param addr_ I2C slave address.
+ * @param freq_ I2C frequency.
+ */
INA226(I2C &i2c_,int addr_ = 0x80,int freq_ = 100000);
+ /**
+ * Check INA226 exist.
+ *
+ * @param none
+ * @return 0:NOT EXIST / !0:EXIST
+ */
int isExist(void);
+ /**
+ * INA226 raw level read.
+ *
+ * @param pointer_addr INA226 pointer address.
+ * @param val_ read value.
+ * @return 0:Read OK / !0:Read NG
+ */
int rawRead(char pointer_addr,unsigned short *val_);
+ /**
+ * INA226 raw level write.
+ *
+ * @param pointer_addr INA226 pointer address.
+ * @param val_ write value.
+ * @return 0:Read OK / !0:Read NG
+ */
int rawWrite(char pointer_addr,unsigned short val_);
+ /**
+ * Get voltage.
+ *
+ * @param V_ read value;
+ * @return 0:Read OK / !0:Read NG
+ */
int getVoltage(double *V_);
+ /**
+ * Get current.
+ *
+ * @param I_ read value;
+ * @return 0:Read OK / !0:Read NG
+ */
int getCurrent(double *I_);
+ /**
+ * Set current calibration.
+ *
+ * @param val write value;
+ * @return 0:Read OK / !0:Read NG
+ */
int setCurrentCalibration(unsigned short val = 0x0A00);
private:
