alcohol2 2.0.0.0
alcohol2.h File Reference

This file contains API for Alcohol 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  alcohol2_t
 Click ctx object definition. More...
 
struct  alcohol2_cfg_t
 Click configuration structure definition. More...
 

Macros

#define ALCOHOL2_MAP_MIKROBUS(cfg, mikrobus)
 
#define ALCOHOL2_RETVAL   uint8_t
 
#define ALCOHOL2_OK   0x00
 
#define ALCOHOL2_INIT_ERROR   0xFF
 
#define ALCOHOL2_STATUS_REG   0x00
 
#define ALCOHOL2_LOCK_REG   0x01
 
#define ALCOHOL2_TIACN_REG   0x10
 
#define ALCOHOL2_REFCN_REG   0x11
 
#define ALCOHOL2_MODECN_REG   0x12
 
#define ALCOHOL2_WRITE_MODE   0x00
 
#define ALCOHOL2_READ_ONLY_MODE   0x01
 
#define ALCOHOL2_EXT_TIA_RES   0x00
 
#define ALCOHOL2_2750_OHM_TIA_RES   0x04
 
#define ALCOHOL2_3500_OHM_TIA_RES   0x08
 
#define ALCOHOL2_7K_OHM_TIA_RES   0x0C
 
#define ALCOHOL2_14K_OHM_TIA_RES   0x10
 
#define ALCOHOL2_35K_OHM_TIA_RES   0x14
 
#define ALCOHOL2_120K_OHM_TIA_RES   0x18
 
#define ALCOHOL2_350K_OHM_TIA_RES   0x1C
 
#define ALCOHOL2_10_OHM_LOAD_RES   0x00
 
#define ALCOHOL2_33_OHM_LOAD_RES   0x01
 
#define ALCOHOL2_50_OHM_LOAD_RES   0x02
 
#define ALCOHOL2_100_OHM_LOAD_RES   0x03
 
#define ALCOHOL2_VREF_INT   0x00
 
#define ALCOHOL2_VREF_EXT   0x80
 
#define ALCOHOL2_20_PERCENTS_INT_ZERO   0x00
 
#define ALCOHOL2_50_PERCENTS_INT_ZERO   0x20
 
#define ALCOHOL2_67_PERCENTS_INT_ZERO   0x40
 
#define ALCOHOL2_INT_ZERO_BYPASSED   0x60
 
#define ALCOHOL2_BIAS_POL_NEGATIVE   0x00
 
#define ALCOHOL2_BIAS_POL_POSITIVE   0x10
 
#define ALCOHOL2_0_PERCENTS_BIAS   0x00
 
#define ALCOHOL2_1_PERCENT_BIAS   0x01
 
#define ALCOHOL2_2_PERCENTS_BIAS   0x02
 
#define ALCOHOL2_4_PERCENTS_BIAS   0x03
 
#define ALCOHOL2_6_PERCENTS_BIAS   0x04
 
#define ALCOHOL2_8_PERCENTS_BIAS   0x05
 
#define ALCOHOL2_10_PERCENTS_BIAS   0x06
 
#define ALCOHOL2_12_PERCENTS_BIAS   0x07
 
#define ALCOHOL2_14_PERCENTS_BIAS   0x08
 
#define ALCOHOL2_16_PERCENTS_BIAS   0x09
 
#define ALCOHOL2_18_PERCENTS_BIAS   0x0A
 
#define ALCOHOL2_20_PERCENTS_BIAS   0x0B
 
#define ALCOHOL2_22_PERCENTS_BIAS   0x0C
 
#define ALCOHOL2_24_PERCENTS_BIAS   0x0D
 
#define ALCOHOL2_FET_DIS   0x00
 
#define ALCOHOL2_FET_EN   0x80
 
#define ALCOHOL2_DEEP_SLEEP_MODE   0x00
 
#define ALCOHOL2_2_LEAD_MODE   0x01
 
#define ALCOHOL2_STANDBY_MODE   0x02
 
#define ALCOHOL2_3_LEAD_MODE   0x03
 
#define ALCOHOL2_TEMP_MODE_TIA_OFF   0x06
 
#define ALCOHOL2_TEMP_MODE_TIA_ON   0x07
 
#define ALCOHOL2_DEVICE_EN   0x00
 
#define ALCOHOL2_DEVICE_DIS   0x01
 
#define ADC_DEVICE_ADDR   0x4D
 

Functions

void alcohol2_cfg_setup (alcohol2_cfg_t *cfg)
 Config Object Initialization function.
 
ALCOHOL2_RETVAL alcohol2_init (alcohol2_t *ctx, alcohol2_cfg_t *cfg)
 Initialization function.
 
void alcohol2_default_cfg (alcohol2_t *ctx)
 Click Default Configuration function.
 
void alcohol2_generic_write (alcohol2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void alcohol2_generic_read (alcohol2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void alcohol2_write_byte (alcohol2_t *ctx, uint8_t reg, uint8_t w_data)
 Function writes one byte to the register.
 
uint8_t alcohol2_read_byte (alcohol2_t *ctx, uint8_t reg)
 Function reads one byte from the register.
 
void alcohol2_enable (alcohol2_t *ctx, uint8_t state)
 Device Enable function.
 
uint16_t alcohol2_read_alcohol (alcohol2_t *ctx)
 Function for read Alcohol data.
 
void alcohol2_wait_ready (alcohol2_t *ctx)
 Function waits until I2C is ready for the next command.
 

Detailed Description

This file contains API for Alcohol 2 Click driver.