This repository has been archived by the owner on Jun 22, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed unnecessary parameters, reduced call to bare minimum
- Loading branch information
Arnd
authored and
Arnd
committed
Jan 10, 2017
1 parent
f29d5eb
commit e92c042
Showing
9 changed files
with
401 additions
and
408 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
370 changes: 183 additions & 187 deletions
370
Examples/DisplayReadings/Debug/DisplayReadings.ino.hex
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
** 1.0.0 2017-01-09 [email protected] Cloned example from test program suite ** | ||
** ** | ||
*******************************************************************************************************************/ | ||
#include <INA.h> // INA Library // | ||
#include <INA226.h> // INA226 Library // | ||
/******************************************************************************************************************* | ||
** Declare program Constants ** | ||
*******************************************************************************************************************/ | ||
|
@@ -53,10 +53,8 @@ void setup() { // | |
Serial.begin(SERIAL_SPEED); // Start serial communications // | ||
delay(2000); // Wait for comms port to connect // | ||
Serial.print(F("\n\nDisplay INA226 Readings V1.0.0\n")); // Display program information // | ||
INA226.begin( 6, // Volts maximum expected on bus // | ||
1, // ± Amps maximum expected on bus // | ||
100, // ± Shunt millivolts maximum // | ||
100000); // Shunt resistance in microOhm(µ?),// | ||
INA226.begin( 1, // ± Amps maximum expected on bus // | ||
100000); // Shunt resistance in nanoOhm(µ?),// | ||
// "100000" equates to 0.1 Ohm // | ||
INA226.setAveraging(4); // Average each reading n-times // | ||
INA226.setBusConversion(); // Maximum conversion time 8.244ms // | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
** ** | ||
** Vers. Date Developer Comments ** | ||
** ====== ========== =================== ======================================================================== ** | ||
** 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 ** | ||
** 1.0.b1 2017-01-05 [email protected] Created class ** | ||
|
@@ -44,14 +45,14 @@ | |
/***************************************************************************************************************** | ||
** Declare constants used in the class ** | ||
*****************************************************************************************************************/ | ||
const uint8_t I2C_DELAY = 10; // Microsecond delay on write // | ||
const uint8_t INA_CONFIGURATION_REGISTER = 0; // Registers common to all INAs // | ||
const uint8_t INA_SHUNT_VOLTAGE_REGISTER = 1; // // | ||
const uint8_t INA_BUS_VOLTAGE_REGISTER = 2; // // | ||
const uint8_t INA_POWER_REGISTER = 3; // // | ||
const uint8_t INA_CURRENT_REGISTER = 4; // // | ||
const uint8_t INA_CALIBRATION_REGISTER = 5; // // | ||
const uint8_t INA_MASK_ENABLE_REGISTER = 6; // // | ||
const uint8_t I2C_DELAY = 10; // Microsecond delay on write // | ||
const uint8_t INA_CONFIGURATION_REGISTER = 0; // Registers common to all INAs // | ||
const uint8_t INA_SHUNT_VOLTAGE_REGISTER = 1; // // | ||
const uint8_t INA_BUS_VOLTAGE_REGISTER = 2; // // | ||
const uint8_t INA_POWER_REGISTER = 3; // // | ||
const uint8_t INA_CURRENT_REGISTER = 4; // // | ||
const uint8_t INA_CALIBRATION_REGISTER = 5; // // | ||
const uint8_t INA_MASK_ENABLE_REGISTER = 6; // // | ||
const uint16_t INA_RESET_DEVICE = 0x8000; // Write to configuration to reset // | ||
const uint16_t INA_DEFAULT_CONFIGURATION = 0x4127; // Default configuration register // | ||
const uint16_t INA_BUS_VOLTAGE_LSB = 125; // LSB in uV *100 1.25mV // | ||
|
@@ -61,6 +62,13 @@ | |
const uint16_t INA_CONFIG_SHUNT_TIME_MASK = 0x0038; // Bits 3-5 // | ||
const uint16_t INA_CONVERSION_READY_MASK = 0x0080; // Bit 4 // | ||
const uint16_t INA_CONFIG_MODE_MASK = 0x0007; // Bits 0-3 // | ||
const uint8_t INA_MODE_TRIGGERED_SHUNT = B001; // Triggered shunt, no bus // | ||
const uint8_t INA_MODE_TRIGGERED_BUS = B010; // Triggered bus, no shunt // | ||
const uint8_t INA_MODE_TRIGGERED_BOTH = B011; // Triggered bus and shunt // | ||
const uint8_t INA_MODE_POWER_DOWN = B100; // shutdown or power-down // | ||
const uint8_t INA_MODE_CONTINUOUS_SHUNT = B101; // Continuous shunt, no bus // | ||
const uint8_t INA_MODE_CONTINUOUS_BUS = B110; // Continuous bus, no shunt // | ||
const uint8_t INA_MODE_CONTINUOUS_BOTH = B111; // Both continuous, default value // | ||
|
||
/***************************************************************************************************************** | ||
** Declare class header ** | ||
|
@@ -69,12 +77,9 @@ | |
public: // Publicly visible methods // | ||
INA226_Class(); // Class constructor // | ||
~INA226_Class(); // Class destructor // | ||
void begin(uint8_t maxBusVolts = 30, // Initialize class // | ||
uint8_t maxBusAmps = 200, // register settings for setup and // | ||
uint16_t maxShuntmV = 50, // calibration // | ||
uint32_t microOhmR = UINT32_MAX ); // // | ||
void begin(const uint8_t maxBusAmps, const uint32_t nanoOhmR); // Class initializer // | ||
uint16_t getBusMilliVolts(); // Retrieve Bus voltage in mV // | ||
int32_t getShuntMicroVolts(); // Retrieve Shunt voltage in uV // | ||
int16_t getShuntMicroVolts(); // Retrieve Shunt voltage in uV // | ||
int32_t getBusMicroAmps(); // Retrieve microamps // | ||
int32_t getBusMicroWatts(); // Retrieve microwatts // | ||
void reset(); // Reset the device // | ||
|