proximity12 2.0.0.0
proximity12.h File Reference

This file contains API for Proximity 12 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  proximity12_t
 Proximity 12 Click context object. More...
 
struct  proximity12_cfg_t
 Proximity 12 Click configuration object. More...
 
struct  proximity12_als_data_t
 Proximity 12 ALS data object. More...
 

Macros

#define PROXIMITY12_REG_AILT   0x2E
 Proximity 12 registers map.
 
#define PROXIMITY12_REG_AIHT   0x31
 
#define PROXIMITY12_REG_PILT0   0x34
 
#define PROXIMITY12_REG_PIHT0   0x36
 
#define PROXIMITY12_REG_PILT1   0x38
 
#define PROXIMITY12_REG_PIHT1   0x3A
 
#define PROXIMITY12_REG_PILTR   0x3C
 
#define PROXIMITY12_REG_PIHTR   0x3E
 
#define PROXIMITY12_REG_FD_CFG0   0x40
 
#define PROXIMITY12_REG_FD_CFG1   0x41
 
#define PROXIMITY12_REG_FD_CFG2   0x42
 
#define PROXIMITY12_REG_FD_CFG3   0x43
 
#define PROXIMITY12_REG_FD_CFG4   0x44
 
#define PROXIMITY12_REG_FD_CFG5   0x45
 
#define PROXIMITY12_REG_FD_CFG6   0x46
 
#define PROXIMITY12_REG_FD_CFG7   0x47
 
#define PROXIMITY12_REG_FD_CFG8   0x48
 
#define PROXIMITY12_REG_SYNC_DELAY   0x4F
 
#define PROXIMITY12_REG_VSYNC_CFG0   0x53
 
#define PROXIMITY12_REG_VSYNC_CFG1   0x54
 
#define PROXIMITY12_REG_VSYNC_CFG2   0x56
 
#define PROXIMITY12_REG_VSYNC_CFG3   0x57
 
#define PROXIMITY12_REG_CALIB   0x69
 
#define PROXIMITY12_REG_CALIBCFG0   0x6A
 
#define PROXIMITY12_REG_CALIBCFG1   0x6B
 
#define PROXIMITY12_REG_CALIBCFG2   0x6C
 
#define PROXIMITY12_REG_CALIBSTAT   0x6D
 
#define PROXIMITY12_REG_ENABLE   0x80
 
#define PROXIMITY12_REG_MEAS_MODE0   0x81
 
#define PROXIMITY12_REG_MEAS_MODE1   0x82
 
#define PROXIMITY12_REG_TRIGGER_MODE   0x83
 
#define PROXIMITY12_REG_ATIME   0x84
 
#define PROXIMITY12_REG_ASTEP   0x85
 
#define PROXIMITY12_REG_PTIME   0x87
 
#define PROXIMITY12_REG_WTIPE   0x88
 
#define PROXIMITY12_REG_MOD_GAIN_0_1   0x89
 
#define PROXIMITY12_REG_MOD_GAIN_2_3   0x8A
 
#define PROXIMITY12_REG_MOD_GAIN_4_5   0x8B
 
#define PROXIMITY12_REG_MOD_GAIN_6_7   0x8C
 
#define PROXIMITY12_REG_AGC_ENABLE   0x8D
 
#define PROXIMITY12_REG_AUXID   0x90
 
#define PROXIMITY12_REG_REVID   0x91
 
#define PROXIMITY12_REG_ID   0x92
 
#define PROXIMITY12_REG_CFG0   0x93
 
#define PROXIMITY12_REG_CFG3   0x96
 
#define PROXIMITY12_REG_CFG4   0x97
 
#define PROXIMITY12_REG_PERS   0x9A
 
#define PROXIMITY12_REG_CFG8   0x9B
 
#define PROXIMITY12_REG_CFG9   0x9C
 
#define PROXIMITY12_REG_CFG10   0x9D
 
#define PROXIMITY12_REG_CFG11   0x9E
 
#define PROXIMITY12_REG_CFG12   0x9F
 
#define PROXIMITY12_REG_AZ_CONFIG   0xA4
 
#define PROXIMITY12_REG_CFG20   0xA7
 
#define PROXIMITY12_REG_PCFG1   0xAA
 
#define PROXIMITY12_REG_PCFG2   0xAB
 
#define PROXIMITY12_REG_PCFG3   0xAC
 
#define PROXIMITY12_REG_PCFG4   0xAD
 
#define PROXIMITY12_REG_PCFG5   0xAE
 
#define PROXIMITY12_REG_PCFG6   0xAF
 
#define PROXIMITY12_REG_PCFG7   0xB0
 
#define PROXIMITY12_REG_POFFSET0   0xB1
 
#define PROXIMITY12_REG_PXAVG   0xB3
 
#define PROXIMITY12_REG_PBSLN   0xB5
 
#define PROXIMITY12_REG_STATUS   0xB7
 
#define PROXIMITY12_REG_STATUS2   0xB8
 
#define PROXIMITY12_REG_STATUS3   0xB9
 
#define PROXIMITY12_REG_STATUS4   0xBA
 
#define PROXIMITY12_REG_STATUS5   0xBB
 
#define PROXIMITY12_REG_STATUS7   0xBD
 
#define PROXIMITY12_REG_STATUS8   0xBE
 
#define PROXIMITY12_REG_STATUS9   0xBF
 
#define PROXIMITY12_REG_ASTATUS   0xC0
 
#define PROXIMITY12_REG_ADATA0   0xC1
 
#define PROXIMITY12_REG_ADATA1   0xC4
 
#define PROXIMITY12_REG_ADATA2   0xC7
 
#define PROXIMITY12_REG_ADATA3   0xCA
 
#define PROXIMITY12_REG_ADATA4   0xCD
 
#define PROXIMITY12_REG_ADATA5   0xD0
 
#define PROXIMITY12_REG_ADATA6   0xD3
 
#define PROXIMITY12_REG_ADATA7   0xD6
 
#define PROXIMITY12_REG_PSTATUS   0xD9
 
#define PROXIMITY12_REG_PDATA0   0xDA
 
#define PROXIMITY12_REG_PDATA1   0xDC
 
#define PROXIMITY12_REG_PDATAR   0xDE
 
#define PROXIMITY12_REG_GPIO   0xF2
 
#define PROXIMITY12_REG_AGC_GAIN_MAX   0xF4
 
#define PROXIMITY12_REG_INTENAB   0xF5
 
#define PROXIMITY12_REG_CONTROL   0xF6
 
#define PROXIMITY12_REG_POFFSET1   0xF7
 
#define PROXIMITY12_REG_FIFO_MAP   0xF9
 
#define PROXIMITY12_REG_FIFO_MAP2   0xFA
 
#define PROXIMITY12_REG_FIFO_STATUS   0xFB
 
#define PROXIMITY12_REG_FDATA   0xFC
 
#define PROXIMITY12_ENABLE_FLICKER   0x40
 Proximity 12 ENABLE register setting.
 
#define PROXIMITY12_ENABLE_ALS   0x10
 
#define PROXIMITY12_ENABLE_PROX   0x08
 
#define PROXIMITY12_ENABLE_POWER   0x01
 
#define PROXIMITY12_MEAS_MODE0_CL_APF_VSYNC   0x40
 Proximity 12 MEAS_MODE0 register setting.
 
#define PROXIMITY12_MEAS_MODE0_EN_PROX_DIODE   0x0C
 
#define PROXIMITY12_MEAS_MODE0_ALS_SET_A_DIODE   0x00
 
#define PROXIMITY12_MEAS_MODE0_ALS_SET_B_DIODE   0x02
 
#define PROXIMITY12_MEAS_MODE0_EN_ALS_DIODE   0x01
 
#define PROXIMITY12_AGC_DISABLE_ALL_MOD   0x00
 Proximity 12 modulator gain setting.
 
#define PROXIMITY12_AGC_ENABLE_ALL_MOD   0xFF
 
#define PROXIMITY12_AGC_ENABLE_MOD_7   0x80
 
#define PROXIMITY12_AGC_ENABLE_MOD_6   0x40
 
#define PROXIMITY12_AGC_ENABLE_MOD_5   0x20
 
#define PROXIMITY12_AGC_ENABLE_MOD_4   0x10
 
#define PROXIMITY12_AGC_ENABLE_MOD_3   0x08
 
#define PROXIMITY12_AGC_ENABLE_MOD_2   0x04
 
#define PROXIMITY12_AGC_ENABLE_MOD_1   0x02
 
#define PROXIMITY12_AGC_ENABLE_MOD_0   0x01
 
#define PROXIMITY12_MOD_GAIN_2X   0x00
 
#define PROXIMITY12_MOD_GAIN_4X   0x01
 
#define PROXIMITY12_MOD_GAIN_8X   0x02
 
#define PROXIMITY12_MOD_GAIN_16X   0x03
 
#define PROXIMITY12_MOD_GAIN_32X   0x04
 
#define PROXIMITY12_MOD_GAIN_64X   0x05
 
#define PROXIMITY12_MOD_GAIN_128X   0x06
 
#define PROXIMITY12_MOD_GAIN_256X   0x07
 
#define PROXIMITY12_MOD_GAIN_512X   0x08
 
#define PROXIMITY12_MOD_GAIN_1024X   0x09
 
#define PROXIMITY12_MOD_GAIN_2048X   0x0A
 
#define PROXIMITY12_MOD_GAIN_4096X   0x0B
 
#define PROXIMITY12_PROX_FILTER_ENABLE   0x08
 Proximity 12 proximity filter setting.
 
#define PROXIMITY12_PROX_FILTER_1   0x00
 
#define PROXIMITY12_PROX_FILTER_2   0x01
 
#define PROXIMITY12_PROX_FILTER_3   0x02
 
#define PROXIMITY12_PROX_FILTER_4   0x03
 
#define PROXIMITY12_PROX_FILTER_5   0x04
 
#define PROXIMITY12_PROX_FILTER_6   0x05
 
#define PROXIMITY12_PROX_FILTER_7   0x06
 
#define PROXIMITY12_PROX_FILTER_8   0x07
 
#define PROXIMITY12_ISINK_SCALER_0p5   0x00
 Proximity 12 LED sink setting.
 
#define PROXIMITY12_ISINK_SCALER_1   0x01
 
#define PROXIMITY12_ISINK_SCALER_1p5   0x02
 
#define PROXIMITY12_ISINK_SCALER_2   0x03
 
#define PROXIMITY12_ISINK_CURRENT_0mA   0x00
 
#define PROXIMITY12_ISINK_CURRENT_1mA   0x01
 
#define PROXIMITY12_ISINK_CURRENT_2mA   0x02
 
#define PROXIMITY12_ISINK_CURRENT_3mA   0x03
 
#define PROXIMITY12_ISINK_CURRENT_4mA   0x04
 
#define PROXIMITY12_ISINK_CURRENT_5mA   0x05
 
#define PROXIMITY12_ISINK_CURRENT_6mA   0x06
 
#define PROXIMITY12_ISINK_CURRENT_7mA   0x07
 
#define PROXIMITY12_PROX_GAIN_1X   0x00
 Proximity 12 proximity gain setting.
 
#define PROXIMITY12_PROX_GAIN_2X   0x01
 
#define PROXIMITY12_PROX_GAIN_4X   0x02
 
#define PROXIMITY12_PROX_GAIN_8X   0x03
 
#define PROXIMITY12_AUXID   0x03
 Proximity 12 ID registers values.
 
#define PROXIMITY12_REVID   0x13
 
#define PROXIMITY12_ID   0x40
 
#define PROXIMITY12_SET_DEV_ADDR   0x39
 Proximity 12 device address setting.
 
#define PROXIMITY12_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  proximity12_return_value_t { PROXIMITY12_OK = 0 , PROXIMITY12_ERROR = -1 }
 Proximity 12 Click return value data. More...
 

Functions

void proximity12_cfg_setup (proximity12_cfg_t *cfg)
 Proximity 12 configuration object setup function.
 
err_t proximity12_init (proximity12_t *ctx, proximity12_cfg_t *cfg)
 Proximity 12 initialization function.
 
err_t proximity12_default_cfg (proximity12_t *ctx)
 Proximity 12 default configuration function.
 
err_t proximity12_generic_write (proximity12_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 Proximity 12 I2C writing function.
 
err_t proximity12_generic_read (proximity12_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 Proximity 12 I2C reading function.
 
err_t proximity12_check_device_id (proximity12_t *ctx)
 Proximity 12 check device ID function.
 
err_t proximity12_read_proximity (proximity12_t *ctx, uint16_t *prox_data)
 Proximity 12 read proximity function.
 
err_t proximity12_read_als (proximity12_t *ctx, proximity12_als_data_t *als)
 Proximity 12 read als data function.
 
err_t proximity12_wait_atime (proximity12_t *ctx)
 Proximity 12 wait atime function.
 
err_t proximity12_wait_ptime (proximity12_t *ctx)
 Proximity 12 wait ptime function.
 
err_t proximity12_enable (proximity12_t *ctx, uint8_t en_mask)
 Proximity 12 enable function.
 
err_t proximity12_enable_measurement (proximity12_t *ctx, uint8_t en_mask)
 Proximity 12 enable measurement function.
 
err_t proximity12_proximity_calibration (proximity12_t *ctx)
 Proximity 12 proximity calibration function.
 
err_t proximity12_set_proximity_filter (proximity12_t *ctx, uint8_t filter)
 Proximity 12 set proximity filter function.
 
err_t proximity12_set_led_isink (proximity12_t *ctx, uint8_t scaler, uint8_t current)
 Proximity 12 set led isink function.
 
err_t proximity12_set_proximity_gain (proximity12_t *ctx, uint8_t gain)
 Proximity 12 set proximity gain function.
 
err_t proximity12_set_agc_mod_gain (proximity12_t *ctx, uint8_t en_mask, uint8_t gain)
 Proximity 12 set agc modulator gain function.
 
void proximity12_set_syn_pin (proximity12_t *ctx, uint8_t state)
 Proximity 12 set syn pin state function.
 
void proximity12_set_gp1_pin (proximity12_t *ctx, uint8_t state)
 Proximity 12 set gp1 pin state function.
 
void proximity12_set_gp2_pin (proximity12_t *ctx, uint8_t state)
 Proximity 12 set gp2 pin state function.
 
uint8_t proximity12_get_int_pin (proximity12_t *ctx)
 Proximity 12 get int pin state function.
 

Detailed Description

This file contains API for Proximity 12 Click Driver.

Enumeration Type Documentation

◆ proximity12_return_value_t

Proximity 12 Click return value data.

Predefined enum values for driver return values.

Enumerator
PROXIMITY12_OK 
PROXIMITY12_ERROR