43#ifdef PREINIT_SUPPORTED
47#ifdef MikroCCoreVersion
48 #if MikroCCoreVersion >= 1
53#include "drv_digital_out.h"
54#include "drv_digital_in.h"
55#include "drv_i2c_master.h"
68#define PROXIMITY6_MAP_MIKROBUS( cfg, mikrobus ) \
69 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
70 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
71 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT );
78#define PROXIMITY6_OK 0
79#define PROXIMITY6_ERROR -1
86#define PROXIMITY6_REG_DATA_REGISTER_X1 0x00
87#define PROXIMITY6_REG_DATA_REGISTER_X2 0x01
88#define PROXIMITY6_REG_DATA_REGISTER_Y1 0x02
89#define PROXIMITY6_REG_DATA_REGISTER_Y2 0x03
90#define PROXIMITY6_REG_DATA_REGISTER_SAMPLE_I 0x04
91#define PROXIMITY6_REG_DATA_REGISTER_SAMPLE_X 0x05
92#define PROXIMITY6_REG_DATA_REGISTER_SAMPLE_Y 0x06
93#define PROXIMITY6_REG_RESERVED1 0x07
94#define PROXIMITY6_REG_ID_VERSION 0x08
95#define PROXIMITY6_REG_SLAVE_ADDRESS 0x09
96#define PROXIMITY6_REG_OSC_CAL_OUT 0x0A
97#define PROXIMITY6_REG_RESERVED2 0x0C
98#define PROXIMITY6_REG_SW_RESET 0x0F
99#define PROXIMITY6_REG_ADC_CONTROL_RESERVED1 0x10
100#define PROXIMITY6_REG_ADC_CONTROL_RESERVED2 0x11
101#define PROXIMITY6_REG_AFE_TRIM 0x12
102#define PROXIMITY6_REG_AFE_MUX_TEST 0x13
103#define PROXIMITY6_REG_RESERVED3 0x14
104#define PROXIMITY6_REG_LED_TRIM 0x16
105#define PROXIMITY6_REG_OS32K 0x18
106#define PROXIMITY6_REG_OS32M_BYPASS 0x19
107#define PROXIMITY6_REG_OS32M_TRIM 0x1A
108#define PROXIMITY6_REG_ADC_SPACING 0x1B
109#define PROXIMITY6_REG_INT_PIN 0x1C
110#define PROXIMITY6_REG_INT_PIN_POL 0x1D
111#define PROXIMITY6_REG_I2C 0x1E
112#define PROXIMITY6_REG_FIFO_TH 0x1F
113#define PROXIMITY6_REG_LED_OFFSET_WIDTH_GEST 0x20
114#define PROXIMITY6_REG_LED_PERIOD_PULSES_GEST 0x21
115#define PROXIMITY6_REG_LED_OFFSET_WIDTH_PROX 0x22
116#define PROXIMITY6_REG_LED_PERIOD_PULSES_PROX 0x23
117#define PROXIMITY6_REG_LED_MASK 0x24
118#define PROXIMITY6_REG_AFE_CONT_GEST 0x25
119#define PROXIMITY6_REG_AFE_CONT_PROX 0x26
120#define PROXIMITY6_REG_AFE_MASK 0x27
121#define PROXIMITY6_REG_GEST_DI_TH 0x28
122#define PROXIMITY6_REG_ORIENTATION 0x29
123#define PROXIMITY6_REG_PROX_TH_ON1 0x2A
124#define PROXIMITY6_REG_PROX_TH_OFF1 0x2B
125#define PROXIMITY6_REG_PROX_TH_ON2 0x2C
126#define PROXIMITY6_REG_PROX_TH_OFF2 0x2D
127#define PROXIMITY6_REG_PROX_TH_ON1_OFF1_HIGH 0x2E
128#define PROXIMITY6_REG_PROX_TH_ON2_OFF2_HIGH 0x2F
129#define PROXIMITY6_REG_TEST_MODE 0x30
130#define PROXIMITY6_REG_POWER_DOWN_CONT 0x32
131#define PROXIMITY6_REG_GAIN_CONT1 0x38
132#define PROXIMITY6_REG_GAIN_CONT2 0x39
133#define PROXIMITY6_REG_CH1_OFFSET 0x3A
134#define PROXIMITY6_REG_CH2_OFFSET 0x3B
135#define PROXIMITY6_REG_CH3_OFFSET 0x3C
136#define PROXIMITY6_REG_CH4_OFFSET 0x3D
137#define PROXIMITY6_REG_SLOPE_TH 0x3E
138#define PROXIMITY6_REG_FREQ 0x40
139#define PROXIMITY6_REG_LED_REF 0x41
140#define PROXIMITY6_REG_OP_TIME 0x42
141#define PROXIMITY6_REG_AFE_TIME 0x43
142#define PROXIMITY6_REG_DSAMPLE_TIME 0x44
143#define PROXIMITY6_REG_OPERATION_CONTROL 0x45
144#define PROXIMITY6_REG_DEC_MODE 0x46
145#define PROXIMITY6_REG_INT_MASK 0x48
146#define PROXIMITY6_REG_INT_STATUS 0x49
147#define PROXIMITY6_REG_I2C_STATUS 0x4A
148#define PROXIMITY6_REG_DATA_BUFFER_OUT 0x60
149#define PROXIMITY6_REG_DEBUG_X1L 0x68
150#define PROXIMITY6_REG_DEBUG_X2L 0x69
151#define PROXIMITY6_REG_DEBUG_Y1L 0x6A
152#define PROXIMITY6_REG_DEBUG_Y2L 0x6B
153#define PROXIMITY6_REG_DEBUG_X1H 0x6C
154#define PROXIMITY6_REG_DEBUG_X2H 0x6D
155#define PROXIMITY6_REG_DEBUG_Y1H 0x6E
156#define PROXIMITY6_REG_DEBUG_Y2H 0x6F
163#define PROXIMITY6_STANDBY_MODE 0
164#define PROXIMITY6_PROXIMITY_MODE 1
165#define PROXIMITY6_SAMPLE_MODE 2
166#define PROXIMITY6_IDLE_MODE 3
err_t proximity6_read_data(proximity6_t *ctx, proximity6_data_t *axis_out)
Data Read function.
err_t proximity6_set_mode(proximity6_t *ctx, uint8_t select_mode)
Mode Set function.
err_t proximity6_generic_write(proximity6_t *ctx, uint8_t reg, uint16_t *data_buf, uint8_t len)
Generic write function.
err_t proximity6_default_cfg(proximity6_t *ctx)
Click Default Configuration function.
err_t proximity6_generic_read(proximity6_t *ctx, uint8_t reg, uint16_t *data_out, uint8_t len)
Generic read function.
uint8_t proximity6_check_interrupt(proximity6_t *ctx)
Interrupt Check function.
err_t proximity6_init(proximity6_t *ctx, proximity6_cfg_t *cfg)
Initialization function.
void proximity6_cfg_setup(proximity6_cfg_t *cfg)
Config Object Initialization function.
Click configuration structure definition.
Definition proximity6.h:197
uint32_t i2c_speed
Definition proximity6.h:206
pin_name_t scl
Definition proximity6.h:199
pin_name_t int_pin
Definition proximity6.h:203
pin_name_t sda
Definition proximity6.h:200
uint8_t i2c_address
Definition proximity6.h:207
Click axis data structure definition.
Definition proximity6.h:215
uint16_t val_x2
Definition proximity6.h:217
uint16_t val_y2
Definition proximity6.h:219
uint16_t val_y1
Definition proximity6.h:218
uint16_t val_x1
Definition proximity6.h:216
Click ctx object definition.
Definition proximity6.h:180
digital_in_t int_pin
Definition proximity6.h:182
i2c_master_t i2c
Definition proximity6.h:185
uint8_t slave_address
Definition proximity6.h:188
uint8_t mode_sel
Definition proximity6.h:189