pac1944 2.0.0.0
pac1944.h File Reference

This file contains API for PAC1944 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  pac1944_t
 PAC1944 Click context object. More...
 
struct  pac1944_cfg_t
 PAC1944 Click configuration object. More...
 
struct  pac1944_setup_t
 PAC1944 Configuration setup structure. More...
 

Macros

#define PAC1944_REG_REFRESH   0x00
 PAC1944 description register.
 
#define PAC1944_REG_CTRL   0x01
 
#define PAC1944_REG_ACC_COUNT   0x02
 
#define PAC1944_REG_VACC_CH1   0x03
 
#define PAC1944_REG_VACC_CH2   0x04
 
#define PAC1944_REG_VACC_CH3   0x05
 
#define PAC1944_REG_VACC_CH4   0x06
 
#define PAC1944_REG_VBUS_CH1   0x07
 
#define PAC1944_REG_VBUS_CH2   0x08
 
#define PAC1944_REG_VBUS_CH3   0x09
 
#define PAC1944_REG_VBUS_CH4   0x0A
 
#define PAC1944_REG_VSENSE_CH1   0x0B
 
#define PAC1944_REG_VSENSE_CH2   0x0C
 
#define PAC1944_REG_VSENSE_CH3   0x0D
 
#define PAC1944_REG_VSENSE_CH4   0x0E
 
#define PAC1944_REG_VBUS_CH1_AVG   0x0F
 
#define PAC1944_REG_VBUS_CH2_AVG   0x10
 
#define PAC1944_REG_VBUS_CH3_AVG   0x11
 
#define PAC1944_REG_VBUS_CH4_AVG   0x12
 
#define PAC1944_REG_VSENSE_CH1_AVG   0x13
 
#define PAC1944_REG_VSENSE_CH2_AVG   0x14
 
#define PAC1944_REG_VSENSE_CH3_AVG   0x15
 
#define PAC1944_REG_VSENSE_CH4_AVG   0x16
 
#define PAC1944_REG_VPOWER_CH1   0x17
 
#define PAC1944_REG_VPOWER_CH2   0x18
 
#define PAC1944_REG_VPOWER_CH3   0x19
 
#define PAC1944_REG_VPOWER_CH4   0x1A
 
#define PAC1944_REG_SMBUS_CFG   0x1C
 
#define PAC1944_REG_NEG_PWR_FSR   0x1D
 
#define PAC1944_REG_REFRESH_G   0x1E
 
#define PAC1944_REG_REFRESH_V   0x1F
 
#define PAC1944_REG_SLOW   0x20
 
#define PAC1944_REG_CTRL_ACT   0x21
 
#define PAC1944_REG_NEG_PWR_FSR_ACT   0x22
 
#define PAC1944_REG_CTRL_LAT   0x23
 
#define PAC1944_REG_NEG_PWR_FSR_LAT   0x24
 
#define PAC1944_REG_ACC_CFG   0x25
 
#define PAC1944_REG_ALERT_STATUS   0x26
 
#define PAC1944_REG_SLOW_ALERT1   0x27
 
#define PAC1944_REG_GPIO_ALERT2   0x28
 
#define PAC1944_REG_ACC_FULLNESS_LIM   0x29
 
#define PAC1944_REG_OC_LIM_CH1   0x30
 
#define PAC1944_REG_OC_LIM_CH2   0x31
 
#define PAC1944_REG_OC_LIM_CH3   0x32
 
#define PAC1944_REG_OC_LIM_CH4   0x33
 
#define PAC1944_REG_UC_LIM_CH1   0x34
 
#define PAC1944_REG_UC_LIM_CH2   0x35
 
#define PAC1944_REG_UC_LIM_CH3   0x36
 
#define PAC1944_REG_UC_LIM_CH4   0x37
 
#define PAC1944_REG_OP_LIM_CH1   0x38
 
#define PAC1944_REG_OP_LIM_CH2   0x39
 
#define PAC1944_REG_OP_LIM_CH3   0x3A
 
#define PAC1944_REG_OP_LIM_CH4   0x3B
 
#define PAC1944_REG_OV_LIM_CH1   0x3C
 
#define PAC1944_REG_OV_LIM_CH2   0x3D
 
#define PAC1944_REG_OV_LIM_CH3   0x3E
 
#define PAC1944_REG_OV_LIM_CH4   0x3F
 
#define PAC1944_REG_UV_LIM_CH1   0x40
 
#define PAC1944_REG_UV_LIM_CH2   0x41
 
#define PAC1944_REG_UV_LIM_CH3   0x42
 
#define PAC1944_REG_UV_LIM_CH4   0x43
 
#define PAC1944_REG_OC_LIM_NSAMPLES   0x44
 
#define PAC1944_REG_UC_LIM_NSAMPLES   0x45
 
#define PAC1944_REG_OP_LIM_NSAMPLES   0x46
 
#define PAC1944_REG_OV_LIM_NSAMPLES   0x47
 
#define PAC1944_REG_UV_LIM_NSAMPLES   0x48
 
#define PAC1944_REG_ALERT_ENABLE   0x49
 
#define PAC1944_REG_ACC_CFG_ACT   0x4A
 
#define PAC1944_REG_ACC_CFG_LAT   0x4B
 
#define PAC1944_REG_ID_PRODUCT   0xFD
 
#define PAC1944_REG_ID_MANUFACTURER   0xFE
 
#define PAC1944_REG_ID_REVISION   0xFF
 
#define PAC1944_MEAS_SEL_V_SOURCE   0
 PAC1944 Measurement selection.
 
#define PAC1944_MEAS_SEL_I_SENSE   1
 
#define PAC1944_MEAS_SEL_P_SENSE   2
 
#define PAC1944_CH_SEL_CH_1   1
 PAC1944 Channel selection.
 
#define PAC1944_CH_SEL_CH_2   2
 
#define PAC1944_CH_SEL_CH_3   3
 
#define PAC1944_CH_SEL_CH_4   4
 
#define PAC1944_AVG_SEL_DISABLE   0
 PAC1944 Averaging mode selection.
 
#define PAC1944_AVG_SEL_ENABLE   1
 
#define PAC1944_MEAS_MODE_UNIPOLAR_FSR   0
 PAC1944 Measure mode selection.
 
#define PAC1944_MEAS_MODE_BIPOLAR_FSR   1
 
#define PAC1944_MEAS_MODE_BIPOLAR_HALF_FSR   2
 
#define PAC1944_SLOW_STATE_ON   1
 PAC1944 Pin states.
 
#define PAC1944_SLOW_STATE_OFF   0
 
#define PAC1944_DEV_ENABLE   1
 
#define PAC1944_DEV_PWR_DWN   0
 
#define PAC1944_ALERT_ACTIVE   0
 
#define PAC1944_ALERT_INACTIVE   1
 
#define PAC1944_CTRLH_SPS_1024_ADAPT_ACC   0x00
 PAC1944 description setting.
 
#define PAC1944_CTRLH_SPS_256_ADAPT_ACC   0x10
 
#define PAC1944_CTRLH_SPS_64_ADAPT_ACC   0x20
 
#define PAC1944_CTRLH_SPS_8_ADAPT_ACC   0x30
 
#define PAC1944_CTRLH_SPS_1024   0x40
 
#define PAC1944_CTRLH_SPS_256   0x50
 
#define PAC1944_CTRLH_SPS_64   0x60
 
#define PAC1944_CTRLH_SPS_8   0x70
 
#define PAC1944_CTRLH_SINGLE_SHOT_MODE   0x80
 
#define PAC1944_CTRLH_SINGLE_SHOT_8X   0x90
 
#define PAC1944_CTRLH_FAST_MODE   0xA0
 
#define PAC1944_CTRLH_BURST_MODE   0xB0
 
#define PAC1944_CTRLH_SLEEP   0xF0
 
#define PAC1944_CTRLH_INT_PIN_ALERT   0x00
 
#define PAC1944_CTRLH_INT_PIN_DIG_IN   0x04
 
#define PAC1944_CTRLH_INT_PIN_DIG_OUT   0x08
 
#define PAC1944_CTRLH_INT_PIN_SLOW   0x0C
 
#define PAC1944_CTRLH_SLW_PIN_ALERT   0x00
 
#define PAC1944_CTRLH_SLW_PIN_DIG_IN   0x01
 
#define PAC1944_CTRLH_SLW_PIN_DIG_OUT   0x02
 
#define PAC1944_CTRLH_SLW_PIN_SLOW   0x03
 
#define PAC1944_CTRLL_CH1_OFF   0x80
 
#define PAC1944_CTRLL_CH2_OFF   0x40
 
#define PAC1944_CTRLL_CH3_OFF   0x20
 
#define PAC1944_CTRLL_CH4_OFF   0x10
 
#define PAC1944_CTRLL_ALL_CH_OFF   0xF0
 
#define PAC1944_CTRLL_ALL_CH_ON   0x00
 
#define PAC1944_SMBUS_INT_PIN_MASK   0x80
 
#define PAC1944_SMBUS_SLW_PIN_MASK   0x40
 
#define PAC1944_SMBUS_ALERT_MASK   0x20
 
#define PAC1944_SMBUS_POR_MASK   0x10
 
#define PAC1944_SMBUS_TIMEOUT_OFF   0x00
 
#define PAC1944_SMBUS_TIMEOUT_ON   0x08
 
#define PAC1944_SMBUS_BYTE_COUNT_OFF   0x00
 
#define PAC1944_SMBUS_BYTE_COUNT_ON   0x04
 
#define PAC1944_SMBUS_AUTO_INC_SKIP_ON   0x00
 
#define PAC1944_SMBUS_AUTO_INC_SKIP_OFF   0x02
 
#define PAC1944_SMBUS_I2C_HIGH_SPEED   0x01
 
#define PAC1944_DEVICE_ADDR_GND   0x10
 PAC1944 device address setting.
 
#define PAC1944_DEVICE_ADDR_499_OHM   0x11
 
#define PAC1944_DEVICE_ADDR_806_OHM   0x12
 
#define PAC1944_DEVICE_ADDR_1270_OHM   0x13
 
#define PAC1944_DEVICE_ADDR_2050_OHM   0x14
 
#define PAC1944_DEVICE_ADDR_3240_OHM   0x15
 
#define PAC1944_DEVICE_ADDR_5230_OHM   0x16
 
#define PAC1944_DEVICE_ADDR_8450_OHM   0x17
 
#define PAC1944_DEVICE_ADDR_13K3_OHM   0x18
 
#define PAC1944_DEVICE_ADDR_21K5_OHM   0x19
 
#define PAC1944_DEVICE_ADDR_34K_OHM   0x1A
 
#define PAC1944_DEVICE_ADDR_54K9_OHM   0x1B
 
#define PAC1944_DEVICE_ADDR_88K7_OHM   0x1C
 
#define PAC1944_DEVICE_ADDR_140K_OHM   0x1D
 
#define PAC1944_DEVICE_ADDR_226K_OHM   0x1E
 
#define PAC1944_DEVICE_ADDR_VCC   0x1F
 
#define PAC1944_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Functions

void pac1944_cfg_setup (pac1944_cfg_t *cfg)
 PAC1944 configuration object setup function.
 
err_t pac1944_init (pac1944_t *ctx, pac1944_cfg_t *cfg)
 PAC1944 initialization function.
 
void pac1944_default_cfg (pac1944_t *ctx)
 PAC1944 default configuration function.
 
void pac1944_set_slow_state (pac1944_t *ctx, uint8_t state)
 PAC1944 set slow state function.
 
void pac1944_device_state (pac1944_t *ctx, uint8_t state)
 PAC1944 set device state function.
 
uint8_t pac1944_get_alert_state (pac1944_t *ctx)
 PAC1944 get alert state function.
 
err_t pac1944_generic_write (pac1944_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 PAC1944 I2C writing function.
 
err_t pac1944_generic_read (pac1944_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 PAC1944 I2C reading function.
 
void pac1944_setup_config (pac1944_t *ctx, pac1944_setup_t cfg_data)
 PAC1944 setup config function.
 
void pac1944_set_address_pointer (pac1944_t *ctx, uint8_t reg_addr)
 PAC1944 set address pointer function.
 
uint8_t pac1944_read_last_accessed_register (pac1944_t *ctx)
 PAC1944 last accessed register read function.
 
void pac1944_general_refresh_cmd (pac1944_t *ctx)
 PAC1944 general refresh command.
 
void pac1944_refresh_cmd (pac1944_t *ctx)
 PAC1944 refresh command.
 
void pac1944_volatile_refresh_cmd (pac1944_t *ctx)
 PAC1944 volatile refresh command.
 
uint32_t pac1944_get_accumulator_count (pac1944_t *ctx)
 PAC1944 accumulator count function.
 
void pac1944_get_accumulator_output (pac1944_t *ctx, uint8_t ch_sel, uint8_t *acc_out)
 PAC1944 get accumulator output function.
 
uint32_t pac1944_get_measurement (pac1944_t *ctx, uint8_t meas_sel, uint8_t ch_sel, uint8_t avg_sel)
 PAC1944 get measurement function.
 
float pac1944_get_calc_measurement (pac1944_t *ctx, uint8_t meas_sel, uint8_t ch_sel, uint8_t avg_sel, uint8_t meas_mode)
 PAC1944 get calculated measurement function.
 

Detailed Description

This file contains API for PAC1944 Click Driver.