11#pragma once
22// FILE: INA226.h
33// AUTHOR: Rob Tillaart
4- // VERSION: 0.4.1
4+ // VERSION: 0.4.2
55// DATE: 2021-05-18
66// PURPOSE: Arduino library for INA226 power sensor
77// URL: https://github.com/RobTillaart/INA226
1414#include " Wire.h"
1515
1616
17- #define INA226_LIB_VERSION (F(" 0.4.1 " ))
17+ #define INA226_LIB_VERSION (F(" 0.4.2 " ))
1818
1919
2020// set by setAlertRegister
@@ -55,17 +55,19 @@ class INA226
5555
5656
5757 // Core functions
58- float getBusVoltage ();
59- float getShuntVoltage ();
60- float getCurrent ();
61- float getPower ();
58+ float getBusVoltage (); // Volt
59+ float getShuntVoltage (); // Volt
60+ float getCurrent (); // Ampere
61+ float getPower (); // Watt
6262
6363
64- // Scale helpers
64+ // Scale helpers milli range
6565 float getBusVoltage_mV () { return getBusVoltage () * 1e3 ; };
6666 float getShuntVoltage_mV () { return getShuntVoltage () * 1e3 ; };
6767 float getCurrent_mA () { return getCurrent () * 1e3 ; };
6868 float getPower_mW () { return getPower () * 1e3 ; };
69+ // Scale helpers micro range
70+ float getBusVoltage_uV () { return getBusVoltage () * 1e6 ; };
6971 float getShuntVoltage_uV () { return getShuntVoltage () * 1e6 ; };
7072 float getCurrent_uA () { return getCurrent () * 1e6 ; };
7173 float getPower_uW () { return getPower () * 1e6 ; };
@@ -86,7 +88,7 @@ class INA226
8688 // shunt * maxCurrent < 81 mV
8789 // maxCurrent >= 0.001
8890 // shunt >= 0.001
89- int setMaxCurrentShunt (float macCurrent = 20.0 ,
91+ int setMaxCurrentShunt (float macCurrent = 20.0 ,
9092 float shunt = 0.002 ,
9193 bool normalize = true );
9294 bool isCalibrated () { return _current_LSB != 0.0 ; };
@@ -108,7 +110,7 @@ class INA226
108110 bool setModeShuntBusTrigger () { return setMode (3 ); };
109111 bool setModeShuntContinuous () { return setMode (5 ); };
110112 bool setModeBusContinuous () { return setMode (6 ); };
111- bool setModeShuntBusContinuous () { return setMode (7 ); }; // default.
113+ bool setModeShuntBusContinuous () { return setMode (7 ); }; // default.
112114
113115
114116 // Alert
@@ -124,8 +126,8 @@ class INA226
124126
125127
126128 // Meta information
127- uint16_t getManufacturerID (); // should return 0x5449
128- uint16_t getDieID (); // should return 0x2260
129+ uint16_t getManufacturerID (); // should return 0x5449
130+ uint16_t getDieID (); // should return 0x2260
129131
130132
131133 // DEBUG
@@ -146,5 +148,5 @@ class INA226
146148};
147149
148150
149- // -- END OF FILE --
151+ // -- END OF FILE --
150152
0 commit comments