Class that stores state and functions for interacting with INA237/INA238 Current and Power Sensors.
More...
#include <Adafruit_INA237.h>
|
void | _updateShuntCalRegister (void) override |
| Updates the shunt calibration value to the INA237 register. The INA237 uses a different calculation than the INA228.
|
|
Class that stores state and functions for interacting with INA237/INA238 Current and Power Sensors.
◆ begin()
bool Adafruit_INA237::begin |
( |
uint8_t |
i2c_address = INA237_I2CADDR_DEFAULT , |
|
|
TwoWire * |
theWire = &Wire , |
|
|
bool |
skipReset = false |
|
) |
| |
Sets up the HW.
- Parameters
-
i2c_address | The I2C address to be used. |
theWire | The Wire object to be used for I2C connections. |
skipReset | When set to true, will omit resetting all INA237 registers to their default values. Default: false. |
- Returns
- True if initialization was successful, otherwise false.
◆ getAlertType()
Returns the current alert type.
- Returns
- The current alert type
◆ setAlertType()
Sets a new alert type.
- Parameters
-
alert | The new alert type to be set |
◆ readDieTemp()
float Adafruit_INA237::readDieTemp |
( |
void |
| ) |
|
|
override |
Reads the die temperature with the INA237-specific conversion factor.
- Returns
- The current die temp in deg C
◆ readBusVoltage()
float Adafruit_INA237::readBusVoltage |
( |
void |
| ) |
|
|
override |
Reads and scales the current value of the Bus Voltage register using INA237-specific conversion factor.
- Returns
- The current bus voltage measurement in V
◆ readShuntVoltage()
float Adafruit_INA237::readShuntVoltage |
( |
void |
| ) |
|
|
override |
Reads and scales the current value of the Shunt Voltage register using INA237-specific conversion factor.
- Returns
- The current shunt voltage measurement in V
◆ readCurrent()
float Adafruit_INA237::readCurrent |
( |
void |
| ) |
|
|
override |
Reads and scales the current value of the Current register using INA237-specific handling.
- Returns
- The current measurement in mA
◆ readPower()
float Adafruit_INA237::readPower |
( |
void |
| ) |
|
|
override |
Reads and scales the current value of the Power register using INA237-specific handling.
- Returns
- The current Power calculation in mW
◆ setShunt()
void Adafruit_INA237::setShunt |
( |
float |
shunt_res = 0.1 , |
|
|
float |
max_current = 3.2 |
|
) |
| |
|
override |
Sets the shunt calibration by resistor for INA237.
- Parameters
-
shunt_res | Resistance of the shunt in ohms (floating point) |
max_current | Maximum expected current in A (floating point) |
The documentation for this class was generated from the following files: