Loading...
Searching...
No Matches

Device driver interface for Texas Instruments INA219/INA2XX Bi-Directional CURRENT/POWER MONITOR with Two-Wire Interface. More...

Detailed Description

Device driver interface for Texas Instruments INA219/INA2XX Bi-Directional CURRENT/POWER MONITOR with Two-Wire Interface.

Author
Joakim NohlgÄrd joaki.nosp@m.m.no.nosp@m.hlgar.nosp@m.d@ei.nosp@m.stec..nosp@m.se
Marian Buschsieweke maria.nosp@m.n.bu.nosp@m.schsi.nosp@m.ewek.nosp@m.e@ovg.nosp@m.u.de

Definition in file ina2xx.h.

#include <stdint.h>
#include "periph/i2c.h"
+ Include dependency graph for ina2xx.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ina2xx_params_t
 Configuration parameters of the INA2xx driver. More...
 
struct  ina2xx_t
 Device descriptor for INA2XX sensors. More...
 

Typedefs

typedef enum ina2xx_mode ina2xx_mode_t
 INA2XX possible mode settings.
 
typedef enum ina2xx_sadc ina2xx_sadc_t
 Shunt ADC settings.
 
typedef enum ina2xx_badc ina2xx_badc_t
 Bus ADC settings.
 
typedef enum ina2xx_pga ina2xx_pga_t
 Shunt voltage measurement range (PGA settings)
 
typedef enum ina2xx_brng ina2xx_brng_t
 Bus voltage measurement range.
 
typedef enum ina2xx_i_range ina2xx_i_range_t
 Current measurement range.
 

Enumerations

enum  ina2xx_mode {
  INA2XX_MODE_POWERDOWN = 0x0000 , INA2XX_MODE_TRIGGER_SHUNT_ONLY = 0x0001 , INA2XX_MODE_TRIGGER_BUS_ONLY = 0x0002 , INA2XX_MODE_TRIGGER_SHUNT_BUS = 0x0003 ,
  INA2XX_MODE_ADC_DISABLE = 0x0004 , INA2XX_MODE_CONTINUOUS_SHUNT_ONLY = 0x0005 , INA2XX_MODE_CONTINUOUS_BUS_ONLY = 0x0006 , INA2XX_MODE_CONTINUOUS_SHUNT_BUS = 0x0007
}
 INA2XX possible mode settings. More...
 
enum  ina2xx_sadc {
  INA2XX_SADC_9BIT = 0x0000 , INA2XX_SADC_10BIT = 0x0008 , INA2XX_SADC_11BIT = 0x0010 , INA2XX_SADC_12BIT = 0x0018 ,
  INA2XX_SADC_AVG_1_SAMPLE = 0x0040 , INA2XX_SADC_AVG_2_SAMPLES = 0x0048 , INA2XX_SADC_AVG_4_SAMPLES = 0x0050 , INA2XX_SADC_AVG_8_SAMPLES = 0x0058 ,
  INA2XX_SADC_AVG_16_SAMPLES = 0x0060 , INA2XX_SADC_AVG_32_SAMPLES = 0x0068 , INA2XX_SADC_AVG_64_SAMPLES = 0x0070 , INA2XX_SADC_AVG_128_SAMPLES = 0x0078
}
 Shunt ADC settings. More...
 
enum  ina2xx_badc {
  INA2XX_BADC_9BIT = 0x0000 , INA2XX_BADC_10BIT = 0x0080 , INA2XX_BADC_11BIT = 0x0100 , INA2XX_BADC_12BIT = 0x0180 ,
  INA2XX_BADC_AVG_1_SAMPLE = 0x0400 , INA2XX_BADC_AVG_2_SAMPLES = 0x0480 , INA2XX_BADC_AVG_4_SAMPLES = 0x0500 , INA2XX_BADC_AVG_8_SAMPLES = 0x0580 ,
  INA2XX_BADC_AVG_16_SAMPLES = 0x0600 , INA2XX_BADC_AVG_32_SAMPLES = 0x0680 , INA2XX_BADC_AVG_64_SAMPLES = 0x0700 , INA2XX_BADC_AVG_128_SAMPLES = 0x0780
}
 Bus ADC settings. More...
 
enum  ina2xx_pga { INA2XX_SHUNT_RANGE_40MV = 0x0000 , INA2XX_SHUNT_RANGE_80MV = 0x0800 , INA2XX_SHUNT_RANGE_160MV = 0x1000 , INA2XX_SHUNT_RANGE_320MV = 0x1800 }
 Shunt voltage measurement range (PGA settings) More...
 
enum  ina2xx_brng { INA2XX_BUS_RANGE_16V = 0x0000 , INA2XX_BUS_RANGE_32V = 0x2000 }
 Bus voltage measurement range. More...
 
enum  ina2xx_i_range {
  INA2XX_CURRENT_RANGE_327_MA , INA2XX_CURRENT_RANGE_655_MA , INA2XX_CURRENT_RANGE_1310_MA , INA2XX_CURRENT_RANGE_2621_MA ,
  INA2XX_CURRENT_RANGE_5242_MA , INA2XX_CURRENT_RANGE_10485_MA
}
 Current measurement range. More...
 

Functions

int ina2xx_init (ina2xx_t *dev, const ina2xx_params_t *params)
 Initialize a current sensor.
 
int ina2xx_read_shunt (const ina2xx_t *dev, int16_t *voltage)
 Read shunt voltage in E-05 V.
 
int ina2xx_read_bus (const ina2xx_t *dev, uint16_t *voltage)
 Read bus voltage in mV.
 
int ina2xx_read_current (const ina2xx_t *dev, int32_t *current)
 Read shunt current in E-05 A.
 
int ina2xx_read_power (const ina2xx_t *dev, uint32_t *power)
 Read power consumption in E-04 W.