proximity2 2.0.0.0
proximity2.h File Reference

This file contains API for Proximity 2 Click driver. More...

#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  proximity2_t
 Click ctx object definition. More...
 
struct  proximity2_cfg_t
 Click configuration structure definition. More...
 

Macros

#define PROXIMITY2_MAP_MIKROBUS(cfg, mikrobus)
 
#define PROXIMITY2_RETVAL   uint8_t
 
#define PROXIMITY2_OK   0x00
 
#define PROXIMITY2_INIT_ERROR   0xFF
 
#define PROXIMITY2_I2C_SLAVE_ADDR   0x4A
 
#define PROXIMITY2_REG_INTER_STAT   0x00
 
#define PROXIMITY2_REG_MAIN_CONFIG   0x01
 
#define PROXIMITY2_REG_RECEIVE_CONFIG   0x02
 
#define PROXIMITY2_REG_TRANSMIT_CONFIG   0x03
 
#define PROXIMITY2_REG_ALS_HI_BY   0x04
 
#define PROXIMITY2_REG_ALS_LO_BY   0x05
 
#define PROXIMITY2_REG_PROX   0x16
 
#define PROXIMITY2_REG_ALS_UPTRSH_H   0x06
 
#define PROXIMITY2_REG_ALS_UPTRSH_L   0x07
 
#define PROXIMITY2_REG_ALS_LOTRSH_H   0x08
 
#define PROXIMITY2_REG_ALS_LOTRSH_L   0x09
 
#define PROXIMITY2_REG_TRSH_PERS_TIM   0x0A
 
#define PROXIMITY2_REG_PROX_TRSH_IND   0x0B
 
#define PROXIMITY2_REG_PROX_TRSH   0x0C
 
#define PROXIMITY2_REG_GREEN_GAIN   0x0F
 
#define PROXIMITY2_REG_IR_GAIN   0x10
 
#define PROXIMITY2_RECE_CONFIG_ALSPGA_0_03125   0x00
 
#define PROXIMITY2_RECE_CONFIG_ALSPGA_0_125   0x01
 
#define PROXIMITY2_RECE_CONFIG_ALSPGA_0_5   0x02
 
#define PROXIMITY2_RECE_CONFIG_ALSPGA_4   0x03
 
#define PROXIMITY2_RECE_CONFIG_DEFAULT   0xF1
 
#define PROXIMITY2_MAIN_CONFIG_STDWN   0x00
 
#define PROXIMITY2_MAIN_CONFIG_DEFAULT   0x13
 
#define PROXIMITY2_MAIN_CONFIG_ALS_G_IR   0x04
 
#define PROXIMITY2_MAIN_CONFIG_ALS_G   0x08
 
#define PROXIMITY2_MAIN_CONFIG_ALS_IR   0x0C
 
#define PROXIMITY2_MAIN_CONFIG_ALS_PROX   0x10
 
#define PROXIMITY2_MAIN_CONFIG_PROX_ONLY   0x14
 
#define PROXIMITY2_RECE_CONFIG_ALSTIM_14   0x00
 
#define PROXIMITY2_RECE_CONFIG_ALSTIM_12   0x01
 
#define PROXIMITY2_RECE_CONFIG_ALSTIM_10   0x02
 
#define PROXIMITY2_RECE_CONFIG_ALSTIM_8   0x03
 
#define PROXIMITY2_LED_DRV_DISABLE   0x00
 
#define PROXIMITY2_LED_DRV_CURRENT_10_MA   0x01
 
#define PROXIMITY2_LED_DRV_CURRENT_20_MA   0x02
 
#define PROXIMITY2_LED_DRV_CURRENT_30_MA   0x03
 
#define PROXIMITY2_LED_DRV_CURRENT_40_MA   0x04
 
#define PROXIMITY2_LED_DRV_CURRENT_50_MA   0x05
 
#define PROXIMITY2_LED_DRV_CURRENT_60_MA   0x06
 
#define PROXIMITY2_LED_DRV_CURRENT_70_MA   0x07
 
#define PROXIMITY2_LED_DRV_CURRENT_80_MA   0x0C
 
#define PROXIMITY2_LED_DRV_CURRENT_90_MA   0x0D
 
#define PROXIMITY2_LED_DRV_CURRENT_100_MA   0x0E
 
#define PROXIMITY2_LED_DRV_CURRENT_110_MA   0x0F
 
#define PROXIMITY2_INTERRUPT_TRIGGERS_1   0x00
 
#define PROXIMITY2_INTERRUPT_TRIGGERS_2   0x01
 
#define PROXIMITY2_INTERRUPT_TRIGGERS_4   0x02
 
#define PROXIMITY2_INTERRUPT_TRIGGERS_16   0x03
 
#define PROXIMITY2_PROXI_AVG_VAL   0x7F
 
#define PROXIMITY2_PROXI_MAX_VAL   0xFF
 
#define PROXIMITY2_PROXI_SENSITIVITY   5
 

Functions

void proximity2_cfg_setup (proximity2_cfg_t *cfg)
 Config Object Initialization function.
 
PROXIMITY2_RETVAL proximity2_init (proximity2_t *ctx, proximity2_cfg_t *cfg)
 Initialization function.
 
void proximity2_default_cfg (proximity2_t *ctx)
 Click Default Configuration function.
 
void proximity2_generic_write (proximity2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void proximity2_generic_read (proximity2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
uint8_t proximity2_read_prox (proximity2_t *ctx)
 Read PROX Data Register function.
 
uint16_t proximity2_read_als (proximity2_t *ctx)
 Read ALS Data Registers function.
 
uint8_t proximity2_get_int_pin_status (proximity2_t *ctx)
 Get int pin status.
 

Detailed Description

This file contains API for Proximity 2 Click driver.