Skip to content
This repository has been archived by the owner on Jun 22, 2018. It is now read-only.

Commit

Permalink
Changed variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnd authored and Arnd committed Apr 26, 2017
1 parent 43d7d0a commit c4a1c51
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions INA226.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ INA226_Class::~INA226_Class() {} // of unused class destructor //
/*******************************************************************************************************************
** Method begin() does all of the initialization work **
*******************************************************************************************************************/
void INA226_Class::begin(const uint8_t maxBusAmps, const uint32_t milliOhmR) {// Class initializer //
void INA226_Class::begin(const uint8_t maxBusAmps, const uint32_t nanoOhmR) { // Class initializer //
Wire.begin(); // Start the I2C wire subsystem //
for(_DeviceAddress = 1;_DeviceAddress<127;_DeviceAddress++) { // Loop for each possible address //
Wire.beginTransmission(_DeviceAddress); // See if something is at address //
Expand All @@ -33,7 +33,7 @@ void INA226_Class::begin(const uint8_t maxBusAmps, const uint32_t milliOhmR) {//
delay(10); // Wait for INA to finish resetting //
if (readWord(INA_CONFIGURATION_REGISTER)==INA_DEFAULT_CONFIGURATION) { // Yes, we've found an INA226! //
_Current_LSB = (uint32_t)maxBusAmps*1000000000/32767; // Get the best possible LSB //
_Calibration = 51200000/((int64_t)_Current_LSB*milliOhmR/100000); // Compute calibration register //
_Calibration = 51200000/((int64_t)_Current_LSB*nanoOhmR/100000); // Compute calibration register //
_Power_LSB = (uint32_t)25*_Current_LSB; // Fixed multiplier for INA219 //
writeWord(INA_CALIBRATION_REGISTER,_Calibration); // Write the calibration value //
break; // Stop searching //
Expand Down
5 changes: 2 additions & 3 deletions INA226.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
** **
** Vers. Date Developer Comments **
** ====== ========== =================== ======================================================================== **
** 1.0.1 2017-05-26 [email protected] Changed _CurrentLSB from uint16_t to uint32_t due to overflow bug, **
** corrected begin() parameter name from nanoOhm to milliOhm **
** 1.0.1 2017-05-26 [email protected] Changed _CurrentLSB from uint16_t to uint32_t due to overflow bug **
** 1.0.0 2017-01-10 [email protected] Fixed library file name, added constants for setMode() call **
** 1.0.0 2017-01-09 [email protected] Added reset() and setMode() calls **
** 1.0.b2 2017-01-08 [email protected] Removed INA219 code, concentrating on only the INA226 **
Expand Down Expand Up @@ -79,7 +78,7 @@
public: // Publicly visible methods //
INA226_Class(); // Class constructor //
~INA226_Class(); // Class destructor //
void begin(const uint8_t maxBusAmps, const uint32_t milliOhmR); // Class initializer //
void begin(const uint8_t maxBusAmps, const uint32_t nanoOhmR); // Class initializer //
uint16_t getBusMilliVolts(const bool waitSwitch=false); // Retrieve Bus voltage in mV //
int16_t getShuntMicroVolts(const bool waitSwitch=false); // Retrieve Shunt voltage in uV //
int32_t getBusMicroAmps(); // Retrieve microamps //
Expand Down

0 comments on commit c4a1c51

Please sign in to comment.