a
INA226.hpp@0:3a05c5755625, 2012-11-24 (annotated)
- Committer:
- tosihisa
- Date:
- Sat Nov 24 18:15:16 2012 +0000
- Revision:
- 0:3a05c5755625
- Child:
- 1:e0ebc6af5e04
1st
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tosihisa | 0:3a05c5755625 | 1 | /* |
tosihisa | 0:3a05c5755625 | 2 | * Copyright (c) 2011 Toshihisa T |
tosihisa | 0:3a05c5755625 | 3 | * Released under the MIT License: http://mbed.org/license/mit |
tosihisa | 0:3a05c5755625 | 4 | */ |
tosihisa | 0:3a05c5755625 | 5 | #ifndef __INA226_INCLUDE // { |
tosihisa | 0:3a05c5755625 | 6 | #define __INA226_INCLUDE |
tosihisa | 0:3a05c5755625 | 7 | #include "mbed.h" |
tosihisa | 0:3a05c5755625 | 8 | class INA226 { |
tosihisa | 0:3a05c5755625 | 9 | public: |
tosihisa | 0:3a05c5755625 | 10 | INA226(I2C &i2c_,int addr_ = 0x80,int freq_ = 100000); |
tosihisa | 0:3a05c5755625 | 11 | int isExist(void); |
tosihisa | 0:3a05c5755625 | 12 | int rawRead(char pointer_addr,unsigned short *val_); |
tosihisa | 0:3a05c5755625 | 13 | int rawWrite(char pointer_addr,unsigned short val_); |
tosihisa | 0:3a05c5755625 | 14 | int getVoltage(double *V_); |
tosihisa | 0:3a05c5755625 | 15 | int getCurrent(double *I_); |
tosihisa | 0:3a05c5755625 | 16 | int setCurrentCalibration(unsigned short val = 0x0A00); |
tosihisa | 0:3a05c5755625 | 17 | |
tosihisa | 0:3a05c5755625 | 18 | private: |
tosihisa | 0:3a05c5755625 | 19 | I2C &i2c; |
tosihisa | 0:3a05c5755625 | 20 | int i2c_addr; |
tosihisa | 0:3a05c5755625 | 21 | int freq; |
tosihisa | 0:3a05c5755625 | 22 | }; |
tosihisa | 0:3a05c5755625 | 23 | #endif // } |