![]() |
LibDriver INA226
|
driver ina226 header file More...
#include <stdio.h>#include <stdint.h>#include <string.h>Go to the source code of this file.
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 | |
| #define | DRIVER_INA226_LINK_INIT(HANDLE, STRUCTURE) |
| initialize ina226_handle_t structure | |
| #define | DRIVER_INA226_LINK_IIC_INIT(HANDLE, FUC) |
| link iic_init function | |
| #define | DRIVER_INA226_LINK_IIC_DEINIT(HANDLE, FUC) |
| link iic_deinit function | |
| #define | DRIVER_INA226_LINK_IIC_READ(HANDLE, FUC) |
| link iic_read function | |
| #define | DRIVER_INA226_LINK_IIC_WRITE(HANDLE, FUC) |
| link iic_write function | |
| #define | DRIVER_INA226_LINK_DELAY_MS(HANDLE, FUC) |
| link delay_ms function | |
| #define | DRIVER_INA226_LINK_DEBUG_PRINT(HANDLE, FUC) |
| link debug_print function | |
| #define | DRIVER_INA226_LINK_RECEIVE_CALLBACK(HANDLE, FUC) |
| link receive_callback function | |
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 | |
| 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 | |
driver ina226 header 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.h.