Adafruit INA260 Arduino Library
|
Class that stores state and functions for interacting with INA260 Current and Power Sensor. More...
#include <Adafruit_INA260.h>
Public Member Functions | |
Adafruit_INA260 () | |
Instantiates a new INA260 class. | |
bool | begin (uint8_t i2c_addr=INA260_I2CADDR_DEFAULT, TwoWire *theWire=&Wire) |
Sets up the HW. More... | |
void | reset (void) |
Resets the harware. All registers are set to default values, the same as a power-on reset. | |
float | readCurrent (void) |
Reads and scales the current value of the Current register. More... | |
float | readBusVoltage (void) |
Reads and scales the current value of the Bus Voltage register. More... | |
float | readPower (void) |
Reads and scales the current value of the Power register. More... | |
void | setMode (INA260_MeasurementMode mode) |
Sets a new measurement mode. More... | |
INA260_MeasurementMode | getMode (void) |
Returns the current measurement mode. More... | |
bool | conversionReady (void) |
Checks if the most recent one shot measurement has completed. More... | |
bool | alertFunctionFlag (void) |
Checks if the Alert Flag is set. More... | |
float | getAlertLimit (void) |
Reads the current alert limit setting. More... | |
void | setAlertLimit (float limit) |
Sets the Alert Limit. More... | |
INA260_AlertLatch | getAlertLatch (void) |
Reads the current alert latch setting. More... | |
void | setAlertLatch (INA260_AlertLatch state) |
Sets Alert Latch Bit. More... | |
INA260_AlertPolarity | getAlertPolarity (void) |
Reads the current alert polarity setting. More... | |
void | setAlertPolarity (INA260_AlertPolarity polarity) |
Sets Alert Polarity Bit. More... | |
INA260_AlertType | getAlertType (void) |
Reads the current parameter that asserts the ALERT pin. More... | |
void | setAlertType (INA260_AlertType alert) |
Sets which parameter asserts the ALERT pin. More... | |
INA260_ConversionTime | getCurrentConversionTime (void) |
Reads the current current conversion time. More... | |
void | setCurrentConversionTime (INA260_ConversionTime time) |
Sets the current conversion time. More... | |
INA260_ConversionTime | getVoltageConversionTime (void) |
Reads the current bus voltage conversion time. More... | |
void | setVoltageConversionTime (INA260_ConversionTime time) |
Sets the bus voltage conversion time. More... | |
INA260_AveragingCount | getAveragingCount (void) |
Reads the current number of averaging samples. More... | |
void | setAveragingCount (INA260_AveragingCount count) |
Sets the number of averaging samples. More... | |
Public Attributes | |
Adafruit_I2CRegister * | Config |
BusIO Register for Config. | |
Adafruit_I2CRegister * | MaskEnable |
BusIO Register for MaskEnable. | |
Adafruit_I2CRegister * | AlertLimit |
BusIO Register for AlertLimit. | |
Class that stores state and functions for interacting with INA260 Current and Power Sensor.
bool Adafruit_INA260::begin | ( | uint8_t | i2c_address = INA260_I2CADDR_DEFAULT , |
TwoWire * | theWire = &Wire |
||
) |
Sets up the HW.
i2c_address | The I2C address to be used. |
theWire | The Wire object to be used for I2C connections. |
float Adafruit_INA260::readCurrent | ( | void | ) |
Reads and scales the current value of the Current register.
float Adafruit_INA260::readBusVoltage | ( | void | ) |
Reads and scales the current value of the Bus Voltage register.
float Adafruit_INA260::readPower | ( | void | ) |
Reads and scales the current value of the Power register.
void Adafruit_INA260::setMode | ( | INA260_MeasurementMode | new_mode | ) |
Sets a new measurement mode.
new_mode | The new mode to be set |
INA260_MeasurementMode Adafruit_INA260::getMode | ( | void | ) |
Returns the current measurement mode.
bool Adafruit_INA260::conversionReady | ( | void | ) |
Checks if the most recent one shot measurement has completed.
bool Adafruit_INA260::alertFunctionFlag | ( | void | ) |
Checks if the Alert Flag is set.
float Adafruit_INA260::getAlertLimit | ( | void | ) |
Reads the current alert limit setting.
void Adafruit_INA260::setAlertLimit | ( | float | limit | ) |
Sets the Alert Limit.
limit | The new limit that triggers the alert |
INA260_AlertLatch Adafruit_INA260::getAlertLatch | ( | void | ) |
Reads the current alert latch setting.
void Adafruit_INA260::setAlertLatch | ( | INA260_AlertLatch | state | ) |
Sets Alert Latch Bit.
state | The parameter which asserts the ALERT pin |
INA260_AlertPolarity Adafruit_INA260::getAlertPolarity | ( | void | ) |
Reads the current alert polarity setting.
void Adafruit_INA260::setAlertPolarity | ( | INA260_AlertPolarity | polarity | ) |
Sets Alert Polarity Bit.
polarity | The polarity of the alert pin |
INA260_AlertType Adafruit_INA260::getAlertType | ( | void | ) |
Reads the current parameter that asserts the ALERT pin.
void Adafruit_INA260::setAlertType | ( | INA260_AlertType | alert | ) |
Sets which parameter asserts the ALERT pin.
alert | The parameter which asserts the ALERT pin |
INA260_ConversionTime Adafruit_INA260::getCurrentConversionTime | ( | void | ) |
Reads the current current conversion time.
void Adafruit_INA260::setCurrentConversionTime | ( | INA260_ConversionTime | time | ) |
Sets the current conversion time.
time | The new current conversion time |
INA260_ConversionTime Adafruit_INA260::getVoltageConversionTime | ( | void | ) |
Reads the current bus voltage conversion time.
void Adafruit_INA260::setVoltageConversionTime | ( | INA260_ConversionTime | time | ) |
Sets the bus voltage conversion time.
time | The new bus voltage conversion time |
INA260_AveragingCount Adafruit_INA260::getAveragingCount | ( | void | ) |
Reads the current number of averaging samples.
void Adafruit_INA260::setAveragingCount | ( | INA260_AveragingCount | count | ) |
Sets the number of averaging samples.
count | The number of samples to be averaged |