Power Monitor

[中文]

Power Monitor IC (Integrated Circuit) is an integrated circuit used for monitoring and managing power supply. It can monitor various parameters of the power supply in real time, such as voltage, current, and power, and provide this information for system use. Power Monitor ICs are crucial in various applications, including computers, power management systems, consumer electronics, industrial control systems, and communication devices.

Adapted Products

Name

Function

Bus

Vendor

Datasheet

HAL

INA236 | 16-Bit Current, Voltage, and Power Monitor IC

I2C

TI

INA236 Datasheet

x

API Reference

The following API implements hardware abstraction for power monitor sensors. Users can directly call this layer of code to write sensor applications.

Header File

Functions

esp_err_t ina236_create(ina236_handle_t *handle, ina236_config_t *config)

Create and init object and return a handle.

Parameters
  • handle – Pointer to handle

  • config – Pointer to configuration

Returns

  • ESP_OK Success

  • Others Fail

esp_err_t ina236_delete(ina236_handle_t handle)

Deinit object and free memory.

Parameters

handle – ina236 handle Handle

Returns

  • ESP_OK Success

  • Others Fail

esp_err_t ina236_get_voltage(ina236_handle_t handle, float *volt)

Get the Voltage on the bus.

Parameters
  • handle – object handle of ina236

  • volt – Voltage value in volts

Returns

  • ESP_OK Success

  • Others Fail

esp_err_t ina236_get_current(ina236_handle_t handle, float *curr)

Get the Current on the bus.

Parameters
  • handle – object handle of ina236

  • curr – Current value in A

Returns

  • ESP_OK Success

  • Others Fail

esp_err_t ina236_clear_mask(ina236_handle_t handle)

Clear the mask of the alert pin.

Parameters

handle – object handle of ina236

Returns

  • ESP_OK Success

  • Others Fail

Structures

struct ina236_config_t

ina236 configuration structure

Public Members

i2c_bus_handle_t bus

I2C bus object

bool alert_en

Enable alert callback

uint8_t dev_addr

I2C device address

uint8_t alert_pin

Alert pin number

int236_alert_cb_t alert_cb

Alert callback function

Macros

INA236_I2C_ADDRESS_DEFAULT

Type Definitions

typedef struct ina236_t *ina236_handle_t

INA236 handle.

typedef void (*int236_alert_cb_t)(void *arg)

ina236 alert callback function