vcpmonitor2 2.0.0.0
vcpmonitor2.h File Reference

This file contains API for VCP 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  vcpmonitor2_t
 Click ctx object definition. More...
 
struct  vcpmonitor2_cfg_t
 Click configuration structure definition. More...
 

Macros

#define VCPMONITOR2_MAP_MIKROBUS(cfg, mikrobus)
 
#define VCPMONITOR2_RETVAL   uint8_t
 
#define VCPMONITOR2_OK   0x00
 
#define VCPMONITOR2_INIT_ERROR   0xFF
 
#define VCPMONITOR2_DEVICE_SLAVE_ADDR_GND   0x40
 
#define VCPMONITOR2_DEVICE_SLAVE_ADDR_VCC   0x41
 
#define VCPMONITOR2_DEVICE_SLAVE_ADDR_SCL   0x42
 
#define VCPMONITOR2_DEVICE_SLAVE_ADDR_SDA   0x43
 
#define VCPMONITOR2_STATUS_ADDR_GND_GND   0x70
 
#define VCPMONITOR2_STATUS_ADDR_VCC_GND   0x72
 
#define VCPMONITOR2_STATUS_ADDR_GND_VCC   0x71
 
#define VCPMONITOR2_STATUS_ADDR_VCC_VCC   0x73
 
#define VCPMONITOR2_ALERT_REG_INPUT   0x00
 
#define VCPMONITOR2_ALERT_REG_POLARITY   0x02
 
#define VCPMONITOR2_ALERT_REG_CONFIG   0x03
 
#define VCPMONITOR2_REG_CONFIGURATION   0x00
 
#define VCPMONITOR2_REG_CH_1_SHUNT_VOLT   0x01
 
#define VCPMONITOR2_REG_CH_1_BUS_VOLT   0x02
 
#define VCPMONITOR2_REG_CH_2_SHUNT_VOLT   0x03
 
#define VCPMONITOR2_REG_CH_2_BUS_VOLT   0x04
 
#define VCPMONITOR2_REG_CH_3_SHUNT_VOLT   0x05
 
#define VCPMONITOR2_REG_CH_3_BUS_VOLT   0x06
 
#define VCPMONITOR2_REG_CH_1_CRITICAL_ALT   0x07
 
#define VCPMONITOR2_REG_CH_1_WARNING_ALT   0x08
 
#define VCPMONITOR2_REG_CH_2_CRITICAL_ALT   0x09
 
#define VCPMONITOR2_REG_CH_2_WARNING_ALT   0x0A
 
#define VCPMONITOR2_REG_CH_3_CRITICAL_ALT   0x0B
 
#define VCPMONITOR2_REG_CH_3_WARNING_ALT   0x0C
 
#define VCPMONITOR2_REG_SHUNT_VOLT_SUM   0x0D
 
#define VCPMONITOR2_REG_SHUNT_VOLT_SUM_LIMIT   0x0E
 
#define VCPMONITOR2_REG_MASK_ENABLE   0x0F
 
#define VCPMONITOR2_REG_PWR_UPPER_LIMIT   0x10
 
#define VCPMONITOR2_REG_PWR_LOWER_LIMIT   0x11
 
#define VCPMONITOR2_REG_MANUFACTURER_ID   0xFE
 
#define VCPMONITOR2_REG_DIE_ID   0xFF
 
#define VCPMONITOR2_DEF_MANUFACTURE_ID   0x5449
 
#define VCPMONITOR2_DEF_DIE_ID   0x3220
 
#define VCPMONITOR2_DEF_PWR_LOWER_LIMIT   0x2328
 
#define VCPMONITOR2_DEF_PWR_UPPER_LIMIT   0x2F10
 
#define VCPMONITOR2_DEF_MASK_ENABLE   0x0002
 
#define VCPMONITOR2_DEF_SHUNT_VOLT_SUM_LIMIT   0x7FFE
 
#define VCPMONITOR2_DEF_CONFIGURATION   0x7127
 
#define VCPMONITOR2_DEF_CH_1234_ALERT   0x7FF8
 
#define VCPMONITOR2_CFG_SW_RESET   0x8000
 
#define VCPMONITOR2_CFG_CH_1_ENABLE   0x4000
 
#define VCPMONITOR2_CFG_CH_1_DISABLE   0x0000
 
#define VCPMONITOR2_CFG_CH_2_ENABLE   0x2000
 
#define VCPMONITOR2_CFG_CH_2_DISABLE   0x0000
 
#define VCPMONITOR2_CFG_CH_3_ENABLE   0x1000
 
#define VCPMONITOR2_CFG_CH_3_DISABLE   0x0000
 
#define VCPMONITOR2_CFG_AVG_1   0x0000
 
#define VCPMONITOR2_CFG_AVG_4   0x0200
 
#define VCPMONITOR2_CFG_AVG_16   0x0400
 
#define VCPMONITOR2_CFG_AVG_64   0x0600
 
#define VCPMONITOR2_CFG_AVG_128   0x0800
 
#define VCPMONITOR2_CFG_AVG_256   0x0A00
 
#define VCPMONITOR2_CFG_AVG_512   0x0C00
 
#define VCPMONITOR2_CFG_AVG_1024   0x0D00
 
#define VCPMONITOR2_CFG_VBUS_CT_140us   0x0000
 
#define VCPMONITOR2_CFG_VBUS_CT_204us   0x0040
 
#define VCPMONITOR2_CFG_VBUS_CT_332us   0x0080
 
#define VCPMONITOR2_CFG_VBUS_CT_588us   0x00C0
 
#define VCPMONITOR2_CFG_VBUS_CT_1100us   0x0100
 
#define VCPMONITOR2_CFG_VBUS_CT_2116us   0x0140
 
#define VCPMONITOR2_CFG_VBUS_CT_4156us   0x0180
 
#define VCPMONITOR2_CFG_VBUS_CT_8244us   0x01C0
 
#define VCPMONITOR2_CFG_VSH_CT_140us   0x0000
 
#define VCPMONITOR2_CFG_VSH_CT_204us   0x0008
 
#define VCPMONITOR2_CFG_VSH_CT_332us   0x0010
 
#define VCPMONITOR2_CFG_VSH_CT_588us   0x0018
 
#define VCPMONITOR2_CFG_VSH_CT_1100us   0x0020
 
#define VCPMONITOR2_CFG_VSH_CT_2116us   0x0028
 
#define VCPMONITOR2_CFG_VSH_CT_4156us   0x0030
 
#define VCPMONITOR2_CFG_VSH_CT_8244us   0x0038
 
#define VCPMONITOR2_CFG_MODE_POWER_DOWN   0x0000
 
#define VCPMONITOR2_CFG_MODE_SS_SHUNT_VOLT   0x0001
 
#define VCPMONITOR2_CFG_MODE_SS_BUS_VOLT   0x0002
 
#define VCPMONITOR2_CFG_MODE_SS_SHUNT_BUS_VOLT   0x0003
 
#define VCPMONITOR2_CFG_MODE_CONT_SHUNT_VOLT   0x0005
 
#define VCPMONITOR2_CFG_MODE_CONT_BUS_VOLT   0x0006
 
#define VCPMONITOR2_CFG_MODE_CONT_SHUNT_BUS_VOLT   0x0007
 
#define VCPMONITOR2_CFG_MASK_SCC_1_ENABLE   0x4000
 
#define VCPMONITOR2_CFG_MASK_SCC_2_ENABLE   0x2000
 
#define VCPMONITOR2_CFG_MASK_SCC_3_ENABLE   0x1000
 
#define VCPMONITOR2_CFG_MASK_SCC_1_DISABLE   0x0000
 
#define VCPMONITOR2_CFG_MASK_SCC_2_DISABLE   0x0000
 
#define VCPMONITOR2_CFG_MASK_SCC_3_DISABLE   0x0000
 
#define VCPMONITOR2_CFG_MASK_WEN_TRANSPARENT   0x0000
 
#define VCPMONITOR2_CFG_MASK_WEN_LATCH_ENABLED   0x0800
 
#define VCPMONITOR2_CFG_MASK_CEN_TRANSPARENT   0x0000
 
#define VCPMONITOR2_CFG_MASK_CEN_LATCH_ENABLED   0x0400
 
#define VCPMONITOR2_CFG_MASK_CF_1_ENABLE   0x0080
 
#define VCPMONITOR2_CFG_MASK_CF_2_ENABLE   0x0100
 
#define VCPMONITOR2_CFG_MASK_CF_3_ENABLE   0x0200
 
#define VCPMONITOR2_CFG_MASK_CF_1_DISABLE   0x0000
 
#define VCPMONITOR2_CFG_MASK_CF_2_DISABLE   0x0000
 
#define VCPMONITOR2_CFG_MASK_CF_3_DISABLE   0x0000
 
#define VCPMONITOR2_CFG_MASK_SF_ENABLE   0x0040
 
#define VCPMONITOR2_CFG_MASK_SF_DISABLE   0x0000
 
#define VCPMONITOR2_CFG_MASK_VF_1_ENABLE   0x0008
 
#define VCPMONITOR2_CFG_MASK_VF_2_ENABLE   0x0010
 
#define VCPMONITOR2_CFG_MASK_VF_3_ENABLE   0x0020
 
#define VCPMONITOR2_CFG_MASK_VF_1_DISABLE   0x0000
 
#define VCPMONITOR2_CFG_MASK_VF_2_DISABLE   0x0000
 
#define VCPMONITOR2_CFG_MASK_VF_3_DISABLE   0x0000
 
#define VCPMONITOR2_CFG_MASK_PVF_ENABLE   0x0004
 
#define VCPMONITOR2_CFG_MASK_TCF_ENABLE   0x0002
 
#define VCPMONITOR2_CFG_MASK_CVRF_ENABLE   0x0001
 
#define VCPMONITOR2_CFG_MASK_PVF_DISABLE   0x0000
 
#define VCPMONITOR2_CFG_MASK_TCF_DISABLE   0x0000
 
#define VCPMONITOR2_CFG_MASK_CVRF_DISABLE   0x0000
 
#define VCPMONITOR2_CHANNEL_1   0x01
 
#define VCPMONITOR2_CHANNEL_2   0x02
 
#define VCPMONITOR2_CHANNEL_3   0x03
 
#define VCPMONITOR2_ALERT_PVALID   0x01
 
#define VCPMONITOR2_ALERT_WRNG   0x02
 
#define VCPMONITOR2_ALERT_CRTCL   0x04
 
#define VCPMONITOR2_ALERT_TCTRL   0x08
 
#define DEVICE_OK   0
 
#define DEVICE_ERROR   1
 

Functions

void vcpmonitor2_cfg_setup (vcpmonitor2_cfg_t *cfg)
 Config Object Initialization function.
 
VCPMONITOR2_RETVAL vcpmonitor2_init (vcpmonitor2_t *ctx, vcpmonitor2_cfg_t *cfg)
 Initialization function.
 
void vcpmonitor2_default_cfg (vcpmonitor2_t *ctx)
 Click Default Configuration function.
 
void vcpmonitor2_generic_write (vcpmonitor2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void vcpmonitor2_generic_read (vcpmonitor2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
uint16_t vcpmonitor2_get_manifacture_id (vcpmonitor2_t *ctx)
 Get Manufacture ID.
 
uint16_t vcpmonitor2_get_die_id (vcpmonitor2_t *ctx)
 Get DIE ID.
 
float vcpmonitor2_get_bus_voltage (vcpmonitor2_t *ctx, uint8_t channel)
 Get BUS voltage in mV.
 
float vcpmonitor2_get_shunt_voltage (vcpmonitor2_t *ctx, uint8_t channel)
 Get Shunt voltage in mV.
 
float vcpmonitor2_get_current (vcpmonitor2_t *ctx, uint8_t channel)
 Get Current data in mA.
 
float vcpmonitor2_get_power (vcpmonitor2_t *ctx, uint8_t channel)
 Get Power in W.
 
void vcpmonitor2_configuration (vcpmonitor2_t *ctx, uint16_t cfg)
 Configuration function.
 
uint8_t vcpmonitor2_get_alert_status (vcpmonitor2_t *ctx)
 Get Alert status.
 
void vcpmonitor2_reset_alert (vcpmonitor2_t *ctx)
 Alert reset.
 
void vcpmonitor2_alert_config (vcpmonitor2_t *ctx, uint8_t cfg)
 Alert configuration ( Enable / Disable )
 

Detailed Description

This file contains API for VCP Monitor 2 Click driver.