powermonitor2  2.1.0.0
Data Structures | Macros | Enumerations | Functions
powermonitor2.h File Reference

This file contains API for Power Monitor 2 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  powermonitor2_data_t
 Power Monitor 2 Click data object. More...
 
struct  powermonitor2_t
 Power Monitor 2 Click context object. More...
 
struct  powermonitor2_cfg_t
 Power Monitor 2 Click configuration object. More...
 

Macros

#define POWERMONITOR2_REG_CONFIGURATION   0x00
 Power Monitor 2 register list. More...
 
#define POWERMONITOR2_REG_SHUNT_VOLTAGE   0x01
 
#define POWERMONITOR2_REG_BUS_VOLTAGE   0x02
 
#define POWERMONITOR2_REG_POWER   0x03
 
#define POWERMONITOR2_REG_CURRENT   0x04
 
#define POWERMONITOR2_REG_CALIBRATION   0x05
 
#define POWERMONITOR2_CONFIGURATION_RST   0x8000
 Power Monitor 2 CONFIGURATION register setting. More...
 
#define POWERMONITOR2_CONFIGURATION_BRNG_16V   0x0000
 
#define POWERMONITOR2_CONFIGURATION_BRNG_32V   0x2000
 
#define POWERMONITOR2_CONFIGURATION_BRNG_MASK   0x2000
 
#define POWERMONITOR2_CONFIGURATION_PGA_DIV_1   0x0000
 
#define POWERMONITOR2_CONFIGURATION_PGA_DIV_2   0x0800
 
#define POWERMONITOR2_CONFIGURATION_PGA_DIV_4   0x1000
 
#define POWERMONITOR2_CONFIGURATION_PGA_DIV_8   0x1800
 
#define POWERMONITOR2_CONFIGURATION_PGA_MASK   0x1800
 
#define POWERMONITOR2_CONFIGURATION_BADC_84_US   0x0000
 
#define POWERMONITOR2_CONFIGURATION_BADC_148_US   0x0080
 
#define POWERMONITOR2_CONFIGURATION_BADC_276_US   0x0100
 
#define POWERMONITOR2_CONFIGURATION_BADC_532_US   0x0180
 
#define POWERMONITOR2_CONFIGURATION_BADC_1_06_MS   0x0480
 
#define POWERMONITOR2_CONFIGURATION_BADC_2_13_MS   0x0500
 
#define POWERMONITOR2_CONFIGURATION_BADC_4_26_MS   0x0580
 
#define POWERMONITOR2_CONFIGURATION_BADC_8_51_MS   0x0600
 
#define POWERMONITOR2_CONFIGURATION_BADC_17_02_MS   0x0680
 
#define POWERMONITOR2_CONFIGURATION_BADC_34_05_MS   0x0700
 
#define POWERMONITOR2_CONFIGURATION_BADC_68_10_MS   0x0780
 
#define POWERMONITOR2_CONFIGURATION_BADC_MASK   0x0780
 
#define POWERMONITOR2_CONFIGURATION_SADC_84_US   0x0000
 
#define POWERMONITOR2_CONFIGURATION_SADC_148_US   0x0008
 
#define POWERMONITOR2_CONFIGURATION_SADC_276_US   0x0010
 
#define POWERMONITOR2_CONFIGURATION_SADC_532_US   0x0018
 
#define POWERMONITOR2_CONFIGURATION_SADC_1_06_MS   0x0048
 
#define POWERMONITOR2_CONFIGURATION_SADC_2_13_MS   0x0050
 
#define POWERMONITOR2_CONFIGURATION_SADC_4_26_MS   0x0058
 
#define POWERMONITOR2_CONFIGURATION_SADC_8_51_MS   0x0060
 
#define POWERMONITOR2_CONFIGURATION_SADC_17_02_MS   0x0068
 
#define POWERMONITOR2_CONFIGURATION_SADC_34_05_MS   0x0070
 
#define POWERMONITOR2_CONFIGURATION_SADC_68_10_MS   0x0078
 
#define POWERMONITOR2_CONFIGURATION_SADC_MASK   0x0078
 
#define POWERMONITOR2_CONFIGURATION_MODE_PDOWN   0x0000
 
#define POWERMONITOR2_CONFIGURATION_MODE_SHT_V_TRG   0x0001
 
#define POWERMONITOR2_CONFIGURATION_MODE_BUS_V_TRG   0x0002
 
#define POWERMONITOR2_CONFIGURATION_MODE_SHT_BUS_V_TRG   0x0003
 
#define POWERMONITOR2_CONFIGURATION_MODE_ADC_OFF   0x0004
 
#define POWERMONITOR2_CONFIGURATION_MODE_SHT_V_CONT   0x0005
 
#define POWERMONITOR2_CONFIGURATION_MODE_BUS_V_CONT   0x0006
 
#define POWERMONITOR2_CONFIGURATION_MODE_SHT_BUS_V_CONT   0x0007
 
#define POWERMONITOR2_CONFIGURATION_MODE_MASK   0x0007
 
#define POWERMONITOR2_BUS_VOLTAGE_CNVR   0x0002
 Power Monitor 2 BUS_VOLTAGE register setting. More...
 
#define POWERMONITOR2_BUS_VOLTAGE_OVF   0x0001
 
#define POWERMONITOR2_SHUNT_LSB_MV   0.01f
 Power Monitor 2 calculation setting. More...
 
#define POWERMONITOR2_BUS_V_LSB_V   0.004f
 
#define POWERMONITOR2_POWER_LSB_W   0.02f
 
#define POWERMONITOR2_CURRENT_LSB_A   0.001f
 
#define POWERMONITOR2_CALIBRATION_FOR_SHUNT_0_01_OHM   4096
 
#define POWERMONITOR2_DEFAULT_NUM_CONV   20
 
#define POWERMONITOR2_DEVICE_ADDRESS_3V3_0   0x40
 Power Monitor 2 device address setting. More...
 
#define POWERMONITOR2_DEVICE_ADDRESS_3V3_1   0x44
 
#define POWERMONITOR2_DEVICE_ADDRESS_5V_0   0x41
 
#define POWERMONITOR2_DEVICE_ADDRESS_5V_1   0x45
 
#define POWERMONITOR2_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping. More...
 

Enumerations

enum  powermonitor2_return_value_t { POWERMONITOR2_OK = 0, POWERMONITOR2_ERROR = -1 }
 Power Monitor 2 Click return value data. More...
 

Functions

void powermonitor2_cfg_setup (powermonitor2_cfg_t *cfg)
 Power Monitor 2 configuration object setup function. More...
 
err_t powermonitor2_init (powermonitor2_t *ctx, powermonitor2_cfg_t *cfg)
 Power Monitor 2 initialization function. More...
 
err_t powermonitor2_default_cfg (powermonitor2_t *ctx)
 Power Monitor 2 default configuration function. More...
 
err_t powermonitor2_set_address (powermonitor2_t *ctx, uint8_t slave_address)
 Power Monitor 2 set slave address function. More...
 
err_t powermonitor2_write_reg (powermonitor2_t *ctx, uint8_t reg, uint16_t data_in)
 Power Monitor 2 write reg function. More...
 
err_t powermonitor2_read_reg (powermonitor2_t *ctx, uint8_t reg, uint16_t *data_out)
 Power Monitor 2 read reg function. More...
 
err_t powermonitor2_read_data (powermonitor2_t *ctx, powermonitor2_data_t *data_out)
 Power Monitor 2 read data function. More...
 
err_t powermonitor2_read_data_avg (powermonitor2_t *ctx, uint16_t num_conv, powermonitor2_data_t *data_out)
 Power Monitor 2 read data avg function. More...
 

Detailed Description

This file contains API for Power Monitor 2 Click Driver.

Enumeration Type Documentation

◆ powermonitor2_return_value_t

Power Monitor 2 Click return value data.

Predefined enum values for driver return values.

Enumerator
POWERMONITOR2_OK 
POWERMONITOR2_ERROR