proximity18 2.1.0.0
proximity18.h File Reference

This file contains API for Proximity 18 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  proximity18_t
 Proximity 18 Click context object. More...
 
struct  proximity18_cfg_t
 Proximity 18 Click configuration object. More...
 

Macros

#define PROXIMITY18_REG_PS_CONF12   0x03
 Proximity 18 registers list.
 
#define PROXIMITY18_REG_PS_CONF3_MS   0x04
 
#define PROXIMITY18_REG_PS_CANC   0x05
 
#define PROXIMITY18_REG_PS_THDL   0x06
 
#define PROXIMITY18_REG_PS_THDH   0x07
 
#define PROXIMITY18_REG_PS1_DATA   0x08
 
#define PROXIMITY18_REG_PS2_DATA   0x09
 
#define PROXIMITY18_REG_PS3_DATA   0x0A
 
#define PROXIMITY18_REG_INT_FLAG   0x0D
 
#define PROXIMITY18_REG_ID   0x0E
 
#define PROXIMITY18_PS_CONF2_MPX_INT_EN_DIS   0x0000
 Proximity 18 PS_CONF12 register settings.
 
#define PROXIMITY18_PS_CONF2_MPX_INT_EN_EN   0x8000
 
#define PROXIMITY18_PS_CONF2_MPX_INT_EN_MASK   0x8000
 
#define PROXIMITY18_PS_CONF2_MPX_MODE_DIS   0x0000
 
#define PROXIMITY18_PS_CONF2_MPX_MODE_EN   0x4000
 
#define PROXIMITY18_PS_CONF2_MPX_MODE_MASK   0x4000
 
#define PROXIMITY18_PS_CONF2_PS_GAIN_TWO_STEP   0x0000
 
#define PROXIMITY18_PS_CONF2_PS_GAIN_SINGLE_X8   0x2000
 
#define PROXIMITY18_PS_CONF2_PS_GAIN_SINGLE_X1   0x3000
 
#define PROXIMITY18_PS_CONF2_PS_GAIN_MASK   0x3000
 
#define PROXIMITY18_PS_CONF2_PS_HD_12BITS   0x0000
 
#define PROXIMITY18_PS_CONF2_PS_HD_16BITS   0x0800
 
#define PROXIMITY18_PS_CONF2_PS_HD_MASK   0x0800
 
#define PROXIMITY18_PS_CONF2_PS_NS_MASK   0x0400
 
#define PROXIMITY18_PS_CONF2_PS_INT_DIS   0x0000
 
#define PROXIMITY18_PS_CONF2_PS_INT_CLOSE   0x0100
 
#define PROXIMITY18_PS_CONF2_PS_INT_AWAY   0x0200
 
#define PROXIMITY18_PS_CONF2_PS_INT_CLOSE_AWAY   0x0300
 
#define PROXIMITY18_PS_CONF2_PS_INT_MASK   0x0300
 
#define PROXIMITY18_PS_CONF2_MASK   0xFF00
 
#define PROXIMITY18_PS_CONF1_PS_DUTY_1_OF_40   0x0000
 
#define PROXIMITY18_PS_CONF1_PS_DUTY_1_OF_80   0x0040
 
#define PROXIMITY18_PS_CONF1_PS_DUTY_1_OF_160   0x0080
 
#define PROXIMITY18_PS_CONF1_PS_DUTY_1_OF_320   0x00C0
 
#define PROXIMITY18_PS_CONF1_PS_DUTY_MASK   0x00C0
 
#define PROXIMITY18_PS_CONF1_PS_PERS_1   0x0000
 
#define PROXIMITY18_PS_CONF1_PS_PERS_2   0x0010
 
#define PROXIMITY18_PS_CONF1_PS_PERS_3   0x0020
 
#define PROXIMITY18_PS_CONF1_PS_PERS_4   0x0030
 
#define PROXIMITY18_PS_CONF1_PS_PERS_MASK   0x0030
 
#define PROXIMITY18_PS_CONF1_PS_IT_1T   0x0000
 
#define PROXIMITY18_PS_CONF1_PS_IT_1p5T   0x0002
 
#define PROXIMITY18_PS_CONF1_PS_IT_2T   0x0004
 
#define PROXIMITY18_PS_CONF1_PS_IT_2p5T   0x0006
 
#define PROXIMITY18_PS_CONF1_PS_IT_3T   0x0008
 
#define PROXIMITY18_PS_CONF1_PS_IT_3p5T   0x000A
 
#define PROXIMITY18_PS_CONF1_PS_IT_4T   0x000C
 
#define PROXIMITY18_PS_CONF1_PS_IT_8T   0x000E
 
#define PROXIMITY18_PS_CONF1_PS_IT_MASK   0x000E
 
#define PROXIMITY18_PS_CONF1_PS_SD_POWER_ON   0x0000
 
#define PROXIMITY18_PS_CONF1_PS_SD_SHUT_DOWN   0x0001
 
#define PROXIMITY18_PS_CONF1_PS_SD_MASK   0x0001
 
#define PROXIMITY18_PS_CONF1_MASK   0x00FF
 
#define PROXIMITY18_PS_MS_PS_SC_CUR_1X   0x0000
 Proximity 18 PS_CONF3_MS register settings.
 
#define PROXIMITY18_PS_MS_PS_SC_CUR_2X   0x2000
 
#define PROXIMITY18_PS_MS_PS_SC_CUR_4X   0x4000
 
#define PROXIMITY18_PS_MS_PS_SC_CUR_8X   0x6000
 
#define PROXIMITY18_PS_MS_PS_SC_CUR_MASK   0x6000
 
#define PROXIMITY18_PS_MS_PS_SP_1X_CAP   0x0000
 
#define PROXIMITY18_PS_MS_PS_SP_1p5X_CAP   0x1000
 
#define PROXIMITY18_PS_MS_PS_SP_MASK   0x1000
 
#define PROXIMITY18_PS_MS_PS_SPO_00H   0x0000
 
#define PROXIMITY18_PS_MS_PS_SPO_FFH   0x0800
 
#define PROXIMITY18_PS_MS_PS_SPO_MASK   0x0800
 
#define PROXIMITY18_PS_MS_LED_I_50mA   0x0000
 
#define PROXIMITY18_PS_MS_LED_I_75mA   0x0100
 
#define PROXIMITY18_PS_MS_LED_I_100mA   0x0200
 
#define PROXIMITY18_PS_MS_LED_I_120mA   0x0300
 
#define PROXIMITY18_PS_MS_LED_I_140mA   0x0400
 
#define PROXIMITY18_PS_MS_LED_I_160mA   0x0500
 
#define PROXIMITY18_PS_MS_LED_I_180mA   0x0600
 
#define PROXIMITY18_PS_MS_LED_I_200mA   0x0700
 
#define PROXIMITY18_PS_MS_LED_I_MASK   0x0700
 
#define PROXIMITY18_PS_MS_MASK   0xFF00
 
#define PROXIMITY18_PS_CONF3_LED_I_LOW_DIS   0x0000
 
#define PROXIMITY18_PS_CONF3_LED_I_LOW_EN   0x0080
 
#define PROXIMITY18_PS_CONF3_LED_I_LOW_MASK   0x0080
 
#define PROXIMITY18_PS_CONF3_IRED_SELECT_IRED1   0x0000
 
#define PROXIMITY18_PS_CONF3_IRED_SELECT_IRED2   0x0020
 
#define PROXIMITY18_PS_CONF3_IRED_SELECT_IRED3   0x0040
 
#define PROXIMITY18_PS_CONF3_IRED_SELECT_MASK   0x0060
 
#define PROXIMITY18_PS_CONF3_PS_SMART_PERS_DIS   0x0000
 
#define PROXIMITY18_PS_CONF3_PS_SMART_PERS_EN   0x0010
 
#define PROXIMITY18_PS_CONF3_PS_SMART_PERS_MASK   0x0010
 
#define PROXIMITY18_PS_CONF3_PS_AF_DIS   0x0000
 
#define PROXIMITY18_PS_CONF3_PS_AF_EN   0x0008
 
#define PROXIMITY18_PS_CONF3_PS_AF_MASK   0x0008
 
#define PROXIMITY18_PS_CONF3_PS_TRIG_NO_TRIG   0x0000
 
#define PROXIMITY18_PS_CONF3_PS_TRIG_ONE_TIME   0x0004
 
#define PROXIMITY18_PS_CONF3_PS_TRIG_MASK   0x0004
 
#define PROXIMITY18_PS_CONF3_PS_MS_NORMAL   0x0000
 
#define PROXIMITY18_PS_CONF3_PS_MS_DET_LOGIC   0x0002
 
#define PROXIMITY18_PS_CONF3_PS_MS_MASK   0x0002
 
#define PROXIMITY18_PS_CONF3_PS_SC_EN_TURN_OFF   0x0000
 
#define PROXIMITY18_PS_CONF3_PS_SC_EN_TURN_ON   0x0001
 
#define PROXIMITY18_PS_CONF3_PS_SC_EN_MASK   0x0001
 
#define PROXIMITY18_PS_CONF3_MASK   0x00FF
 
#define PROXIMITY18_INT_FLAG_MPX_DATA_READY   0x8000
 Proximity 18 INT_FLAG register settings.
 
#define PROXIMITY18_INT_FLAG_PS_SP   0x4000
 
#define PROXIMITY18_INT_FLAG_PS_IF_CLOSE   0x0200
 
#define PROXIMITY18_INT_FLAG_PS_IF_AWAY   0x0100
 
#define PROXIMITY18_INT_FLAG_MASK   0xFF00
 
#define PROXIMITY18_DEVICE_ID   0x80
 Proximity 18 ID setting.
 
#define PROXIMITY18_DEVICE_ID_MASK   0xFF
 
#define PROXIMITY18_DATA_READY_TIMEOUT_MS   5000
 Proximity 18 data ready timeout.
 
#define PROXIMITY18_DEVICE_ADDRESS   0x41
 Proximity 18 device address setting.
 
#define PROXIMITY18_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  proximity18_return_value_t { PROXIMITY18_OK = 0 , PROXIMITY18_ERROR = -1 }
 Proximity 18 Click return value data. More...
 

Functions

void proximity18_cfg_setup (proximity18_cfg_t *cfg)
 Proximity 18 configuration object setup function.
 
err_t proximity18_init (proximity18_t *ctx, proximity18_cfg_t *cfg)
 Proximity 18 initialization function.
 
err_t proximity18_default_cfg (proximity18_t *ctx)
 Proximity 18 default configuration function.
 
err_t proximity18_write_register (proximity18_t *ctx, uint8_t reg, uint16_t data_in)
 Proximity 18 write register function.
 
err_t proximity18_read_register (proximity18_t *ctx, uint8_t reg, uint16_t *data_out)
 Proximity 18 read register function.
 
err_t proximity18_check_communication (proximity18_t *ctx)
 Proximity 18 check communication function.
 
uint8_t proximity18_get_int_pin (proximity18_t *ctx)
 Proximity 18 get int pin function.
 
err_t proximity18_start_measurement (proximity18_t *ctx)
 Proximity 18 start measurement function.
 
err_t proximity18_wait_for_data_ready (proximity18_t *ctx)
 Proximity 18 wait for data ready function.
 
err_t proximity18_read_proximity (proximity18_t *ctx, uint16_t *ps1_data, uint16_t *ps2_data, uint16_t *ps3_data)
 Proximity 18 read proximity function.
 

Detailed Description

This file contains API for Proximity 18 Click Driver.

Enumeration Type Documentation

◆ proximity18_return_value_t

Proximity 18 Click return value data.

Predefined enum values for driver return values.

Enumerator
PROXIMITY18_OK 
PROXIMITY18_ERROR