pwrmeter2  2.0.0.0
Data Structures | Macros | Functions
pwrmeter2.h File Reference

This file contains API for PWR Meter 2 Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"

Go to the source code of this file.

Data Structures

struct  pwrmeter2_t
 Click ctx object definition. More...
 
struct  pwrmeter2_cfg_t
 Click configuration structure definition. More...
 

Macros

#define PWRMETER2_MAP_MIKROBUS(cfg, mikrobus)
 
#define PWRMETER2_RETVAL   uint8_t
 
#define PWRMETER2_OK   0x00
 
#define PWRMETER2_INIT_ERROR   0xFF
 
#define PWRMETER2_CH0_ADC_DATA_REG   0x00
 
#define PWRMETER2_CH1_ADC_DATA_REG   0x01
 
#define PWRMETER2_MODUL_OUTPUT_REG   0x08
 
#define PWRMETER2_PHASE_CONFIG_REG   0x0A
 
#define PWRMETER2_GAIN_CONFIG_REG   0x0B
 
#define PWRMETER2_STATUS_COMM_REG   0x0C
 
#define PWRMETER2_CONFIG0_REG   0x0D
 
#define PWRMETER2_CONFIG1_REG   0x0E
 
#define PWRMETER2_OFFCAL_CH0_REG   0x0F
 
#define PWRMETER2_GAINCAL_CH0_REG   0x10
 
#define PWRMETER2_OFFCAL_CH1_REG   0x11
 
#define PWRMETER2_GAINCAL_CH1_REG   0x12
 
#define PWRMETER2_LOCK_CRC_REG   0x1F
 
#define PWRMETER2_CH0_GAIN1   0x000000
 
#define PWRMETER2_CH0_GAIN2   0x000001
 
#define PWRMETER2_CH0_GAIN4   0x000002
 
#define PWRMETER2_CH0_GAIN8   0x000003
 
#define PWRMETER2_CH0_GAIN16   0x000004
 
#define PWRMETER2_CH0_GAIN32   0x000005
 
#define PWRMETER2_CH1_GAIN1   0x000000
 
#define PWRMETER2_CH1_GAIN2   0x000008
 
#define PWRMETER2_CH1_GAIN4   0x000010
 
#define PWRMETER2_CH1_GAIN8   0x000018
 
#define PWRMETER2_CH1_GAIN16   0x000020
 
#define PWRMETER2_CH1_GAIN32   0x000028
 
#define PWRMETER2_READ_SAME_SINGLE_REG   0x000000
 
#define PWRMETER2_READ_REG_GROUPS   0x400000
 
#define PWRMETER2_READ_REG_TYPES   0x800000
 
#define PWRMETER2_READ_ENTIRE_REG_MAP   0xC00000
 
#define PWRMETER2_ADDR_COUNT_NOT_INCR_WRITE   0x000000
 
#define PWRMETER2_ADDR_COUNT_INCR_WRITE   0x200000
 
#define PWRMETER2_DR_PIN_HIGH_IMP_NOT_READY   0x000000
 
#define PWRMETER2_DR_PIN_LOGIC_HIGH_NOT_READY   0x100000
 
#define PWRMETER2_DATA_READY_LINK_DIS   0x000000
 
#define PWRMETER2_DATA_READY_LINK_EN   0x080000
 
#define PWRMETER2_CRC_WIDTH_16_BIT   0x000000
 
#define PWRMETER2_CRC_WIDTH_32_BIT   0x040000
 
#define PWRMETER2_DATA_WIDTH_16_BIT   0x000000
 
#define PWRMETER2_DATA_WIDTH_24_BIT   0x010000
 
#define PWRMETER2_DATA_WIDTH_32_BIT_WITH_ZEROS   0x020000
 
#define PWRMETER2_DATA_WIDTH_32_BIT_WITH_SIGN   0x030000
 
#define PWRMETER2_CRC_DIS   0x000000
 
#define PWRMETER2_CRC_EN   0x008000
 
#define PWRMETER2_CRCREG_INTERR_DIS   0x000000
 
#define PWRMETER2_CRCREG_INTERR_EN   0x004000
 
#define PWRMETER2_MODUL_OUTPUT_DIS   0x000000
 
#define PWRMETER2_MODUL_OUTPUT_EN   0x000800
 
#define PWRMETER2_OFFCAL_DIS   0x000000
 
#define PWRMETER2_OFFCAL_EN   0x800000
 
#define PWRMETER2_GAINCAL_DIS   0x000000
 
#define PWRMETER2_GAINCAL_EN   0x400000
 
#define PWRMETER2_DITHERING_OFF   0x000000
 
#define PWRMETER2_DITHERING_STRENGTH_MIN   0x100000
 
#define PWRMETER2_DITHERING_STRENGTH_MED   0x200000
 
#define PWRMETER2_DITHERING_STRENGTH_MAX   0x300000
 
#define PWRMETER2_CURRENT_X_0_5   0x000000
 
#define PWRMETER2_CURRENT_X_0_66   0x040000
 
#define PWRMETER2_CURRENT_X_1   0x080000
 
#define PWRMETER2_CURRENT_X_2   0x0C0000
 
#define PWRMETER2_AMCLK_MCLK   0x000000
 
#define PWRMETER2_AMCLK_MCLK_PER_2   0x010000
 
#define PWRMETER2_AMCLK_MCLK_PER_4   0x020000
 
#define PWRMETER2_AMCLK_MCLK_PER_8   0x030000
 
#define PWRMETER2_OSR_32   0x000000
 
#define PWRMETER2_OSR_64   0x002000
 
#define PWRMETER2_OSR_128   0x004000
 
#define PWRMETER2_OSR_256   0x006000
 
#define PWRMETER2_OSR_512   0x008000
 
#define PWRMETER2_OSR_1024   0x00A000
 
#define PWRMETER2_OSR_2048   0x00C000
 
#define PWRMETER2_OSR_4096   0x00E000
 
#define PWRMETER2_CH0_NORMAL_MODE   0x000000
 
#define PWRMETER2_CH1_NORMAL_MODE   0x000000
 
#define PWRMETER2_CH0_SOFT_RESET_MODE   0x010000
 
#define PWRMETER2_CH1_SOFT_RESET_MODE   0x020000
 
#define PWRMETER2_CH0_SHUTDOWN_MODE   0x000100
 
#define PWRMETER2_CH1_SHUTDOWN_MODE   0x000200
 
#define PWRMETER2_INTERNAL_VOL_REF_EN   0x000000
 
#define PWRMETER2_INTERNAL_VOL_REF_DIS   0x000080
 
#define PWRMETER2_INTERNAL_CLOCK_EN   0x000000
 
#define PWRMETER2_INTERNAL_CLOCK_DIS   0x000040
 
#define PWRMETER2_CH0_CHECK_DIS   0x00
 
#define PWRMETER2_CH1_CHECK_DIS   0x00
 
#define PWRMETER2_CH0_CHECK_EN   0x01
 
#define PWRMETER2_CH1_CHECK_EN   0x02
 

Functions

void pwrmeter2_cfg_setup (pwrmeter2_cfg_t *cfg)
 Config Object Initialization function. More...
 
PWRMETER2_RETVAL pwrmeter2_init (pwrmeter2_t *ctx, pwrmeter2_cfg_t *cfg)
 Initialization function. More...
 
void pwrmeter2_default_cfg (pwrmeter2_t *ctx)
 Click Default Configuration function. More...
 
void pwrmeter2_generic_transfer (pwrmeter2_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
 Generic transfer function. More...
 
uint8_t pwrmeter2_write_reg (pwrmeter2_t *ctx, uint8_t register_address, uint32_t transfer_data)
 Generic Write function. More...
 
uint8_t pwrmeter2_read_reg (pwrmeter2_t *ctx, uint8_t register_address, uint32_t *data_out, uint8_t n_data)
 Generic Read function. More...
 
uint8_t pwrmeter2_check_data_ready (pwrmeter2_t *ctx, uint8_t sel_chann)
 Data Ready Check function. More...
 
uint8_t pwrmeter2_read_conv_data (pwrmeter2_t *ctx, uint32_t *data_ch_0, uint32_t *data_ch_1)
 Read Converted Data function. More...
 
void pwrmeter2_get_data (pwrmeter2_t *ctx, int32_t *voltage_data, int32_t *current_data, uint32_t *power_data)
 Data Get function. More...
 
void pwrmeter2_reset (pwrmeter2_t *ctx)
 Reset function. More...
 
uint8_t pwrmeter2_get_modulator_1 (pwrmeter2_t *ctx)
 Modulator 1 Get function. More...
 
uint8_t pwrmeter2_get_modulator_0 (pwrmeter2_t *ctx)
 Modulator 0 Get function. More...
 
uint8_t pwrmeter2_check_ready_pin (pwrmeter2_t *ctx)
 Ready Pin Check function. More...
 

Detailed Description

This file contains API for PWR Meter 2 Click driver.