42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_i2c_master.h"
66#define PROXIMITY3_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
69 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
76#define PROXIMITY3_OK 0
77#define PROXIMITY3_ERROR -1
85#define PROXIMITY3_I2CADDR 0x51
86#define PROXIMITY3_ALS_CONF_REG 0x00
87#define PROXIMITY3_ALS_THDH_REG 0x01
88#define PROXIMITY3_ALS_THDL_REG 0x02
89#define PROXIMITY3_PS_CONF1_CONF2_REG 0x03
90#define PROXIMITY3_PS_CONF3_MS_REG 0x04
91#define PROXIMITY3_PS_CANC_REG 0x05
92#define PROXIMITY3_PS_THDL_REG 0x06
93#define PROXIMITY3_PS_THDH_REG 0x07
94#define PROXIMITY3_PROXIMITY_REG 0x08
95#define PROXIMITY3_AMBIENT_REG 0x09
96#define PROXIMITY3_WHITE_REG 0x0A
97#define PROXIMITY3_INT_FLAG_REG 0x0D
98#define PROXIMITY3_DEVICE_ID_REG 0x0E
105#define PROXIMITY3_DEVICE_ID_VALUE 0x1058
112#define PROXIMITY3_ALS_CONF_CONFIG 0x0040
113#define PROXIMITY3_PS_CONF1_CONF2_CONFIG 0x0A2A
114#define PROXIMITY3_PS_CONF3_MS_CONFIG 0x0770
115#define PROXIMITY3_PS_THDL_CONFIG 0x1388
116#define PROXIMITY3_PS_THDH_CONFIG 0x2EE0
uint16_t proximity3_read_16(proximity3_t *ctx, uint8_t reg_address)
Generic read function.
err_t proximity3_default_cfg(proximity3_t *ctx)
Proximity 3 default configuration function.
void proximity3_cfg_setup(proximity3_cfg_t *cfg)
Config Object Initialization function.
uint16_t proximity3_read_proximity(proximity3_t *ctx)
Read proximity.
err_t proximity3_write_16(proximity3_t *ctx, uint8_t reg_address, uint16_t data_in)
Generic write function.
uint16_t proximity3_read_als(proximity3_t *ctx)
Read ambient light sensor data.
err_t proximity3_init(proximity3_t *ctx, proximity3_cfg_t *cfg)
Initialization function.
Click configuration structure definition.
Definition proximity3.h:146
uint32_t i2c_speed
Definition proximity3.h:155
pin_name_t scl
Definition proximity3.h:148
pin_name_t int_pin
Definition proximity3.h:152
pin_name_t sda
Definition proximity3.h:149
uint8_t i2c_address
Definition proximity3.h:156
Click ctx object definition.
Definition proximity3.h:130
digital_in_t int_pin
Definition proximity3.h:132
i2c_master_t i2c
Definition proximity3.h:135
uint8_t slave_address
Definition proximity3.h:138