![]() |
LibDriver INA226
|
driver ina226 source file More...
Go to the source code of this file.
Macros | |
| #define | CHIP_NAME "Texas Instruments INA226" |
| chip information definition | |
| #define | MANUFACTURER_NAME "Texas Instruments" |
| #define | SUPPLY_VOLTAGE_MIN 2.7f |
| #define | SUPPLY_VOLTAGE_MAX 5.5f |
| #define | MAX_CURRENT 0.33f |
| #define | TEMPERATURE_MIN -40.0f |
| #define | TEMPERATURE_MAX 125.0f |
| #define | DRIVER_VERSION 1000 |
| #define | INA226_REG_CONF 0x00 |
| chip register definition | |
| #define | INA226_REG_SHUNT_VOLTAGE 0x01 |
| #define | INA226_REG_BUS_VOLTAGE 0x02 |
| #define | INA226_REG_POWER 0x03 |
| #define | INA226_REG_CURRENT 0x04 |
| #define | INA226_REG_CALIBRATION 0x05 |
| #define | INA226_REG_MASK 0x06 |
| #define | INA226_REG_ALERT_LIMIT 0x07 |
| #define | INA226_REG_MANUFACTURER 0xFE |
| #define | INA226_REG_DIE 0xFF |
Functions | |
| 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_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_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_get_die_id (ina226_handle_t *handle, uint16_t *device_id, uint8_t *die_revision_id) |
| get the die id | |
| 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_current (ina226_handle_t *handle, int16_t *raw, float *mA) |
| read the current | |
| uint8_t | ina226_read_power (ina226_handle_t *handle, uint16_t *raw, float *mW) |
| read the power | |
| 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_calibration (ina226_handle_t *handle, uint16_t data) |
| set 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_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_set_reg (ina226_handle_t *handle, uint8_t reg, uint16_t data) |
| set the chip register | |
| uint8_t | ina226_get_reg (ina226_handle_t *handle, uint8_t reg, uint16_t *data) |
| get the chip register | |
| uint8_t | ina226_info (ina226_info_t *info) |
| get chip's information | |
driver ina226 source file
Copyright (c) 2015 - present LibDriver All rights reserved
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| Date | Version | Author | Description |
|---|---|---|---|
| 2025/01/29 | 1.0 | Shifeng Li | first upload |
Definition in file driver_ina226.c.
| #define CHIP_NAME "Texas Instruments INA226" |
| #define DRIVER_VERSION 1000 |
driver version
Definition at line 50 of file driver_ina226.c.
| #define INA226_REG_ALERT_LIMIT 0x07 |
alert limit register
Definition at line 62 of file driver_ina226.c.
| #define INA226_REG_BUS_VOLTAGE 0x02 |
bus voltage register
Definition at line 57 of file driver_ina226.c.
| #define INA226_REG_CALIBRATION 0x05 |
calibration register
Definition at line 60 of file driver_ina226.c.
| #define INA226_REG_CONF 0x00 |
| #define INA226_REG_CURRENT 0x04 |
current register
Definition at line 59 of file driver_ina226.c.
| #define INA226_REG_DIE 0xFF |
die id register
Definition at line 64 of file driver_ina226.c.
| #define INA226_REG_MANUFACTURER 0xFE |
manufacturer id register
Definition at line 63 of file driver_ina226.c.
| #define INA226_REG_MASK 0x06 |
mask register
Definition at line 61 of file driver_ina226.c.
| #define INA226_REG_POWER 0x03 |
power register
Definition at line 58 of file driver_ina226.c.
| #define INA226_REG_SHUNT_VOLTAGE 0x01 |
shunt voltage register
Definition at line 56 of file driver_ina226.c.
| #define MANUFACTURER_NAME "Texas Instruments" |
manufacturer name
Definition at line 44 of file driver_ina226.c.
| #define MAX_CURRENT 0.33f |
chip max current
Definition at line 47 of file driver_ina226.c.
| #define SUPPLY_VOLTAGE_MAX 5.5f |
chip max supply voltage
Definition at line 46 of file driver_ina226.c.
| #define SUPPLY_VOLTAGE_MIN 2.7f |
chip min supply voltage
Definition at line 45 of file driver_ina226.c.
| #define TEMPERATURE_MAX 125.0f |
chip max operating temperature
Definition at line 49 of file driver_ina226.c.
| #define TEMPERATURE_MIN -40.0f |
chip min operating temperature
Definition at line 48 of file driver_ina226.c.