pac1921 2.0.0.0
pac1921.h File Reference

This file contains API for PAC1921 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  aux_vars_t
 Auxiliary variables structure. More...
 
struct  aux_cfg_t
 Auxiliary variables default cfg. More...
 
struct  pac1921_t
 Click ctx object definition. More...
 
struct  pac1921_cfg_t
 Click configuration structure definition. More...
 

Macros

#define PAC1921_MAP_MIKROBUS(cfg, mikrobus)
 
#define PAC1921_RETVAL   uint8_t
 
#define PAC1921_OK   0x00
 
#define PAC1921_INIT_ERROR   0xFF
 
#define PAC1921_SLAVE_ADDRESS   0x4C
 
#define PAC1921_GAIN_CFG_REG   0x00
 
#define PAC1921_INTEGRATION_CFG_REG   0x01
 
#define PAC1921_CONTROL_REG   0x02
 
#define PAC1921_VBUS_RESULT_HIGH   0x10
 
#define PAC1921_VBUS_RESULT_LOW   0x11
 
#define PAC1921_VSENSE_RESULT_HIGH   0x12
 
#define PAC1921_VSENSE_RESULT_LOW   0x13
 
#define PAC1921_VSUM_ACCUMULATOR_HIGH   0x14
 
#define PAC1921_VSUM_ACCUMULATOR_MID_H   0x15
 
#define PAC1921_VSUM_ACCUMULATOR_MID_L   0x16
 
#define PAC1921_VSUM_ACCUMULATOR_LOW   0x17
 
#define PAC1921_ISUM_ACCUMULATOR_HIGH   0x18
 
#define PAC1921_ISUM_ACCUMULATOR_MID_H   0x19
 
#define PAC1921_ISUM_ACCUMULATOR_MID_L   0x1A
 
#define PAC1921_ISUM_ACCUMULATOR_LOW   0x1B
 
#define PAC1921_OVERFLOW_STATUS   0x1C
 
#define PAC1921_VPOWER_RESULT_HIGH   0x1D
 
#define PAC1921_VPOWER_RESULT_LOW   0x1E
 
#define PAC1921_SAMPLES_HIGH   0x21
 
#define PAC1921_SAMPLES_LOW   0x22
 
#define PAC1921_PSUM_ACCUMULATOR_HIGH   0x23
 
#define PAC1921_PSUM_ACCUMULATOR_MID_H   0x24
 
#define PAC1921_PSUM_ACCUMULATOR_MID_M   0x25
 
#define PAC1921_PSUM_ACCUMULATOR_MID_L   0x26
 
#define PAC1921_PSUM_ACCUMULATOR_LOW   0x27
 
#define PAC1921_PRODUCT_ID   0xFD
 
#define PAC1921_MANUFACTURER_ID   0xFE
 
#define PAC1921_REVISION   0xFF
 
#define PAC1921_I_RESOLUTION_11_BIT   0x80
 
#define PAC1921_I_RESOLUTION_14_BIT   0x00
 
#define PAC1921_V_RESOLUTION_11_BIT   0x40
 
#define PAC1921_V_RESOLUTION_14_BIT   0x00
 
#define PAC1921_DIGITAL_I_GAIN_1X   0x00
 
#define PAC1921_DIGITAL_I_GAIN_2X   0x08
 
#define PAC1921_DIGITAL_I_GAIN_4X   0x10
 
#define PAC1921_DIGITAL_I_GAIN_8X   0x18
 
#define PAC1921_DIGITAL_I_GAIN_16X   0x20
 
#define PAC1921_DIGITAL_I_GAIN_32X   0x28
 
#define PAC1921_DIGITAL_I_GAIN_64X   0x30
 
#define PAC1921_DIGITAL_I_GAIN_128X   0x38
 
#define PAC1921_DIGITAL_V_GAIN_1X   0x00
 
#define PAC1921_DIGITAL_V_GAIN_2X   0x01
 
#define PAC1921_DIGITAL_V_GAIN_4X   0x02
 
#define PAC1921_DIGITAL_V_GAIN_8X   0x03
 
#define PAC1921_DIGITAL_V_GAIN_16X   0x04
 
#define PAC1921_DIGITAL_V_GAIN_32X   0x05
 
#define PAC1921_DIGITAL_V_GAIN_64X   0x06
 
#define PAC1921_DIGITAL_V_GAIN_128X   0x07
 
#define PAC1921_SAMPLE_RATE_1   0x00
 
#define PAC1921_SAMPLE_RATE_2   0x10
 
#define PAC1921_SAMPLE_RATE_4   0x20
 
#define PAC1921_SAMPLE_RATE_8   0x30
 
#define PAC1921_SAMPLE_RATE_16   0x40
 
#define PAC1921_SAMPLE_RATE_32   0x50
 
#define PAC1921_SAMPLE_RATE_64   0x60
 
#define PAC1921_SAMPLE_RATE_128   0x70
 
#define PAC1921_SAMPLE_RATE_256   0x80
 
#define PAC1921_SAMPLE_RATE_512   0x90
 
#define PAC1921_SAMPLE_RATE_1024   0xA0
 
#define PAC1921_SAMPLE_RATE_2048   0xB0
 
#define PAC1921_V_SENSE_FILTER_ON   0x08
 
#define PAC1921_V_SENSE_FILTER_OFF   0x00
 
#define PAC1921_V_BUS_FILTER_ON   0x04
 
#define PAC1921_V_BUS_FILTER_OFF   0x00
 
#define PAC1921_READ_INT_OVERRIDE_ON   0x02
 
#define PAC1921_READ_INT_OVERRIDE_OFF   0x00
 
#define PAC1921_FORCED_INTEGRATE_MODE_ON   0x01
 
#define PAC1921_FORCED_INTEGRATE_MODE_OFF   0x00
 
#define PAC1921_MEASUREMENT_MODE_V_POWER_PIN_CTRL   0x00
 
#define PAC1921_MEASUREMENT_MODE_V_SENSE_FREE_RUN   0x40
 
#define PAC1921_MEASUREMENT_MODE_V_BUS_FREE_RUN   0x80
 
#define PAC1921_MEASUREMENT_MODE_V_POWER_FREE_RUN   0xC0
 
#define PAC1921_MEASUREMENT_MODE_MASK   0xC0
 
#define PAC1921_OUT_PIN_FULL_SCALE_RANGE_3V   0x00
 
#define PAC1921_OUT_PIN_FULL_SCALE_RANGE_2V   0x10
 
#define PAC1921_OUT_PIN_FULL_SCALE_RANGE_1_5_V   0x20
 
#define PAC1921_OUT_PIN_FULL_SCALE_RANGE_1V   0x30
 
#define PAC1921_TIMEOUT_ON   0x08
 
#define PAC1921_TIMEOUT_OFF   0x00
 
#define PAC1921_SLEEP_ON   0x04
 
#define PAC1921_SLEEP_OFF   0x00
 
#define PAC1921_FORCED_READ_MODE_ON   0x02
 
#define PAC1921_FORCED_READ_MODE_OFF   0x00
 
#define PAC1921_FORCED_RECALCULATE_MODE_ON   0x01
 
#define PAC1921_FORCED_RECALCULATE_MODE_OFF   0x00
 
#define PAC1921_VOLTAGE_MAX   10
 
#define PAC1921_CURRENT_MAX   32
 

Functions

void pac1921_cfg_setup (pac1921_cfg_t *cfg)
 Config Object Initialization function.
 
PAC1921_RETVAL pac1921_init (pac1921_t *ctx, pac1921_cfg_t *cfg)
 Initialization function.
 
void pac1921_default_cfg (pac1921_t *ctx)
 Click Default Configuration function.
 
void pac1921_generic_write (pac1921_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void pac1921_generic_read (pac1921_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void pac1921_write_to_reg (pac1921_t *ctx, uint8_t reg_addr, uint8_t *write_data, uint8_t len)
 Register write function.
 
float pac1921_get_measured_data (pac1921_t *ctx, uint8_t measurement_mode, uint8_t sample_num)
 Measured data read function.
 
void pac1921_set_int_pin (pac1921_t *ctx, uint8_t output)
 INT pin set output function.
 
uint8_t pac1921_get_an_pin (pac1921_t *ctx)
 AN pin get input function.
 

Detailed Description

This file contains API for PAC1921 Click driver.