powermonitor 2.0.0.0
powermonitor.h File Reference

This file contains API for Power Monitor Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  powermonitor_t
 Power Monitor Click context object. More...
 
struct  powermonitor_cfg_t
 Power Monitor Click configuration object. More...
 
struct  powermonitor_dev_cfg_t
 Power Monitor Click device settings object. More...
 
struct  powermonitor_adc_cfg_t
 Power Monitor Click ADC configuration object. More...
 

Macros

#define POWERMONITOR_REG_CONFIG   0x00
 Power Monitor description register.
 
#define POWERMONITOR_REG_ADCCONFIG   0x01
 
#define POWERMONITOR_REG_SHUNT_CAL   0x02
 
#define POWERMONITOR_REG_SHUNT_TEMPCO   0x03
 
#define POWERMONITOR_REG_VSHUNT   0x04
 
#define POWERMONITOR_REG_VBUS   0x05
 
#define POWERMONITOR_REG_DIETEMP   0x06
 
#define POWERMONITOR_REG_CURRENT   0x07
 
#define POWERMONITOR_REG_POWER   0x08
 
#define POWERMONITOR_REG_ENERGY   0x09
 
#define POWERMONITOR_REG_CHARGE   0x0A
 
#define POWERMONITOR_REG_DIAG_ALR   0x0B
 
#define POWERMONITOR_REG_SOVL   0x0C
 
#define POWERMONITOR_REG_SUVL   0x0D
 
#define POWERMONITOR_REG_BOVL   0x0E
 
#define POWERMONITOR_REG_BUVL   0x0F
 
#define POWERMONITOR_REG_TEMP_LIMIT   0x10
 
#define POWERMONITOR_REG_PWR_LIMIT   0x11
 
#define POWERMONITOR_REG_MANUFACTURER_ID   0x3E
 
#define POWERMONITOR_REG_DEVICE_ID   0x3F
 
#define POWERMONITOR_RST_RESET_BIT   0x80
 Power Monitor description setting.
 
#define POWERMONITOR_RSTACC_NORMAL_OPERATION   0x00
 
#define POWERMONITOR_RSTACC_CLEARS_ENERGY_CHARGE_REG   0x01
 
#define POWERMONITOR_CONVDLY_0_s   0x00
 
#define POWERMONITOR_TEMPCOMP_DISABLED   0x00
 
#define POWERMONITOR_TEMPCOMP_ENABLED   0x01
 
#define POWERMONITOR_ADCRANGE_163_84_mV   0x00
 
#define POWERMONITOR_ADCRANGE_40_96_mV   0x01
 
#define POWERMONITOR_MODE_SINGLE_SHOT_SHUTDOWN   0x00
 
#define POWERMONITOR_MODE_SINGLE_SHOT_BUS_VOLTAGE   0x01
 
#define POWERMONITOR_MODE_SINGLE_SHOT_BUS_VTG   0x01
 
#define POWERMONITOR_MODE_SINGLE_SHOT_SHUNT_VTG   0x02
 
#define POWERMONITOR_MODE_SINGLE_SHOT_SHUNT_BUS_VTG   0x03
 
#define POWERMONITOR_MODE_SINGLE_TEMPERATURE   0x04
 
#define POWERMONITOR_MODE_SINGLE_SHOT_TEMP_BUS_VTG   0x05
 
#define POWERMONITOR_MODE_SINGLE_SHOT_TEMP_SHUNT_VTG   0x06
 
#define POWERMONITOR_MODE_SINGLE_SHOT_TEMP_SHUNT_BUS_VTG   0x07
 
#define POWERMONITOR_MODE_CONTINUOUS_SHOT_BUS_VOLTAGE   0x08
 
#define POWERMONITOR_MODE_CONTINUOUS_SHOT_BUS_VTG   0x09
 
#define POWERMONITOR_MODE_CONTINUOUS_SHOT_SHUNT_VTG   0x0A
 
#define POWERMONITOR_MODE_CONTINUOUS_SHOT_SHUNT_BUS_VTG   0x0B
 
#define POWERMONITOR_MODE_CONTINUOUS_TEMPERATURE   0x0C
 
#define POWERMONITOR_MODE_CONTINUOUS_SHOT_TEMP_BUS_VTG   0x0D
 
#define POWERMONITOR_MODE_CONTINUOUS_SHOT_TEMP_SHUNT_VTG   0x0E
 
#define POWERMONITOR_MODE_CONTINUOUS_SHOT_TEMP_SHUNT_BUS_VTG   0x0F
 
#define POWERMONITOR_VBUSCT_CONVERSION_TIME_50_nS   0x00
 
#define POWERMONITOR_VBUSCT_CONVERSION_TIME_84_nS   0x01
 
#define POWERMONITOR_VBUSCT_CONVERSION_TIME_150_nS   0x02
 
#define POWERMONITOR_VBUSCT_CONVERSION_TIME_280_nS   0x03
 
#define POWERMONITOR_VBUSCT_CONVERSION_TIME_540_nS   0x04
 
#define POWERMONITOR_VBUSCT_CONVERSION_TIME_1052_nS   0x05
 
#define POWERMONITOR_VBUSCT_CONVERSION_TIME_2074_nS   0x06
 
#define POWERMONITOR_VBUSCT_CONVERSION_TIME_4120_nS   0x07
 
#define POWERMONITOR_VSHCT_CONVERSION_TIME_50_nS   0x00
 
#define POWERMONITOR_VSHCT_CONVERSION_TIME_84_nS   0x01
 
#define POWERMONITOR_VSHCT_CONVERSION_TIME_150_nS   0x02
 
#define POWERMONITOR_VSHCT_CONVERSION_TIME_280_nS   0x03
 
#define POWERMONITOR_VSHCT_CONVERSION_TIME_540_nS   0x04
 
#define POWERMONITOR_VSHCT_CONVERSION_TIME_1052_nS   0x05
 
#define POWERMONITOR_VSHCT_CONVERSION_TIME_2074_nS   0x06
 
#define POWERMONITOR_VSHCT_CONVERSION_TIME_4120_nS   0x07
 
#define POWERMONITOR_VTCT_CONVERSION_TIME_50_nS   0x00
 
#define POWERMONITOR_VTCT_CONVERSION_TIME_84_nS   0x01
 
#define POWERMONITOR_VTCT_CONVERSION_TIME_150_nS   0x02
 
#define POWERMONITOR_VTCT_CONVERSION_TIME_280_nS   0x03
 
#define POWERMONITOR_VTCT_CONVERSION_TIME_540_nS   0x04
 
#define POWERMONITOR_VTCT_CONVERSION_TIME_1052_nS   0x05
 
#define POWERMONITOR_VTCT_CONVERSION_TIME_2074_nS   0x06
 
#define POWERMONITOR_VTCT_CONVERSION_TIME_4120_nS   0x07
 
#define POWERMONITOR_AVG_AVERAGING_COUNT_1   0x00
 
#define POWERMONITOR_AVG_AVERAGING_COUNT_4   0x01
 
#define POWERMONITOR_AVG_AVERAGING_COUNT_16   0x02
 
#define POWERMONITOR_AVG_AVERAGING_COUNT_64   0x03
 
#define POWERMONITOR_AVG_AVERAGING_COUNT_128   0x04
 
#define POWERMONITOR_AVG_AVERAGING_COUNT_256   0x05
 
#define POWERMONITOR_AVG_AVERAGING_COUNT_512   0x06
 
#define POWERMONITOR_AVG_AVERAGING_COUNT_1024   0x07
 
#define POWERMONITOR_SET_DEV_ADDR_GND_GND   0x40
 Power Monitor device address setting.
 
#define POWERMONITOR_SET_DEV_ADDR_GND_VS   0x41
 
#define POWERMONITOR_SET_DEV_ADDR_GND_SDA   0x42
 
#define POWERMONITOR_SET_DEV_ADDR_GND_SCL   0x43
 
#define POWERMONITOR_SET_DEV_ADDR_VS_GND   0x44
 
#define POWERMONITOR_SET_DEV_ADDR_VS_VS   0x45
 
#define POWERMONITOR_SET_DEV_ADDR_VS_SDA   0x46
 
#define POWERMONITOR_SET_DEV_ADDR_VS_SCL   0x47
 
#define POWERMONITOR_SET_DEV_ADDR_SDA_GND   0x48
 
#define POWERMONITOR_SET_DEV_ADDR_SDA_VS   0x49
 
#define POWERMONITOR_SET_DEV_ADDR_SDA_SDA   0x4A
 
#define POWERMONITOR_SET_DEV_ADDR_SDA_SCL   0x4B
 
#define POWERMONITOR_SET_DEV_ADDR_SCL_GND   0x4C
 
#define POWERMONITOR_SET_DEV_ADDR_SCL_VS   0x4D
 
#define POWERMONITOR_SET_DEV_ADDR_SCL_SDA   0x4E
 
#define POWERMONITOR_SET_DEV_ADDR_SCL_SCL   0x4F
 
#define POWERMONITOR_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  powermonitor_return_value_t { POWERMONITOR_OK = 0 , POWERMONITOR_ERROR = -1 }
 Power Monitor Click return value data. More...
 

Functions

void powermonitor_cfg_setup (powermonitor_cfg_t *cfg)
 Power Monitor configuration object setup function.
 
err_t powermonitor_init (powermonitor_t *ctx, powermonitor_cfg_t *cfg)
 Power Monitor initialization function.
 
err_t powermonitor_default_cfg (powermonitor_t *ctx)
 Power Monitor default configuration function.
 
err_t powermonitor_generic_write (powermonitor_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 Power Monitor I2C writing function.
 
err_t powermonitor_generic_read (powermonitor_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 Power Monitor I2C reading function.
 
err_t powermonitor_soft_reset (powermonitor_t *ctx)
 Power Monitor software reset function.
 
err_t powermonitor_set_configuration (powermonitor_t *ctx, powermonitor_dev_cfg_t cfg_data)
 Power Monitor set configuration function.
 
err_t powermonitor_get_configuration (powermonitor_t *ctx, powermonitor_dev_cfg_t *cfg_data)
 Power Monitor get configuration function.
 
err_t powermonitor_set_adc_config (powermonitor_t *ctx, powermonitor_adc_cfg_t adc_cfg)
 Power Monitor set ADC configuration function.
 
err_t powermonitor_get_adc_configu (powermonitor_t *ctx, powermonitor_adc_cfg_t *adc_cfg)
 Power Monitor get ADC configuration function.
 
err_t powermonitor_set_bus_overvoltage_threshold (powermonitor_t *ctx, float bovl)
 Power Monitor set bus overvoltage threshold function.
 
err_t powermonitor_set_bus_undervoltage_threshold (powermonitor_t *ctx, float buvl)
 Power Monitor set bus undervoltage threshold function.
 
err_t powermonitor_set_shunt_overvoltage_threshold (powermonitor_t *ctx, float sovl)
 Power Monitor set shunt overvoltage threshold function.
 
err_t powermonitor_set_shunt_undervoltage_threshold (powermonitor_t *ctx, float suvl)
 Power Monitor set shunt undervoltage threshold function.
 
err_t powermonitor_get_vshunt (powermonitor_t *ctx, float *vshunt)
 Power Monitor get shunt voltage function.
 
err_t powermonitor_get_vbus (powermonitor_t *ctx, float *vbus)
 Power Monitor get bus voltage function.
 
err_t powermonitor_get_temperature (powermonitor_t *ctx, float *temperature)
 Power Monitor get temperature function.
 
err_t powermonitor_get_current (powermonitor_t *ctx, float *current)
 Power Monitor get current function.
 
err_t powermonitor_get_power (powermonitor_t *ctx, float *power)
 Power Monitor get power function.
 
err_t powermonitor_get_energy_data (powermonitor_t *ctx, uint8_t *energy_data)
 Power Monitor get energy data function.
 
err_t powermonitor_get_energy (powermonitor_t *ctx, float *energy)
 Power Monitor get energy function.
 
err_t powermonitor_get_id (powermonitor_t *ctx, uint8_t *manufacturer_id, uint16_t *die_id, uint8_t *rev_id)
 Power Monitor get device ID function.
 
err_t powermonitor_get_alert (powermonitor_t *ctx)
 Power Monitor get alert function.
 

Detailed Description

This file contains API for Power Monitor Click Driver.

Enumeration Type Documentation

◆ powermonitor_return_value_t

Power Monitor Click return value data.

Predefined enum values for driver return values.

Enumerator
POWERMONITOR_OK 
POWERMONITOR_ERROR