LibDriver INA226  1.0.0
INA226 full-featured driver
ina226 basic driver function

ina226 basic driver modules More...

Data Structures

struct  ina226_handle_s
 ina226 handle structure definition More...
 
struct  ina226_info_s
 ina226 information structure definition More...
 

Macros

#define INA226_READ_TIMEOUT   1000
 ina226 read timeout definition More...
 

Typedefs

typedef struct ina226_handle_s ina226_handle_t
 ina226 handle structure definition More...
 
typedef struct ina226_info_s ina226_info_t
 ina226 information structure definition More...
 

Enumerations

enum  ina226_address_t {
  INA226_ADDRESS_0 = (0x40 << 1) , INA226_ADDRESS_1 = (0x41 << 1) , INA226_ADDRESS_2 = (0x42 << 1) , INA226_ADDRESS_3 = (0x43 << 1) ,
  INA226_ADDRESS_4 = (0x44 << 1) , INA226_ADDRESS_5 = (0x45 << 1) , INA226_ADDRESS_6 = (0x46 << 1) , INA226_ADDRESS_7 = (0x47 << 1) ,
  INA226_ADDRESS_8 = (0x48 << 1) , INA226_ADDRESS_9 = (0x49 << 1) , INA226_ADDRESS_A = (0x4A << 1) , INA226_ADDRESS_B = (0x4B << 1) ,
  INA226_ADDRESS_C = (0x4C << 1) , INA226_ADDRESS_D = (0x4D << 1) , INA226_ADDRESS_E = (0x4E << 1) , INA226_ADDRESS_F = (0x4F << 1)
}
 ina226 address enumeration definition More...
 
enum  ina226_bool_t { INA226_BOOL_FALSE = 0x00 , INA226_BOOL_TRUE = 0x01 }
 ina226 bool enumeration definition More...
 
enum  ina226_avg_t {
  INA226_AVG_1 = 0 , INA226_AVG_4 = 1 , INA226_AVG_16 = 2 , INA226_AVG_64 = 3 ,
  INA226_AVG_128 = 4 , INA226_AVG_256 = 5 , INA226_AVG_512 = 6 , INA226_AVG_1024 = 7
}
 ina226 average enumeration definition More...
 
enum  ina226_conversion_time_t {
  INA226_CONVERSION_TIME_140_US = 0 , INA226_CONVERSION_TIME_204_US = 1 , INA226_CONVERSION_TIME_332_US = 2 , INA226_CONVERSION_TIME_588_US = 3 ,
  INA226_CONVERSION_TIME_1P1_MS = 4 , INA226_CONVERSION_TIME_2P116_MS = 5 , INA226_CONVERSION_TIME_4P156_MS = 6 , INA226_CONVERSION_TIME_8P244_MS = 7
}
 
enum  ina226_mode_t {
  INA226_MODE_POWER_DOWN = 0x0 , INA226_MODE_SHUNT_VOLTAGE_TRIGGERED = 0x1 , INA226_MODE_BUS_VOLTAGE_TRIGGERED = 0x2 , INA226_MODE_SHUNT_BUS_VOLTAGE_TRIGGERED = 0x3 ,
  INA226_MODE_SHUTDOWN = 0x4 , INA226_MODE_SHUNT_VOLTAGE_CONTINUOUS = 0x5 , INA226_MODE_BUS_VOLTAGE_CONTINUOUS = 0x6 , INA226_MODE_SHUNT_BUS_VOLTAGE_CONTINUOUS = 0x7
}
 ina226 mode enumeration definition More...
 
enum  ina226_status_t {
  INA226_STATUS_SHUNT_VOLTAGE_OVER_VOLTAGE = 15 , INA226_STATUS_SHUNT_VOLTAGE_UNDER_VOLTAGE = 14 , INA226_STATUS_BUS_VOLTAGE_OVER_VOLTAGE = 13 , INA226_STATUS_BUS_VOLTAGE_UNDER_VOLTAGE = 12 ,
  INA226_STATUS_POWER_OVER_LIMIT = 11
}
 ina226 status enumeration definition More...
 
enum  ina226_mask_t {
  INA226_MASK_SHUNT_VOLTAGE_OVER_VOLTAGE = 15 , INA226_MASK_SHUNT_VOLTAGE_UNDER_VOLTAGE = 14 , INA226_MASK_BUS_VOLTAGE_OVER_VOLTAGE = 13 , INA226_MASK_BUS_VOLTAGE_UNDER_VOLTAGE = 12 ,
  INA226_MASK_POWER_OVER_LIMIT = 11
}
 ina226 mask enumeration definition More...
 
enum  ina226_alert_polarity_t { INA226_ALERT_POLARITY_NORMAL = 0 , INA226_ALERT_POLARITY_INVERTED = 1 }
 ina226 alert polarity enumeration definition More...
 

Functions

uint8_t ina226_info (ina226_info_t *info)
 get chip's information More...
 
uint8_t ina226_set_addr_pin (ina226_handle_t *handle, ina226_address_t addr_pin)
 set the iic address pin More...
 
uint8_t ina226_get_addr_pin (ina226_handle_t *handle, ina226_address_t *addr_pin)
 get the iic address pin More...
 
uint8_t ina226_set_resistance (ina226_handle_t *handle, double resistance)
 set the resistance More...
 
uint8_t ina226_get_resistance (ina226_handle_t *handle, double *resistance)
 get the resistance More...
 
uint8_t ina226_irq_handler (ina226_handle_t *handle)
 irq handler More...
 
uint8_t ina226_init (ina226_handle_t *handle)
 initialize the chip More...
 
uint8_t ina226_deinit (ina226_handle_t *handle)
 close the chip More...
 
uint8_t ina226_soft_reset (ina226_handle_t *handle)
 soft reset the chip More...
 
uint8_t ina226_set_average_mode (ina226_handle_t *handle, ina226_avg_t mode)
 set average mode More...
 
uint8_t ina226_get_average_mode (ina226_handle_t *handle, ina226_avg_t *mode)
 get average mode More...
 
uint8_t ina226_set_bus_voltage_conversion_time (ina226_handle_t *handle, ina226_conversion_time_t t)
 set bus voltage conversion time More...
 
uint8_t ina226_get_bus_voltage_conversion_time (ina226_handle_t *handle, ina226_conversion_time_t *t)
 get bus voltage conversion time More...
 
uint8_t ina226_set_shunt_voltage_conversion_time (ina226_handle_t *handle, ina226_conversion_time_t t)
 set shunt voltage conversion time More...
 
uint8_t ina226_get_shunt_voltage_conversion_time (ina226_handle_t *handle, ina226_conversion_time_t *t)
 get shunt voltage conversion time More...
 
uint8_t ina226_set_mode (ina226_handle_t *handle, ina226_mode_t mode)
 set the mode More...
 
uint8_t ina226_get_mode (ina226_handle_t *handle, ina226_mode_t *mode)
 get the mode More...
 
uint8_t ina226_read_shunt_voltage (ina226_handle_t *handle, int16_t *raw, float *mV)
 read the shunt voltage More...
 
uint8_t ina226_read_bus_voltage (ina226_handle_t *handle, uint16_t *raw, float *mV)
 read the bus voltage More...
 
uint8_t ina226_read_power (ina226_handle_t *handle, uint16_t *raw, float *mW)
 read the power More...
 
uint8_t ina226_read_current (ina226_handle_t *handle, int16_t *raw, float *mA)
 read the current More...
 
uint8_t ina226_set_calibration (ina226_handle_t *handle, uint16_t data)
 set the calibration More...
 
uint8_t ina226_get_calibration (ina226_handle_t *handle, uint16_t *data)
 get the calibration More...
 
uint8_t ina226_calculate_calibration (ina226_handle_t *handle, uint16_t *calibration)
 calculate the calibration More...
 
uint8_t ina226_set_mask (ina226_handle_t *handle, ina226_mask_t mask, ina226_bool_t enable)
 enable or disable mask More...
 
uint8_t ina226_get_mask (ina226_handle_t *handle, ina226_mask_t mask, ina226_bool_t *enable)
 get mask More...
 
uint8_t ina226_set_conversion_ready_alert_pin (ina226_handle_t *handle, ina226_bool_t enable)
 enable or disable conversion ready alert pin More...
 
uint8_t ina226_get_conversion_ready_alert_pin (ina226_handle_t *handle, ina226_bool_t *enable)
 get conversion ready alert pin status More...
 
uint8_t ina226_set_alert_polarity_pin (ina226_handle_t *handle, ina226_alert_polarity_t pin)
 set alert polarity pin More...
 
uint8_t ina226_get_alert_polarity_pin (ina226_handle_t *handle, ina226_alert_polarity_t *pin)
 get alert polarity pin More...
 
uint8_t ina226_set_alert_latch (ina226_handle_t *handle, ina226_bool_t enable)
 enable or disable alert latch More...
 
uint8_t ina226_get_alert_latch (ina226_handle_t *handle, ina226_bool_t *enable)
 get alert latch status More...
 
uint8_t ina226_set_alert_limit (ina226_handle_t *handle, uint16_t reg)
 set alert limit More...
 
uint8_t ina226_get_alert_limit (ina226_handle_t *handle, uint16_t *reg)
 get alert limit More...
 
uint8_t ina226_shunt_voltage_convert_to_register (ina226_handle_t *handle, float mV, uint16_t *reg)
 convert the shunt voltage to the register raw data More...
 
uint8_t ina226_shunt_voltage_convert_to_data (ina226_handle_t *handle, uint16_t reg, float *mV)
 convert the register raw data to the shunt voltage More...
 
uint8_t ina226_bus_voltage_convert_to_register (ina226_handle_t *handle, float mV, uint16_t *reg)
 convert the bus voltage to the register raw data More...
 
uint8_t ina226_bus_voltage_convert_to_data (ina226_handle_t *handle, uint16_t reg, float *mV)
 convert the register raw data to the bus voltage More...
 
uint8_t ina226_power_convert_to_register (ina226_handle_t *handle, float mW, uint16_t *reg)
 convert the power to the register raw data More...
 
uint8_t ina226_power_convert_to_data (ina226_handle_t *handle, uint16_t reg, float *mW)
 convert the register raw data to the power More...
 
uint8_t ina226_get_die_id (ina226_handle_t *handle, uint16_t *device_id, uint8_t *die_revision_id)
 get the die id More...
 

Detailed Description

ina226 basic driver modules

Macro Definition Documentation

◆ INA226_READ_TIMEOUT

#define INA226_READ_TIMEOUT   1000

ina226 read timeout definition

1000ms

Definition at line 63 of file driver_ina226.h.

Typedef Documentation

◆ ina226_handle_t

ina226 handle structure definition

◆ ina226_info_t

typedef struct ina226_info_s ina226_info_t

ina226 information structure definition

Enumeration Type Documentation

◆ ina226_address_t

ina226 address enumeration definition

Enumerator
INA226_ADDRESS_0 

A0 = GND, A1 = GND

INA226_ADDRESS_1 

A0 = VS+, A1 = GND

INA226_ADDRESS_2 

A0 = SDA, A1 = GND

INA226_ADDRESS_3 

A0 = SCL, A1 = GND

INA226_ADDRESS_4 

A0 = GND, A1 = VS+

INA226_ADDRESS_5 

A0 = VS+, A1 = VS+

INA226_ADDRESS_6 

A0 = SDA, A1 = VS+

INA226_ADDRESS_7 

A0 = SCL, A1 = VS+

INA226_ADDRESS_8 

A0 = GND, A1 = SDA

INA226_ADDRESS_9 

A0 = VS+, A1 = SDA

INA226_ADDRESS_A 

A0 = SDA, A1 = SDA

INA226_ADDRESS_B 

A0 = SCL, A1 = SDA

INA226_ADDRESS_C 

A0 = GND, A1 = SCL

INA226_ADDRESS_D 

A0 = VS+, A1 = SCL

INA226_ADDRESS_E 

A0 = SDA, A1 = SCL

INA226_ADDRESS_F 

A0 = SCL, A1 = SCL

Definition at line 69 of file driver_ina226.h.

◆ ina226_alert_polarity_t

ina226 alert polarity enumeration definition

Enumerator
INA226_ALERT_POLARITY_NORMAL 

active low open collector

INA226_ALERT_POLARITY_INVERTED 

active high open collector

Definition at line 167 of file driver_ina226.h.

◆ ina226_avg_t

ina226 average enumeration definition

Enumerator
INA226_AVG_1 

1 average

INA226_AVG_4 

4 averages

INA226_AVG_16 

16 averages

INA226_AVG_64 

64 averages

INA226_AVG_128 

128 averages

INA226_AVG_256 

256 averages

INA226_AVG_512 

512 averages

INA226_AVG_1024 

1024 averages

Definition at line 101 of file driver_ina226.h.

◆ ina226_bool_t

ina226 bool enumeration definition

Enumerator
INA226_BOOL_FALSE 

false

INA226_BOOL_TRUE 

true

Definition at line 92 of file driver_ina226.h.

◆ ina226_conversion_time_t

Enumerator
INA226_CONVERSION_TIME_140_US 

140 us

INA226_CONVERSION_TIME_204_US 

204 us

INA226_CONVERSION_TIME_332_US 

332 us

INA226_CONVERSION_TIME_588_US 

588 us

INA226_CONVERSION_TIME_1P1_MS 

1.1 ms

INA226_CONVERSION_TIME_2P116_MS 

2.116 ms

INA226_CONVERSION_TIME_4P156_MS 

4.156 ms

INA226_CONVERSION_TIME_8P244_MS 

8.244 ms

Definition at line 113 of file driver_ina226.h.

◆ ina226_mask_t

ina226 mask enumeration definition

Enumerator
INA226_MASK_SHUNT_VOLTAGE_OVER_VOLTAGE 

shunt voltage over voltage

INA226_MASK_SHUNT_VOLTAGE_UNDER_VOLTAGE 

shunt voltage under voltage

INA226_MASK_BUS_VOLTAGE_OVER_VOLTAGE 

bus voltage over voltage

INA226_MASK_BUS_VOLTAGE_UNDER_VOLTAGE 

bus voltage under voltage

INA226_MASK_POWER_OVER_LIMIT 

power over limit

Definition at line 155 of file driver_ina226.h.

◆ ina226_mode_t

ina226 mode enumeration definition

Enumerator
INA226_MODE_POWER_DOWN 

power down

INA226_MODE_SHUNT_VOLTAGE_TRIGGERED 

shunt voltage triggered

INA226_MODE_BUS_VOLTAGE_TRIGGERED 

bus voltage triggered

INA226_MODE_SHUNT_BUS_VOLTAGE_TRIGGERED 

shunt and bus triggered

INA226_MODE_SHUTDOWN 

shutdown

INA226_MODE_SHUNT_VOLTAGE_CONTINUOUS 

shunt voltage continuous

INA226_MODE_BUS_VOLTAGE_CONTINUOUS 

bus voltage continuous

INA226_MODE_SHUNT_BUS_VOLTAGE_CONTINUOUS 

shunt and bus voltage continuous

Definition at line 128 of file driver_ina226.h.

◆ ina226_status_t

ina226 status enumeration definition

Enumerator
INA226_STATUS_SHUNT_VOLTAGE_OVER_VOLTAGE 

shunt voltage over voltage

INA226_STATUS_SHUNT_VOLTAGE_UNDER_VOLTAGE 

shunt voltage under voltage

INA226_STATUS_BUS_VOLTAGE_OVER_VOLTAGE 

bus voltage over voltage

INA226_STATUS_BUS_VOLTAGE_UNDER_VOLTAGE 

bus voltage under voltage

INA226_STATUS_POWER_OVER_LIMIT 

power over limit

Definition at line 143 of file driver_ina226.h.

Function Documentation

◆ ina226_bus_voltage_convert_to_data()

uint8_t ina226_bus_voltage_convert_to_data ( ina226_handle_t handle,
uint16_t  reg,
float *  mV 
)

convert the register raw data to the bus voltage

Parameters
[in]*handlepointer to an ina226 handle structure
[in]regregister raw data
[out]*mVpointer to a millivolt buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1556 of file driver_ina226.c.

◆ ina226_bus_voltage_convert_to_register()

uint8_t ina226_bus_voltage_convert_to_register ( ina226_handle_t handle,
float  mV,
uint16_t *  reg 
)

convert the bus voltage to the register raw data

Parameters
[in]*handlepointer to an ina226 handle structure
[in]mVmillivolt
[out]*regpointer to a register raw buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1529 of file driver_ina226.c.

◆ ina226_calculate_calibration()

uint8_t ina226_calculate_calibration ( ina226_handle_t handle,
uint16_t *  calibration 
)

calculate the calibration

Parameters
[in]*handlepointer to an ina226 handle structure
[out]*calibrationpointer to a calibration data buffer
Returns
status code
  • 0 success
  • 1 calculate calibration failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 r can't be zero
Note
none

Definition at line 1003 of file driver_ina226.c.

◆ ina226_deinit()

uint8_t ina226_deinit ( ina226_handle_t handle)

close the chip

Parameters
[in]*handlepointer to an ina226 handle structure
Returns
status code
  • 0 success
  • 1 iic deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 power down failed
Note
none

Definition at line 1836 of file driver_ina226.c.

◆ ina226_get_addr_pin()

uint8_t ina226_get_addr_pin ( ina226_handle_t handle,
ina226_address_t addr_pin 
)

get the iic address pin

Parameters
[in]*handlepointer to an ina226 handle structure
[out]*addr_pinpointer to an address pin buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 191 of file driver_ina226.c.

◆ ina226_get_alert_latch()

uint8_t ina226_get_alert_latch ( ina226_handle_t handle,
ina226_bool_t enable 
)

get alert latch status

Parameters
[in]*handlepointer to an ina226 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get alert latch failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1368 of file driver_ina226.c.

◆ ina226_get_alert_limit()

uint8_t ina226_get_alert_limit ( ina226_handle_t handle,
uint16_t *  reg 
)

get alert limit

Parameters
[in]*handlepointer to an ina226 handle structure
[out]*regpointer to a register buffer
Returns
status code
  • 0 success
  • 1 get alert limit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1440 of file driver_ina226.c.

◆ ina226_get_alert_polarity_pin()

uint8_t ina226_get_alert_polarity_pin ( ina226_handle_t handle,
ina226_alert_polarity_t pin 
)

get alert polarity pin

Parameters
[in]*handlepointer to an ina226 handle structure
[out]*pinpointer to an alert polarity pin buffer
Returns
status code
  • 0 success
  • 1 get alert polarity pin failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1286 of file driver_ina226.c.

◆ ina226_get_average_mode()

uint8_t ina226_get_average_mode ( ina226_handle_t handle,
ina226_avg_t mode 
)

get average mode

Parameters
[in]*handlepointer to an ina226 handle structure
[out]*modepointer to an average mode buffer
Returns
status code
  • 0 success
  • 1 get average mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 289 of file driver_ina226.c.

◆ ina226_get_bus_voltage_conversion_time()

uint8_t ina226_get_bus_voltage_conversion_time ( ina226_handle_t handle,
ina226_conversion_time_t t 
)

get bus voltage conversion time

Parameters
[in]*handlepointer to an ina226 handle structure
[out]*tpointer to a conversion time buffer
Returns
status code
  • 0 success
  • 1 get bus voltage conversion time failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 364 of file driver_ina226.c.

◆ ina226_get_calibration()

uint8_t ina226_get_calibration ( ina226_handle_t handle,
uint16_t *  data 
)

get the calibration

Parameters
[in]*handlepointer to an ina226 handle structure
[out]*datapointer to a calibration data buffer
Returns
status code
  • 0 success
  • 1 get calibration failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 967 of file driver_ina226.c.

◆ ina226_get_conversion_ready_alert_pin()

uint8_t ina226_get_conversion_ready_alert_pin ( ina226_handle_t handle,
ina226_bool_t enable 
)

get conversion ready alert pin status

Parameters
[in]*handlepointer to an ina226 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get conversion ready alert pin failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1204 of file driver_ina226.c.

◆ ina226_get_die_id()

uint8_t ina226_get_die_id ( ina226_handle_t handle,
uint16_t *  device_id,
uint8_t *  die_revision_id 
)

get the die id

Parameters
[in]*handlepointer to an ina226 handle structure
[out]*device_idpointer to a device id buffer
[out]*die_revision_idpointer to a die revision id buffer
Returns
status code
  • 0 success
  • 1 get die id failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 569 of file driver_ina226.c.

◆ ina226_get_mask()

uint8_t ina226_get_mask ( ina226_handle_t handle,
ina226_mask_t  mask,
ina226_bool_t enable 
)

get mask

Parameters
[in]*handlepointer to an ina226 handle structure
[in]maskset mask
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get mask failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1122 of file driver_ina226.c.

◆ ina226_get_mode()

uint8_t ina226_get_mode ( ina226_handle_t handle,
ina226_mode_t mode 
)

get the mode

Parameters
[in]*handlepointer to an ina226 handle structure
[out]*modepointer to a chip mode buffer
Returns
status code
  • 0 success
  • 1 get mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 531 of file driver_ina226.c.

◆ ina226_get_resistance()

uint8_t ina226_get_resistance ( ina226_handle_t handle,
double *  resistance 
)

get the resistance

Parameters
[in]*handlepointer to an ina226 handle structure
[out]*resistancepointer to a current sampling resistance value buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 149 of file driver_ina226.c.

◆ ina226_get_shunt_voltage_conversion_time()

uint8_t ina226_get_shunt_voltage_conversion_time ( ina226_handle_t handle,
ina226_conversion_time_t t 
)

get shunt voltage conversion time

Parameters
[in]*handlepointer to an ina226 handle structure
[out]*tpointer to a conversion time buffer
Returns
status code
  • 0 success
  • 1 get shunt voltage conversion time failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 439 of file driver_ina226.c.

◆ ina226_info()

uint8_t ina226_info ( ina226_info_t info)

get chip's information

Parameters
[out]*infopointer to an ina226 info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 1936 of file driver_ina226.c.

◆ ina226_init()

uint8_t ina226_init ( ina226_handle_t handle)

initialize the chip

Parameters
[in]*handlepointer to an ina226 handle structure
Returns
status code
  • 0 success
  • 1 iic initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
  • 4 id is invalid
  • 5 soft reset failed
Note
none

Definition at line 1715 of file driver_ina226.c.

◆ ina226_irq_handler()

uint8_t ina226_irq_handler ( ina226_handle_t handle)

irq handler

Parameters
[in]*handlepointer to an ina226 handle structure
Returns
status code
  • 0 success
  • 1 run failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1636 of file driver_ina226.c.

◆ ina226_power_convert_to_data()

uint8_t ina226_power_convert_to_data ( ina226_handle_t handle,
uint16_t  reg,
float *  mW 
)

convert the register raw data to the power

Parameters
[in]*handlepointer to an ina226 handle structure
[in]regregister raw data
[out]*mWpointer to a milliwatt buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1610 of file driver_ina226.c.

◆ ina226_power_convert_to_register()

uint8_t ina226_power_convert_to_register ( ina226_handle_t handle,
float  mW,
uint16_t *  reg 
)

convert the power to the register raw data

Parameters
[in]*handlepointer to an ina226 handle structure
[in]mWmilliwatt
[out]*regpointer to a register raw buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1583 of file driver_ina226.c.

◆ ina226_read_bus_voltage()

uint8_t ina226_read_bus_voltage ( ina226_handle_t handle,
uint16_t *  raw,
float *  mV 
)

read the bus voltage

Parameters
[in]*handlepointer to an ina226 handle structure
[out]*rawpointer to raw data buffer
[out]*mVpointer to converted data buffer
Returns
status code
  • 0 success
  • 1 read bus voltage failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 math overflow
  • 5 read timeout
Note
none

Definition at line 703 of file driver_ina226.c.

◆ ina226_read_current()

uint8_t ina226_read_current ( ina226_handle_t handle,
int16_t *  raw,
float *  mA 
)

read the current

Parameters
[in]*handlepointer to an ina226 handle structure
[out]*rawpointer to raw data buffer
[out]*mApointer to converted data buffer
Returns
status code
  • 0 success
  • 1 read current failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 math overflow
  • 5 read timeout
Note
none

Definition at line 790 of file driver_ina226.c.

◆ ina226_read_power()

uint8_t ina226_read_power ( ina226_handle_t handle,
uint16_t *  raw,
float *  mW 
)

read the power

Parameters
[in]*handlepointer to an ina226 handle structure
[out]*rawpointer to raw data buffer
[out]*mWpointer to converted data buffer
Returns
status code
  • 0 success
  • 1 read power failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 math overflow
  • 5 read timeout
Note
none

Definition at line 883 of file driver_ina226.c.

◆ ina226_read_shunt_voltage()

uint8_t ina226_read_shunt_voltage ( ina226_handle_t handle,
int16_t *  raw,
float *  mV 
)

read the shunt voltage

Parameters
[in]*handlepointer to an ina226 handle structure
[out]*rawpointer to raw data buffer
[out]*mVpointer to converted data buffer
Returns
status code
  • 0 success
  • 1 read shunt voltage failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 math overflow
  • 5 read timeout
Note
none

Definition at line 610 of file driver_ina226.c.

◆ ina226_set_addr_pin()

uint8_t ina226_set_addr_pin ( ina226_handle_t handle,
ina226_address_t  addr_pin 
)

set the iic address pin

Parameters
[in]*handlepointer to an ina226 handle structure
[in]addr_pinaddress pin
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 170 of file driver_ina226.c.

◆ ina226_set_alert_latch()

uint8_t ina226_set_alert_latch ( ina226_handle_t handle,
ina226_bool_t  enable 
)

enable or disable alert latch

Parameters
[in]*handlepointer to an ina226 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set alert latch failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1323 of file driver_ina226.c.

◆ ina226_set_alert_limit()

uint8_t ina226_set_alert_limit ( ina226_handle_t handle,
uint16_t  reg 
)

set alert limit

Parameters
[in]*handlepointer to an ina226 handle structure
[in]regset register
Returns
status code
  • 0 success
  • 1 set alert limit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1405 of file driver_ina226.c.

◆ ina226_set_alert_polarity_pin()

uint8_t ina226_set_alert_polarity_pin ( ina226_handle_t handle,
ina226_alert_polarity_t  pin 
)

set alert polarity pin

Parameters
[in]*handlepointer to an ina226 handle structure
[in]pinalert polarity pin
Returns
status code
  • 0 success
  • 1 set alert polarity pin failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1241 of file driver_ina226.c.

◆ ina226_set_average_mode()

uint8_t ina226_set_average_mode ( ina226_handle_t handle,
ina226_avg_t  mode 
)

set average mode

Parameters
[in]*handlepointer to an ina226 handle structure
[in]modeaverage mode
Returns
status code
  • 0 success
  • 1 set average mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 251 of file driver_ina226.c.

◆ ina226_set_bus_voltage_conversion_time()

uint8_t ina226_set_bus_voltage_conversion_time ( ina226_handle_t handle,
ina226_conversion_time_t  t 
)

set bus voltage conversion time

Parameters
[in]*handlepointer to an ina226 handle structure
[in]tconversion time
Returns
status code
  • 0 success
  • 1 set bus voltage conversion time failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 326 of file driver_ina226.c.

◆ ina226_set_calibration()

uint8_t ina226_set_calibration ( ina226_handle_t handle,
uint16_t  data 
)

set the calibration

Parameters
[in]*handlepointer to an ina226 handle structure
[in]datacalibration data
Returns
status code
  • 0 success
  • 1 set calibration failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1040 of file driver_ina226.c.

◆ ina226_set_conversion_ready_alert_pin()

uint8_t ina226_set_conversion_ready_alert_pin ( ina226_handle_t handle,
ina226_bool_t  enable 
)

enable or disable conversion ready alert pin

Parameters
[in]*handlepointer to an ina226 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set conversion ready alert pin failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1159 of file driver_ina226.c.

◆ ina226_set_mask()

uint8_t ina226_set_mask ( ina226_handle_t handle,
ina226_mask_t  mask,
ina226_bool_t  enable 
)

enable or disable mask

Parameters
[in]*handlepointer to an ina226 handle structure
[in]maskset mask
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set mask failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1076 of file driver_ina226.c.

◆ ina226_set_mode()

uint8_t ina226_set_mode ( ina226_handle_t handle,
ina226_mode_t  mode 
)

set the mode

Parameters
[in]*handlepointer to an ina226 handle structure
[in]modechip mode
Returns
status code
  • 0 success
  • 1 set mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 476 of file driver_ina226.c.

◆ ina226_set_resistance()

uint8_t ina226_set_resistance ( ina226_handle_t handle,
double  resistance 
)

set the resistance

Parameters
[in]*handlepointer to an ina226 handle structure
[in]resistancecurrent sampling resistance value
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 128 of file driver_ina226.c.

◆ ina226_set_shunt_voltage_conversion_time()

uint8_t ina226_set_shunt_voltage_conversion_time ( ina226_handle_t handle,
ina226_conversion_time_t  t 
)

set shunt voltage conversion time

Parameters
[in]*handlepointer to an ina226 handle structure
[in]tconversion time
Returns
status code
  • 0 success
  • 1 set shunt voltage conversion time failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 401 of file driver_ina226.c.

◆ ina226_shunt_voltage_convert_to_data()

uint8_t ina226_shunt_voltage_convert_to_data ( ina226_handle_t handle,
uint16_t  reg,
float *  mV 
)

convert the register raw data to the shunt voltage

Parameters
[in]*handlepointer to an ina226 handle structure
[in]regregister raw data
[out]*mVpointer to a millivolt buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1502 of file driver_ina226.c.

◆ ina226_shunt_voltage_convert_to_register()

uint8_t ina226_shunt_voltage_convert_to_register ( ina226_handle_t handle,
float  mV,
uint16_t *  reg 
)

convert the shunt voltage to the register raw data

Parameters
[in]*handlepointer to an ina226 handle structure
[in]mVmillivolt
[out]*regpointer to a register raw buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1475 of file driver_ina226.c.

◆ ina226_soft_reset()

uint8_t ina226_soft_reset ( ina226_handle_t handle)

soft reset the chip

Parameters
[in]*handlepointer to an ina226 handle structure
Returns
status code
  • 0 success
  • 1 soft reset failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 213 of file driver_ina226.c.