Adafruit INA260 Arduino Library
Public Member Functions | Public Attributes | List of all members
Adafruit_INA260 Class Reference

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.
 

Detailed Description

Class that stores state and functions for interacting with INA260 Current and Power Sensor.

Member Function Documentation

◆ begin()

bool Adafruit_INA260::begin ( uint8_t  i2c_address = INA260_I2CADDR_DEFAULT,
TwoWire *  theWire = &Wire 
)

Sets up the HW.

Parameters
i2c_addressThe I2C address to be used.
theWireThe Wire object to be used for I2C connections.
Returns
True if initialization was successful, otherwise false.

◆ readCurrent()

float Adafruit_INA260::readCurrent ( void  )

Reads and scales the current value of the Current register.

Returns
The current current measurement in mA

◆ readBusVoltage()

float Adafruit_INA260::readBusVoltage ( void  )

Reads and scales the current value of the Bus Voltage register.

Returns
The current bus voltage measurement in mV

◆ readPower()

float Adafruit_INA260::readPower ( void  )

Reads and scales the current value of the Power register.

Returns
The current Power calculation in mW

◆ setMode()

void Adafruit_INA260::setMode ( INA260_MeasurementMode  new_mode)

Sets a new measurement mode.

Parameters
new_modeThe new mode to be set

◆ getMode()

INA260_MeasurementMode Adafruit_INA260::getMode ( void  )

Returns the current measurement mode.

Returns
The current mode

◆ conversionReady()

bool Adafruit_INA260::conversionReady ( void  )

Checks if the most recent one shot measurement has completed.

Returns
true if the conversion has completed

◆ alertFunctionFlag()

bool Adafruit_INA260::alertFunctionFlag ( void  )

Checks if the Alert Flag is set.

Returns
true if the flag is set

◆ getAlertLimit()

float Adafruit_INA260::getAlertLimit ( void  )

Reads the current alert limit setting.

Returns
The current bus alert limit setting

◆ setAlertLimit()

void Adafruit_INA260::setAlertLimit ( float  limit)

Sets the Alert Limit.

Parameters
limitThe new limit that triggers the alert

◆ getAlertLatch()

INA260_AlertLatch Adafruit_INA260::getAlertLatch ( void  )

Reads the current alert latch setting.

Returns
The current bus alert latch setting

◆ setAlertLatch()

void Adafruit_INA260::setAlertLatch ( INA260_AlertLatch  state)

Sets Alert Latch Bit.

Parameters
stateThe parameter which asserts the ALERT pin

◆ getAlertPolarity()

INA260_AlertPolarity Adafruit_INA260::getAlertPolarity ( void  )

Reads the current alert polarity setting.

Returns
The current bus alert polarity setting

◆ setAlertPolarity()

void Adafruit_INA260::setAlertPolarity ( INA260_AlertPolarity  polarity)

Sets Alert Polarity Bit.

Parameters
polarityThe polarity of the alert pin

◆ getAlertType()

INA260_AlertType Adafruit_INA260::getAlertType ( void  )

Reads the current parameter that asserts the ALERT pin.

Returns
The current parameter that asserts the ALERT PIN

◆ setAlertType()

void Adafruit_INA260::setAlertType ( INA260_AlertType  alert)

Sets which parameter asserts the ALERT pin.

Parameters
alertThe parameter which asserts the ALERT pin

◆ getCurrentConversionTime()

INA260_ConversionTime Adafruit_INA260::getCurrentConversionTime ( void  )

Reads the current current conversion time.

Returns
The current current conversion time

◆ setCurrentConversionTime()

void Adafruit_INA260::setCurrentConversionTime ( INA260_ConversionTime  time)

Sets the current conversion time.

Parameters
timeThe new current conversion time

◆ getVoltageConversionTime()

INA260_ConversionTime Adafruit_INA260::getVoltageConversionTime ( void  )

Reads the current bus voltage conversion time.

Returns
The current bus voltage conversion time

◆ setVoltageConversionTime()

void Adafruit_INA260::setVoltageConversionTime ( INA260_ConversionTime  time)

Sets the bus voltage conversion time.

Parameters
timeThe new bus voltage conversion time

◆ getAveragingCount()

INA260_AveragingCount Adafruit_INA260::getAveragingCount ( void  )

Reads the current number of averaging samples.

Returns
The current number of averaging samples

◆ setAveragingCount()

void Adafruit_INA260::setAveragingCount ( INA260_AveragingCount  count)

Sets the number of averaging samples.

Parameters
countThe number of samples to be averaged

The documentation for this class was generated from the following files: