Adafruit INA260 Arduino Library
Classes | Macros | Typedefs | Enumerations
Adafruit_INA260.h File Reference
#include "Arduino.h"
#include <Adafruit_I2CDevice.h>
#include <Adafruit_I2CRegister.h>
#include <Wire.h>

Go to the source code of this file.

Classes

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

Macros

#define INA260_I2CADDR_DEFAULT   0x40
 INA260 default i2c address.
 
#define INA260_REG_CONFIG   0x00
 Configuration register.
 
#define INA260_REG_CURRENT   0x01
 Current measurement register (signed) in mA.
 
#define INA260_REG_BUSVOLTAGE   0x02
 Bus voltage measurement register in mV.
 
#define INA260_REG_POWER   0x03
 Power calculation register in mW.
 
#define INA260_REG_MASK_ENABLE   0x06
 Interrupt/Alert setting and checking register.
 
#define INA260_REG_ALERT_LIMIT   0x07
 Alert limit value register.
 
#define INA260_REG_MFG_UID   0xFE
 Manufacturer ID Register.
 
#define INA260_REG_DIE_UID   0xFF
 Die ID and Revision Register.
 

Typedefs

typedef enum _mode INA260_MeasurementMode
 Mode options. More...
 
typedef enum _conversion_time INA260_ConversionTime
 Conversion Time options. More...
 
typedef enum _count INA260_AveragingCount
 Averaging Count options. More...
 
typedef enum _alert_type INA260_AlertType
 Alert trigger options. More...
 
typedef enum _alert_polarity INA260_AlertPolarity
 Alert pin polarity options. More...
 
typedef enum _alert_latch INA260_AlertLatch
 Alert pin latch options. More...
 

Enumerations

enum  _mode { INA260_MODE_SHUTDOWN = 0x00, INA260_MODE_TRIGGERED = 0x03, INA260_MODE_CONTINUOUS = 0x07 }
 Mode options. More...
 
enum  _conversion_time {
  INA260_TIME_140_us, INA260_TIME_204_us, INA260_TIME_332_us, INA260_TIME_558_us,
  INA260_TIME_1_1_ms, INA260_TIME_2_116_ms, INA260_TIME_4_156_ms, INA260_TIME_8_244_ms
}
 Conversion Time options. More...
 
enum  _count {
  INA260_COUNT_1, INA260_COUNT_4, INA260_COUNT_16, INA260_COUNT_64,
  INA260_COUNT_128, INA260_COUNT_256, INA260_COUNT_512, INA260_COUNT_1024
}
 Averaging Count options. More...
 
enum  _alert_type {
  INA260_ALERT_CONVERSION_READY = 0x1, INA260_ALERT_OVERPOWER = 0x2, INA260_ALERT_UNDERVOLTAGE = 0x4, INA260_ALERT_OVERVOLTAGE = 0x8,
  INA260_ALERT_UNDERCURRENT = 0x10, INA260_ALERT_OVERCURRENT = 0x20, INA260_ALERT_NONE = 0x0
}
 Alert trigger options. More...
 
enum  _alert_polarity { INA260_ALERT_POLARITY_NORMAL = 0x0, INA260_ALERT_POLARITY_INVERTED = 0x1 }
 Alert pin polarity options. More...
 
enum  _alert_latch { INA260_ALERT_LATCH_ENABLED = 0x1, INA260_ALERT_LATCH_TRANSPARENT = 0x0 }
 Alert pin latch options. More...
 

Detailed Description

I2C Driver for INA260 Current and Power sensor

This is a library for the Adafruit INA260 breakout: http://www.adafruit.com/products/4226

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

BSD license (see license.txt)

Typedef Documentation

◆ INA260_MeasurementMode

Mode options.

Allowed values for setMode.

◆ INA260_ConversionTime

Conversion Time options.

Allowed values for setCurrentConversionTime and setVoltageConversionTime.

◆ INA260_AveragingCount

Averaging Count options.

Allowed values forsetAveragingCount.

◆ INA260_AlertType

Alert trigger options.

Allowed values for setAlertType.

◆ INA260_AlertPolarity

Alert pin polarity options.

Allowed values for setAlertPolarity.

◆ INA260_AlertLatch

Alert pin latch options.

Allowed values for setAlertLatch.

Enumeration Type Documentation

◆ _mode

enum _mode

Mode options.

Allowed values for setMode.

Enumerator
INA260_MODE_SHUTDOWN 

SHUTDOWN: Minimize quiescient current and turn off current into the device inputs. Set another mode to exit shutown mode

INA260_MODE_TRIGGERED 

TRIGGERED: Trigger a one-shot measurement of current and bus voltage. Set the TRIGGERED mode again to take a new measurement

INA260_MODE_CONTINUOUS 

CONTINUOUS: (Default) Continuously update the current, bus voltage and power registers with new measurements

◆ _conversion_time

Conversion Time options.

Allowed values for setCurrentConversionTime and setVoltageConversionTime.

Enumerator
INA260_TIME_140_us 

Measurement time: 140us.

INA260_TIME_204_us 

Measurement time: 204us.

INA260_TIME_332_us 

Measurement time: 332us.

INA260_TIME_558_us 

Measurement time: 558us.

INA260_TIME_1_1_ms 

Measurement time: 1.1ms (Default)

INA260_TIME_2_116_ms 

Measurement time: 2.116ms.

INA260_TIME_4_156_ms 

Measurement time: 4.156ms.

INA260_TIME_8_244_ms 

Measurement time: 8.224ms.

◆ _count

enum _count

Averaging Count options.

Allowed values forsetAveragingCount.

Enumerator
INA260_COUNT_1 

Window size: 1 sample (Default)

INA260_COUNT_4 

Window size: 4 samples.

INA260_COUNT_16 

Window size: 16 samples.

INA260_COUNT_64 

Window size: 64 samples.

INA260_COUNT_128 

Window size: 128 samples.

INA260_COUNT_256 

Window size: 256 samples.

INA260_COUNT_512 

Window size: 512 samples.

INA260_COUNT_1024 

Window size: 1024 samples.

◆ _alert_type

Alert trigger options.

Allowed values for setAlertType.

Enumerator
INA260_ALERT_CONVERSION_READY 

Trigger on conversion ready.

INA260_ALERT_OVERPOWER 

Trigger on power over limit.

INA260_ALERT_UNDERVOLTAGE 

Trigger on bus voltage under limit.

INA260_ALERT_OVERVOLTAGE 

Trigger on bus voltage over limit.

INA260_ALERT_UNDERCURRENT 

Trigger on current under limit.

INA260_ALERT_OVERCURRENT 

Trigger on current over limit.

INA260_ALERT_NONE 

Do not trigger alert pin (Default)

◆ _alert_polarity

Alert pin polarity options.

Allowed values for setAlertPolarity.

Enumerator
INA260_ALERT_POLARITY_NORMAL 

Active high open-collector (Default)

INA260_ALERT_POLARITY_INVERTED 

Active low open-collector.

◆ _alert_latch

Alert pin latch options.

Allowed values for setAlertLatch.

Enumerator
INA260_ALERT_LATCH_ENABLED 

Alert will latch until Mask/Enable register is read

INA260_ALERT_LATCH_TRANSPARENT 

Alert will reset when fault is cleared