Class that stores state and functions for interacting with INA219 current/power monitor IC.
More...
#include <Adafruit_INA219.h>
|
| Adafruit_INA219 (uint8_t addr=INA219_ADDRESS) |
| Instantiates a new INA219 class. More...
|
|
| ~Adafruit_INA219 () |
| INA219 class destructor.
|
|
bool | begin (TwoWire *theWire=&Wire) |
| Sets up the HW (defaults to 32V and 2A for calibration values) More...
|
|
void | setCalibration_32V_2A () |
| Configures to INA219 to be able to measure up to 32V and 2A of current. Each unit of current corresponds to 100uA, and each unit of power corresponds to 2mW. Counter overflow occurs at 3.2A. More...
|
|
void | setCalibration_32V_1A () |
| Configures to INA219 to be able to measure up to 32V and 1A of current. Each unit of current corresponds to 40uA, and each unit of power corresponds to 800uW. Counter overflow occurs at 1.3A. More...
|
|
void | setCalibration_16V_400mA () |
| set device to alibration which uses the highest precision for current measurement (0.1mA), at the expense of only supporting 16V at 400mA max.
|
|
float | getBusVoltage_V () |
| Gets the bus voltage in volts. More...
|
|
float | getShuntVoltage_mV () |
| Gets the shunt voltage in mV (so +-327mV) More...
|
|
float | getCurrent_mA () |
| Gets the current value in mA, taking into account the config settings and current LSB. More...
|
|
float | getPower_mW () |
| Gets the power value in mW, taking into account the config settings and current LSB. More...
|
|
void | powerSave (bool on) |
| Set power save mode according to parameters. More...
|
|
bool | success () |
| Provides the the underlying return value from the last operation called on the device. More...
|
|
Class that stores state and functions for interacting with INA219 current/power monitor IC.
◆ Adafruit_INA219()
Instantiates a new INA219 class.
- Parameters
-
addr | the I2C address the device can be found on. Default is 0x40 |
◆ begin()
bool Adafruit_INA219::begin |
( |
TwoWire * |
theWire = &Wire | ) |
|
Sets up the HW (defaults to 32V and 2A for calibration values)
- Parameters
-
theWire | the TwoWire object to use |
- Returns
- true: success false: Failed to start I2C
◆ setCalibration_32V_2A()
void Adafruit_INA219::setCalibration_32V_2A |
( |
| ) |
|
Configures to INA219 to be able to measure up to 32V and 2A of current. Each unit of current corresponds to 100uA, and each unit of power corresponds to 2mW. Counter overflow occurs at 3.2A.
- Note
- These calculations assume a 0.1 ohm resistor is present
◆ setCalibration_32V_1A()
void Adafruit_INA219::setCalibration_32V_1A |
( |
| ) |
|
Configures to INA219 to be able to measure up to 32V and 1A of current. Each unit of current corresponds to 40uA, and each unit of power corresponds to 800uW. Counter overflow occurs at 1.3A.
- Note
- These calculations assume a 0.1 ohm resistor is present
◆ getBusVoltage_V()
float Adafruit_INA219::getBusVoltage_V |
( |
| ) |
|
Gets the bus voltage in volts.
- Returns
- the bus voltage converted to volts
◆ getShuntVoltage_mV()
float Adafruit_INA219::getShuntVoltage_mV |
( |
| ) |
|
Gets the shunt voltage in mV (so +-327mV)
- Returns
- the shunt voltage converted to millivolts
◆ getCurrent_mA()
float Adafruit_INA219::getCurrent_mA |
( |
| ) |
|
Gets the current value in mA, taking into account the config settings and current LSB.
- Returns
- the current reading convereted to milliamps
◆ getPower_mW()
float Adafruit_INA219::getPower_mW |
( |
| ) |
|
Gets the power value in mW, taking into account the config settings and current LSB.
- Returns
- power reading converted to milliwatts
◆ powerSave()
void Adafruit_INA219::powerSave |
( |
bool |
on | ) |
|
Set power save mode according to parameters.
- Parameters
-
◆ success()
bool Adafruit_INA219::success |
( |
| ) |
|
Provides the the underlying return value from the last operation called on the device.
- Returns
- true: Last operation was successful false: Last operation failed
- Note
- For function calls that have intermediary device operations, e.g. calibration before read/write, only the final operation's result is stored.
The documentation for this class was generated from the following files: