![]() |
LibDriver INA226
1.0.0
INA226 full-featured driver
|
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 More... | |
#define | DRIVER_INA226_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE)) |
initialize ina226_handle_t structure More... | |
#define | DRIVER_INA226_LINK_IIC_INIT(HANDLE, FUC) (HANDLE)->iic_init = FUC |
link iic_init function More... | |
#define | DRIVER_INA226_LINK_IIC_DEINIT(HANDLE, FUC) (HANDLE)->iic_deinit = FUC |
link iic_deinit function More... | |
#define | DRIVER_INA226_LINK_IIC_READ(HANDLE, FUC) (HANDLE)->iic_read = FUC |
link iic_read function More... | |
#define | DRIVER_INA226_LINK_IIC_WRITE(HANDLE, FUC) (HANDLE)->iic_write = FUC |
link iic_write function More... | |
#define | DRIVER_INA226_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC |
link delay_ms function More... | |
#define | DRIVER_INA226_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC |
link debug_print function More... | |
#define | DRIVER_INA226_LINK_RECEIVE_CALLBACK(HANDLE, FUC) (HANDLE)->receive_callback = FUC |
link receive_callback function 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... | |
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... | |
uint8_t | ina226_set_reg (ina226_handle_t *handle, uint8_t reg, uint16_t data) |
set the chip register More... | |
uint8_t | ina226_get_reg (ina226_handle_t *handle, uint8_t reg, uint16_t *data) |
get the chip register More... | |
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.