![]() |
LibDriver INA226
|
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 | |
Typedefs | |
| typedef struct ina226_handle_s | ina226_handle_t |
| ina226 handle structure definition | |
| typedef struct ina226_info_s | ina226_info_t |
| ina226 information structure definition | |
Functions | |
| uint8_t | ina226_info (ina226_info_t *info) |
| get chip's information | |
| uint8_t | ina226_set_addr_pin (ina226_handle_t *handle, ina226_address_t addr_pin) |
| set the iic address pin | |
| uint8_t | ina226_get_addr_pin (ina226_handle_t *handle, ina226_address_t *addr_pin) |
| get the iic address pin | |
| uint8_t | ina226_set_resistance (ina226_handle_t *handle, double resistance) |
| set the resistance | |
| uint8_t | ina226_get_resistance (ina226_handle_t *handle, double *resistance) |
| get the resistance | |
| uint8_t | ina226_irq_handler (ina226_handle_t *handle) |
| irq handler | |
| uint8_t | ina226_init (ina226_handle_t *handle) |
| initialize the chip | |
| uint8_t | ina226_deinit (ina226_handle_t *handle) |
| close the chip | |
| uint8_t | ina226_soft_reset (ina226_handle_t *handle) |
| soft reset the chip | |
| uint8_t | ina226_set_average_mode (ina226_handle_t *handle, ina226_avg_t mode) |
| set average mode | |
| uint8_t | ina226_get_average_mode (ina226_handle_t *handle, ina226_avg_t *mode) |
| get average mode | |
| uint8_t | ina226_set_bus_voltage_conversion_time (ina226_handle_t *handle, ina226_conversion_time_t t) |
| set 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 | |
| uint8_t | ina226_set_shunt_voltage_conversion_time (ina226_handle_t *handle, ina226_conversion_time_t t) |
| set 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 | |
| uint8_t | ina226_set_mode (ina226_handle_t *handle, ina226_mode_t mode) |
| set the mode | |
| uint8_t | ina226_get_mode (ina226_handle_t *handle, ina226_mode_t *mode) |
| get the mode | |
| uint8_t | ina226_read_shunt_voltage (ina226_handle_t *handle, int16_t *raw, float *mV) |
| read the shunt voltage | |
| uint8_t | ina226_read_bus_voltage (ina226_handle_t *handle, uint16_t *raw, float *mV) |
| read the bus voltage | |
| uint8_t | ina226_read_power (ina226_handle_t *handle, uint16_t *raw, float *mW) |
| read the power | |
| uint8_t | ina226_read_current (ina226_handle_t *handle, int16_t *raw, float *mA) |
| read the current | |
| uint8_t | ina226_set_calibration (ina226_handle_t *handle, uint16_t data) |
| set the calibration | |
| uint8_t | ina226_get_calibration (ina226_handle_t *handle, uint16_t *data) |
| get the calibration | |
| uint8_t | ina226_calculate_calibration (ina226_handle_t *handle, uint16_t *calibration) |
| calculate the calibration | |
| uint8_t | ina226_set_mask (ina226_handle_t *handle, ina226_mask_t mask, ina226_bool_t enable) |
| enable or disable mask | |
| uint8_t | ina226_get_mask (ina226_handle_t *handle, ina226_mask_t mask, ina226_bool_t *enable) |
| get mask | |
| uint8_t | ina226_set_conversion_ready_alert_pin (ina226_handle_t *handle, ina226_bool_t enable) |
| enable or disable 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 | |
| uint8_t | ina226_set_alert_polarity_pin (ina226_handle_t *handle, ina226_alert_polarity_t pin) |
| set alert polarity pin | |
| uint8_t | ina226_get_alert_polarity_pin (ina226_handle_t *handle, ina226_alert_polarity_t *pin) |
| get alert polarity pin | |
| uint8_t | ina226_set_alert_latch (ina226_handle_t *handle, ina226_bool_t enable) |
| enable or disable alert latch | |
| uint8_t | ina226_get_alert_latch (ina226_handle_t *handle, ina226_bool_t *enable) |
| get alert latch status | |
| uint8_t | ina226_set_alert_limit (ina226_handle_t *handle, uint16_t reg) |
| set alert limit | |
| uint8_t | ina226_get_alert_limit (ina226_handle_t *handle, uint16_t *reg) |
| get alert limit | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| uint8_t | ina226_power_convert_to_register (ina226_handle_t *handle, float mW, uint16_t *reg) |
| convert the power to the register raw 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 | |
| uint8_t | ina226_get_die_id (ina226_handle_t *handle, uint16_t *device_id, uint8_t *die_revision_id) |
| get the die id | |
ina226 basic driver modules
| #define INA226_READ_TIMEOUT 1000 |
| typedef struct ina226_handle_s ina226_handle_t |
ina226 handle structure definition
| typedef struct ina226_info_s ina226_info_t |
ina226 information structure definition
| enum ina226_address_t |
ina226 address enumeration definition
Definition at line 69 of file driver_ina226.h.
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.
| enum ina226_avg_t |
ina226 average enumeration definition
Definition at line 101 of file driver_ina226.h.
| enum 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.
Definition at line 113 of file driver_ina226.h.
| enum ina226_mask_t |
ina226 mask enumeration definition
Definition at line 155 of file driver_ina226.h.
| enum ina226_mode_t |
ina226 mode enumeration definition
Definition at line 128 of file driver_ina226.h.
| enum ina226_status_t |
ina226 status enumeration definition
Definition at line 143 of file driver_ina226.h.
| 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
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | reg | register raw data |
| [out] | *mV | pointer to a millivolt buffer |
Definition at line 1556 of file driver_ina226.c.
| 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
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | mV | millivolt |
| [out] | *reg | pointer to a register raw buffer |
Definition at line 1529 of file driver_ina226.c.
| uint8_t ina226_calculate_calibration | ( | ina226_handle_t * | handle, |
| uint16_t * | calibration ) |
calculate the calibration
| [in] | *handle | pointer to an ina226 handle structure |
| [out] | *calibration | pointer to a calibration data buffer |
Definition at line 1003 of file driver_ina226.c.
| uint8_t ina226_deinit | ( | ina226_handle_t * | handle | ) |
close the chip
| [in] | *handle | pointer to an ina226 handle structure |
Definition at line 1836 of file driver_ina226.c.
| uint8_t ina226_get_addr_pin | ( | ina226_handle_t * | handle, |
| ina226_address_t * | addr_pin ) |
get the iic address pin
| [in] | *handle | pointer to an ina226 handle structure |
| [out] | *addr_pin | pointer to an address pin buffer |
Definition at line 191 of file driver_ina226.c.
| uint8_t ina226_get_alert_latch | ( | ina226_handle_t * | handle, |
| ina226_bool_t * | enable ) |
get alert latch status
| [in] | *handle | pointer to an ina226 handle structure |
| [out] | *enable | pointer to a bool value buffer |
Definition at line 1368 of file driver_ina226.c.
| uint8_t ina226_get_alert_limit | ( | ina226_handle_t * | handle, |
| uint16_t * | reg ) |
get alert limit
| [in] | *handle | pointer to an ina226 handle structure |
| [out] | *reg | pointer to a register buffer |
Definition at line 1440 of file driver_ina226.c.
| uint8_t ina226_get_alert_polarity_pin | ( | ina226_handle_t * | handle, |
| ina226_alert_polarity_t * | pin ) |
get alert polarity pin
| [in] | *handle | pointer to an ina226 handle structure |
| [out] | *pin | pointer to an alert polarity pin buffer |
Definition at line 1286 of file driver_ina226.c.
| uint8_t ina226_get_average_mode | ( | ina226_handle_t * | handle, |
| ina226_avg_t * | mode ) |
get average mode
| [in] | *handle | pointer to an ina226 handle structure |
| [out] | *mode | pointer to an average mode buffer |
Definition at line 289 of file driver_ina226.c.
| uint8_t ina226_get_bus_voltage_conversion_time | ( | ina226_handle_t * | handle, |
| ina226_conversion_time_t * | t ) |
get bus voltage conversion time
| [in] | *handle | pointer to an ina226 handle structure |
| [out] | *t | pointer to a conversion time buffer |
Definition at line 364 of file driver_ina226.c.
| uint8_t ina226_get_calibration | ( | ina226_handle_t * | handle, |
| uint16_t * | data ) |
get the calibration
| [in] | *handle | pointer to an ina226 handle structure |
| [out] | *data | pointer to a calibration data buffer |
Definition at line 967 of file driver_ina226.c.
| uint8_t ina226_get_conversion_ready_alert_pin | ( | ina226_handle_t * | handle, |
| ina226_bool_t * | enable ) |
get conversion ready alert pin status
| [in] | *handle | pointer to an ina226 handle structure |
| [out] | *enable | pointer to a bool value buffer |
Definition at line 1204 of file driver_ina226.c.
| uint8_t ina226_get_die_id | ( | ina226_handle_t * | handle, |
| uint16_t * | device_id, | ||
| uint8_t * | die_revision_id ) |
get the die id
| [in] | *handle | pointer to an ina226 handle structure |
| [out] | *device_id | pointer to a device id buffer |
| [out] | *die_revision_id | pointer to a die revision id buffer |
Definition at line 569 of file driver_ina226.c.
| uint8_t ina226_get_mask | ( | ina226_handle_t * | handle, |
| ina226_mask_t | mask, | ||
| ina226_bool_t * | enable ) |
get mask
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | mask | set mask |
| [out] | *enable | pointer to a bool value buffer |
Definition at line 1122 of file driver_ina226.c.
| uint8_t ina226_get_mode | ( | ina226_handle_t * | handle, |
| ina226_mode_t * | mode ) |
get the mode
| [in] | *handle | pointer to an ina226 handle structure |
| [out] | *mode | pointer to a chip mode buffer |
Definition at line 531 of file driver_ina226.c.
| uint8_t ina226_get_resistance | ( | ina226_handle_t * | handle, |
| double * | resistance ) |
get the resistance
| [in] | *handle | pointer to an ina226 handle structure |
| [out] | *resistance | pointer to a current sampling resistance value buffer |
Definition at line 149 of file driver_ina226.c.
| uint8_t ina226_get_shunt_voltage_conversion_time | ( | ina226_handle_t * | handle, |
| ina226_conversion_time_t * | t ) |
get shunt voltage conversion time
| [in] | *handle | pointer to an ina226 handle structure |
| [out] | *t | pointer to a conversion time buffer |
Definition at line 439 of file driver_ina226.c.
| uint8_t ina226_info | ( | ina226_info_t * | info | ) |
get chip's information
| [out] | *info | pointer to an ina226 info structure |
Definition at line 1936 of file driver_ina226.c.
| uint8_t ina226_init | ( | ina226_handle_t * | handle | ) |
initialize the chip
| [in] | *handle | pointer to an ina226 handle structure |
Definition at line 1715 of file driver_ina226.c.
| uint8_t ina226_irq_handler | ( | ina226_handle_t * | handle | ) |
irq handler
| [in] | *handle | pointer to an ina226 handle structure |
Definition at line 1636 of file driver_ina226.c.
| uint8_t ina226_power_convert_to_data | ( | ina226_handle_t * | handle, |
| uint16_t | reg, | ||
| float * | mW ) |
convert the register raw data to the power
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | reg | register raw data |
| [out] | *mW | pointer to a milliwatt buffer |
Definition at line 1610 of file driver_ina226.c.
| uint8_t ina226_power_convert_to_register | ( | ina226_handle_t * | handle, |
| float | mW, | ||
| uint16_t * | reg ) |
convert the power to the register raw data
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | mW | milliwatt |
| [out] | *reg | pointer to a register raw buffer |
Definition at line 1583 of file driver_ina226.c.
| uint8_t ina226_read_bus_voltage | ( | ina226_handle_t * | handle, |
| uint16_t * | raw, | ||
| float * | mV ) |
read the bus voltage
| [in] | *handle | pointer to an ina226 handle structure |
| [out] | *raw | pointer to raw data buffer |
| [out] | *mV | pointer to converted data buffer |
Definition at line 703 of file driver_ina226.c.
| uint8_t ina226_read_current | ( | ina226_handle_t * | handle, |
| int16_t * | raw, | ||
| float * | mA ) |
read the current
| [in] | *handle | pointer to an ina226 handle structure |
| [out] | *raw | pointer to raw data buffer |
| [out] | *mA | pointer to converted data buffer |
Definition at line 790 of file driver_ina226.c.
| uint8_t ina226_read_power | ( | ina226_handle_t * | handle, |
| uint16_t * | raw, | ||
| float * | mW ) |
read the power
| [in] | *handle | pointer to an ina226 handle structure |
| [out] | *raw | pointer to raw data buffer |
| [out] | *mW | pointer to converted data buffer |
Definition at line 883 of file driver_ina226.c.
| uint8_t ina226_read_shunt_voltage | ( | ina226_handle_t * | handle, |
| int16_t * | raw, | ||
| float * | mV ) |
read the shunt voltage
| [in] | *handle | pointer to an ina226 handle structure |
| [out] | *raw | pointer to raw data buffer |
| [out] | *mV | pointer to converted data buffer |
Definition at line 610 of file driver_ina226.c.
| uint8_t ina226_set_addr_pin | ( | ina226_handle_t * | handle, |
| ina226_address_t | addr_pin ) |
set the iic address pin
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | addr_pin | address pin |
Definition at line 170 of file driver_ina226.c.
| uint8_t ina226_set_alert_latch | ( | ina226_handle_t * | handle, |
| ina226_bool_t | enable ) |
enable or disable alert latch
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | enable | bool value |
Definition at line 1323 of file driver_ina226.c.
| uint8_t ina226_set_alert_limit | ( | ina226_handle_t * | handle, |
| uint16_t | reg ) |
set alert limit
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | reg | set register |
Definition at line 1405 of file driver_ina226.c.
| uint8_t ina226_set_alert_polarity_pin | ( | ina226_handle_t * | handle, |
| ina226_alert_polarity_t | pin ) |
set alert polarity pin
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | pin | alert polarity pin |
Definition at line 1241 of file driver_ina226.c.
| uint8_t ina226_set_average_mode | ( | ina226_handle_t * | handle, |
| ina226_avg_t | mode ) |
set average mode
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | mode | average mode |
Definition at line 251 of file driver_ina226.c.
| uint8_t ina226_set_bus_voltage_conversion_time | ( | ina226_handle_t * | handle, |
| ina226_conversion_time_t | t ) |
set bus voltage conversion time
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | t | conversion time |
Definition at line 326 of file driver_ina226.c.
| uint8_t ina226_set_calibration | ( | ina226_handle_t * | handle, |
| uint16_t | data ) |
set the calibration
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | data | calibration data |
Definition at line 1040 of file driver_ina226.c.
| uint8_t ina226_set_conversion_ready_alert_pin | ( | ina226_handle_t * | handle, |
| ina226_bool_t | enable ) |
enable or disable conversion ready alert pin
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | enable | bool value |
Definition at line 1159 of file driver_ina226.c.
| uint8_t ina226_set_mask | ( | ina226_handle_t * | handle, |
| ina226_mask_t | mask, | ||
| ina226_bool_t | enable ) |
enable or disable mask
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | mask | set mask |
| [in] | enable | bool value |
Definition at line 1076 of file driver_ina226.c.
| uint8_t ina226_set_mode | ( | ina226_handle_t * | handle, |
| ina226_mode_t | mode ) |
set the mode
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | mode | chip mode |
Definition at line 476 of file driver_ina226.c.
| uint8_t ina226_set_resistance | ( | ina226_handle_t * | handle, |
| double | resistance ) |
set the resistance
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | resistance | current sampling resistance value |
Definition at line 128 of file driver_ina226.c.
| uint8_t ina226_set_shunt_voltage_conversion_time | ( | ina226_handle_t * | handle, |
| ina226_conversion_time_t | t ) |
set shunt voltage conversion time
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | t | conversion time |
Definition at line 401 of file driver_ina226.c.
| 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
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | reg | register raw data |
| [out] | *mV | pointer to a millivolt buffer |
Definition at line 1502 of file driver_ina226.c.
| 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
| [in] | *handle | pointer to an ina226 handle structure |
| [in] | mV | millivolt |
| [out] | *reg | pointer to a register raw buffer |
Definition at line 1475 of file driver_ina226.c.
| uint8_t ina226_soft_reset | ( | ina226_handle_t * | handle | ) |
soft reset the chip
| [in] | *handle | pointer to an ina226 handle structure |
Definition at line 213 of file driver_ina226.c.