37#ifdef PREINIT_SUPPORTED
41#ifdef MikroCCoreVersion
42 #if MikroCCoreVersion >= 1
47#include "drv_digital_out.h"
48#include "drv_digital_in.h"
49#include "drv_i2c_master.h"
61#define ACCEL5_MAP_MIKROBUS( cfg, mikrobus ) \
62 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
63 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
64 cfg.it2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
65 cfg.it1 = MIKROBUS( mikrobus, MIKROBUS_INT );
74#define ACCEL5_INIT_ERROR (-1)
81#define ACCEL5_CHIP_ID 0x90
88#define ACCEL5_REG_CHIP_ID 0x00
89#define ACCEL5_REG_ERR_REG 0x02
90#define ACCEL5_REG_STATUS 0x03
91#define ACCEL5_REG_ACC_X_LSB 0x04
92#define ACCEL5_REG_ACC_X_MSB 0x05
93#define ACCEL5_REG_ACC_Y_LSB 0x06
94#define ACCEL5_REG_ACC_Y_MSB 0x07
95#define ACCEL5_REG_ACC_Z_LSB 0x08
96#define ACCEL5_REG_ACC_Z_MSB 0x09
97#define ACCEL5_REG_SENSOR_TIME_0 0x0A
98#define ACCEL5_REG_SENSOR_TIME_1 0x0B
99#define ACCEL5_REG_SENSOR_TIME_2 0x0C
100#define ACCEL5_REG_EVENT 0x0D
101#define ACCEL5_REG_INT_STATUS_0 0x0E
102#define ACCEL5_REG_INT_STATUS_1 0x0F
103#define ACCEL5_REG_INT_STATUS_2 0x10
104#define ACCEL5_REG_TEMPERATURE 0x11
105#define ACCEL5_REG_FIFO_LENGTH_0 0x12
106#define ACCEL5_REG_FIFO_LENGTH_1 0x13
107#define ACCEL5_REG_FIFO_DATA 0x14
108#define ACCEL5_REG_STEP_CNT_0 0x15
109#define ACCEL5_REG_STEP_CNT_1 0x16
110#define ACCEL5_REG_STEP_CNT_2 0x17
111#define ACCEL5_REG_STEP_STATUS 0x18
112#define ACCEL5_REG_ACC_CONGIG_0 0x19
113#define ACCEL5_REG_ACC_CONGIG_1 0x1A
114#define ACCEL5_REG_ACC_CONGIG_2 0x1B
115#define ACCEL5_REG_INT_CONFIG_0 0x1F
116#define ACCEL5_REG_INT_CONFIG_1 0x20
117#define ACCEL5_REG_INT1_MAP 0x21
118#define ACCEL5_REG_INT2_MAP 0x22
119#define ACCEL5_REG_INT12_MAP 0x23
120#define ACCEL5_REG_INT12_IO_CTRL 0x24
121#define ACCEL5_REG_FIFO_CONFIG_0 0x26
122#define ACCEL5_REG_FIFO_CONFIG_1 0x27
123#define ACCEL5_REG_FIFO_CONFIG_2 0x28
124#define ACCEL5_REG_FIFO_PWR_CONFIG 0x29
125#define ACCEL5_REG_AUTO_LOW_POW_0 0x2A
126#define ACCEL5_REG_AUTO_LOW_POW_1 0x2B
127#define ACCEL5_REG_AUTO_WAKEUP_0 0x2C
128#define ACCEL5_REG_AUTO_WAKEUP_1 0x2D
129#define ACCEL5_REG_WAKEUP_CONFIG_0 0x2F
130#define ACCEL5_REG_WAKEUP_CONFIG_1 0x30
131#define ACCEL5_REG_WAKEUP_CONFIG_2 0x31
132#define ACCEL5_REG_WAKEUP_CONFIG_3 0x32
133#define ACCEL5_REG_WAKEUP_CONFIG_4 0x33
134#define ACCEL5_REG_ORIENTCH_CONFIG_0 0x35
135#define ACCEL5_REG_ORIENTCH_CONFIG_1 0x36
136#define ACCEL5_REG_ORIENTCH_CONFIG_2 0x37
137#define ACCEL5_REG_ORIENTCH_CONFIG_3 0x38
138#define ACCEL5_REG_ORIENTCH_CONFIG_4 0x39
139#define ACCEL5_REG_ORIENTCH_CONFIG_5 0x3A
140#define ACCEL5_REG_ORIENTCH_CONFIG_6 0x3B
141#define ACCEL5_REG_ORIENTCH_CONFIG_7 0x3C
142#define ACCEL5_REG_ORIENTCH_CONFIG_8 0x3D
143#define ACCEL5_REG_ORIENTCH_CONFIG_9 0x3E
144#define ACCEL5_REG_GEN1_INT_CONFIG_0 0x3F
145#define ACCEL5_REG_GEN1_INT_CONFIG_1 0x40
146#define ACCEL5_REG_GEN1_INT_CONFIG_2 0x41
147#define ACCEL5_REG_GEN1_INT_CONFIG_3 0x42
148#define ACCEL5_REG_GEN1_INT_CONFIG_31 0x43
149#define ACCEL5_REG_GEN1_INT_CONFIG_4 0x44
150#define ACCEL5_REG_GEN1_INT_CONFIG_5 0x45
151#define ACCEL5_REG_GEN1_INT_CONFIG_6 0x46
152#define ACCEL5_REG_GEN1_INT_CONFIG_7 0x47
153#define ACCEL5_REG_GEN1_INT_CONFIG_8 0x48
154#define ACCEL5_REG_GEN1_INT_CONFIG_9 0x49
155#define ACCEL5_REG_GEN2_INT_CONFIG_0 0x4A
156#define ACCEL5_REG_GEN2_INT_CONFIG_1 0x4B
157#define ACCEL5_REG_GEN2_INT_CONFIG_2 0x4C
158#define ACCEL5_REG_GEN2_INT_CONFIG_3 0x4D
159#define ACCEL5_REG_GEN2_INT_CONFIG_31 0x4E
160#define ACCEL5_REG_GEN2_INT_CONFIG_4 0x4F
161#define ACCEL5_REG_GEN2_INT_CONFIG_5 0x50
162#define ACCEL5_REG_GEN2_INT_CONFIG_6 0x51
163#define ACCEL5_REG_GEN2_INT_CONFIG_7 0x52
164#define ACCEL5_REG_GEN2_INT_CONFIG_8 0x53
165#define ACCEL5_REG_GEN2_INT_CONFIG_9 0x54
166#define ACCEL5_REG_ACTCH_CONFIG_0 0x55
167#define ACCEL5_REG_ACTCH_CONFIG_1 0x56
168#define ACCEL5_REG_TAP_CONFIG_0 0x57
169#define ACCEL5_REG_TAP_CONFIG_1 0x58
170#define ACCEL5_REG_STEP_CNT_CONFIG_0 0x59
171#define ACCEL5_REG_STEP_CNT_CONFIG_1 0x5A
172#define ACCEL5_REG_STEP_CNT_CONFIG_2 0x5B
173#define ACCEL5_REG_STEP_CNT_CONFIG_3 0x5C
174#define ACCEL5_REG_STEP_CNT_CONFIG_4 0x5D
175#define ACCEL5_REG_STEP_CNT_CONFIG_5 0x5E
176#define ACCEL5_REG_STEP_CNT_CONFIG_6 0x5F
177#define ACCEL5_REG_STEP_CNT_CONFIG_7 0x60
178#define ACCEL5_REG_STEP_CNT_CONFIG_8 0x61
179#define ACCEL5_REG_STEP_CNT_CONFIG_9 0x62
180#define ACCEL5_REG_STEP_CNT_CONFIG_10 0x63
181#define ACCEL5_REG_STEP_CNT_CONFIG_11 0x64
182#define ACCEL5_REG_STEP_CNT_CONFIG_12 0x65
183#define ACCEL5_REG_STEP_CNT_CONFIG_13 0x66
184#define ACCEL5_REG_STEP_CNT_CONFIG_14 0x67
185#define ACCEL5_REG_STEP_CNT_CONFIG_15 0x68
186#define ACCEL5_REG_STEP_CNT_CONFIG_16 0x69
187#define ACCEL5_REG_STEP_CNT_CONFIG_17 0x6A
188#define ACCEL5_REG_STEP_CNT_CONFIG_18 0x6B
189#define ACCEL5_REG_STEP_CNT_CONFIG_19 0x6C
190#define ACCEL5_REG_STEP_CNT_CONFIG_20 0x6D
191#define ACCEL5_REG_STEP_CNT_CONFIG_21 0x6E
192#define ACCEL5_REG_STEP_CNT_CONFIG_22 0x6F
193#define ACCEL5_REG_STEP_CNT_CONFIG_23 0x70
194#define ACCEL5_REG_STEP_CNT_CONFIG_24 0x71
195#define ACCEL5_REG_IF_CONFIG 0x7C
196#define ACCEL5_REG_SELF_TEST 0x7D
197#define ACCEL5_REG_CMD 0x7E
204#define ACCEL5_ERROR_CMD 0x02
211#define ACCEL5_STATUS_DATA_RDY_START 0x80
212#define ACCEL5_STATUS_RDY_CMD 0x10
213#define ACCEL5_STATUS_NORMAL_MODE 0x04
214#define ACCEL5_STATUS_LOW_POWER_MODE 0x02
215#define ACCEL5_STATUS_SLEEP_MODE 0x04
216#define ACCEL5_STATUS_INT_ACTIVE_TRIGGERED 0x01
217#define ACCEL5_STATUS_INT_ACTIVE_NOT_TRIGGERED 0x00
224#define ACCEL5_EVENT_POR_DETECTED 0x01
231#define ACCEL5_INT_STATUS_0_DATA_RDY_STATUS 0x80
232#define ACCEL5_INT_STATUS_0_FIFO_WATERMARK 0x40
233#define ACCEL5_INT_STATUS_0_FIFO_FULL 0x20
234#define ACCEL5_INT_STATUS_0_IENG_OVERRUN_STATUS 0x10
235#define ACCEL5_INT_STATUS_0_GEN2_INT_STATUS 0x08
236#define ACCEL5_INT_STATUS_0_GEN1_INT_STATUS 0x04
237#define ACCEL5_INT_STATUS_0_ORIENTCH_INT_STATUS 0x02
238#define ACCEL5_INT_STATUS_0_WAKEUP_INT_STATUS 0x01
245#define ACCEL5_INT_STATUS_1_IENG_OVERRUN_STATUS 0x10
246#define ACCEL5_INT_STATUS_1_DOUBLE_TAP 0x08
247#define ACCEL5_INT_STATUS_1_SINGLE_TAP 0x04
248#define ACCEL5_INT_STATUS_1_STEP_NO_SET 0x00
249#define ACCEL5_INT_STATUS_1_STEP_SET 0x01
250#define ACCEL5_INT_STATUS_1_STEP_DETECT 0x02
251#define ACCEL5_INT_STATUS_1_STEP_NO_USED 0x03
258#define ACCEL5_INT_STATUS_2_IENG_OVERRUN_STATUS 0x10
259#define ACCEL5_INT_STATUS_2_ACTCH_Z_INIT_STATUS 0x04
260#define ACCEL5_INT_STATUS_2_ACTCH_Y_INIT_STATUS 0x02
261#define ACCEL5_INT_STATUS_2_ACTCH_X_INIT_STATUS 0x01
268#define ACCEL5_STEP_STATUS_WALKING 0x01
269#define ACCEL5_STEP_STATUS_RUNNING 0x02
270#define ACCEL5_STEP_STATUS_NO_WALK_RUN 0x00
277#define ACCEL5_CFG_0_FILT1_BW_LOW_0_2X_ODR 0x80
278#define ACCEL5_CFG_0_FILT1_BW_HIGH_0_4X_ODR 0x00
279#define ACCEL5_CFG_0_SLEEP_MODE 0x00
280#define ACCEL5_CFG_0_LOW_POWER_MODE 0x01
281#define ACCEL5_CFG_0_NORMAL_MODE 0x02
288#define ACCEL5_CFG_1_ACC_RANGE_2g 0x00
289#define ACCEL5_CFG_1_ACC_RANGE_4g 0x40
290#define ACCEL5_CFG_1_ACC_RANGE_8g 0x80
291#define ACCEL5_CFG_1_ACC_RANGE_16g 0xC0
292#define ACCEL5_CFG_1_OSR_LOW_POWER 0x00
293#define ACCEL5_CFG_1_OSR_HIGH_POWER 0x30
294#define ACCEL5_CFG_1_ODR_12p5_5 0x00
295#define ACCEL5_CFG_1_ODR_12p5_4 0x01
296#define ACCEL5_CFG_1_ODR_12p5_3 0x02
297#define ACCEL5_CFG_1_ODR_12p5_2 0x03
298#define ACCEL5_CFG_1_ODR_12p5_1 0x04
299#define ACCEL5_CFG_1_ODR_12p5 0x05
300#define ACCEL5_CFG_1_ODR_25 0x06
301#define ACCEL5_CFG_1_ODR_50 0x07
302#define ACCEL5_CFG_1_ODR_100 0x08
303#define ACCEL5_CFG_1_ODR_200 0x09
304#define ACCEL5_CFG_1_ODR_400 0x0A
305#define ACCEL5_CFG_1_ODR_800 0x0B
306#define ACCEL5_CFG_1_ODR_800_1 0x0C
307#define ACCEL5_CFG_1_ODR_800_2 0x0D
308#define ACCEL5_CFG_1_ODR_800_3 0x0E
309#define ACCEL5_CFG_1_ODR_800_4 0x0F
316#define ACCEL5_CFG_2_DATA_SCR_ACC_FILT_1 0x00
317#define ACCEL5_CFG_2_DATA_SCR_ACC_FILT_2 0x04
318#define ACCEL5_CFG_2_DATA_SCR_ACC_FILT_LP 0x08
325#define ACCEL5_INT_CFG_0_DATA_RDY 0x80
326#define ACCEL5_INT_CFG_0_FIFO_WATERMARK 0x40
327#define ACCEL5_INT_CFG_0_FIFO_FULL 0x20
328#define ACCEL5_INT_CFG_0_GEN2_INT_STATUS 0x08
329#define ACCEL5_INT_CFG_0_GEN1_INT_STATUS 0x04
330#define ACCEL5_INT_CFG_0_ORIENTCH_INT 0x02
337#define ACCEL5_INT_CFG_1_LATCH_MODE_NOLATCH 0x00
338#define ACCEL5_INT_CFG_1_LATCH_MODE_LATCHING 0x80
339#define ACCEL5_INT_CFG_1_ACTCH_INT_ENABLE 0x10
340#define ACCEL5_INT_CFG_1_DOUBLE_TAP_ENABLE 0x08
341#define ACCEL5_INT_CFG_1_SINGLE_TAP_ENABLE 0x04
342#define ACCEL5_INT_CFG_1_STEP_INT_ENABLE 0x01
349#define ACCEL5_INT1_MAP_DATA_RDY_STATUS 0x80
350#define ACCEL5_INT1_MAP_FIFO_WATERMARK 0x40
351#define ACCEL5_INT1_MAP_FIFO_FULL 0x20
352#define ACCEL5_INT1_MAP_IENG_OVERRUN_STATUS 0x10
353#define ACCEL5_INT1_MAP_GEN2_INT_STATUS 0x08
354#define ACCEL5_INT1_MAP_GEN1_INT_STATUS 0x04
355#define ACCEL5_INT1_MAP_ORIENTCH_INT_STATUS 0x02
356#define ACCEL5_INT1_MAP_WAKEUP_INT_STATUS 0x01
363#define ACCEL5_INT2_MAP_DATA_RDY_STATUS 0x80
364#define ACCEL5_INT2_MAP_FIFO_WATERMARK 0x40
365#define ACCEL5_INT2_MAP_FIFO_FULL 0x20
366#define ACCEL5_INT2_MAP_IENG_OVERRUN_STATUS 0x10
367#define ACCEL5_INT2_MAP_GEN2_INT_STATUS 0x08
368#define ACCEL5_INT2_MAP_GEN1_INT_STATUS 0x04
369#define ACCEL5_INT2_MAP_ORIENTCH_INT_STATUS 0x02
370#define ACCEL5_INT2_MAP_WAKEUP_INT_STATUS 0x01
377#define ACCEL5_INT12_MAP_ACTCH_INT2 0x80
378#define ACCEL5_INT12_MAP_TAP_INT2 0x40
379#define ACCEL5_INT12_MAP_STEP_INT2 0x10
380#define ACCEL5_INT12_MAP_ACTCH_INT1 0x08
381#define ACCEL5_INT12_MAP_TAP_INT1 0x04
382#define ACCEL5_INT12_MAP_STEP_INT1 0x01
389#define ACCEL5_INT12_CTRL_INT2_OPEN_DRAIN 0x40
390#define ACCEL5_INT12_CTRL_INT1_OPEN_DRAIN 0x04
391#define ACCEL5_INT12_CTRL_INT2_HIGH_ACTIVE 0x20
392#define ACCEL5_INT12_CTRL_INT1_HIGH_ACTIVE 0x02
399#define ACCEL5_FIFO_CFG0_Z_AXIS_ENABLE 0x80
400#define ACCEL5_FIFO_CFG0_Y_AXIS_ENABLE 0x40
401#define ACCEL5_FIFO_CFG0_X_AXIS_ENABLE 0x20
402#define ACCEL5_FIFO_CFG0_8bit_ENABLE 0x10
403#define ACCEL5_FIFO_CFG0_DATA_SRC_ENABLE 0x08
404#define ACCEL5_FIFO_CFG0_TIME_ENABLE 0x04
405#define ACCEL5_FIFO_CFG0_STOP_NO_FULL_ENABLE 0x02
406#define ACCEL5_FIFO_CFG0_AUTO_FLUSH_ENABLE 0x01
413#define ACCEL5_FIFO_AUTO_IP_TIMEOUT_0 0x00
414#define ACCEL5_FIFO_AUTO_IP_TIMEOUT_1 0x04
415#define ACCEL5_FIFO_AUTO_IP_TIMEOUT_2 0x08
416#define ACCEL5_FIFO_AUTO_IP_TIMEOUT_3 0x0C
417#define ACCEL5_FIFO_AUTO_TRIG_GEN1_INT 0x02
418#define ACCEL5_FIFO_AUTO_TRIG_DATA_RDY 0x01
425#define ACCEL5_WAKEUP_TIMEOUT_ENABLE 0x04
426#define ACCEL5_WAKEUP_ENABLE 0x02
433#define ACCEL5_WAKEUP_Z_AXIS_ENABLE 0x80
434#define ACCEL5_WAKEUP_Y_AXIS_ENABLE 0x40
435#define ACCEL5_WAKEUP_X_AXIS_ENABLE 0x20
436#define ACCEL5_WAKEUP_NUMBER_OF_SIMPLE 0x10
437#define ACCEL5_WAKEUP_REFU_MANUAL 0x00
438#define ACCEL5_WAKEUP_REFU_ONETIME 0x01
439#define ACCEL5_WAKEUP_REFU_EVERYTIME 0x02
446#define ACCEL5_ORIENT_Z_AXIS_ENABLE 0x80
447#define ACCEL5_ORIENT_Y_AXIS_ENABLE 0x40
448#define ACCEL5_ORIENT_X_AXIS_ENABLE 0x20
449#define ACCEL5_ORIENT_DATA_SRC_ENABLE 0x10
450#define ACCEL5_ORIENT_REFU_MANUAL 0x00
451#define ACCEL5_ORIENT_REFU_ONETIME_2 0x04
452#define ACCEL5_ORIENT_REFU_ONETIME_IP 0x08
453#define ACCEL5_ORIENT_STABILITY_INACTIVE 0x00
454#define ACCEL5_ORIENT_STABILITY_ENABLED_1 0x01
455#define ACCEL5_ORIENT_STABILITY_ENABLED_2 0x02
462#define ACCEL5_GEN1_CFG0_ACT_Z_ENABLE 0x80
463#define ACCEL5_GEN1_CFG0_ACT_Y_ENABLE 0x40
464#define ACCEL5_GEN1_CFG0_ACT_X_ENABLE 0x20
465#define ACCEL5_GEN1_CFG0_DATA_ENABLE 0x10
466#define ACCEL5_GEN1_CFG0_REFU_MANUAL 0x00
467#define ACCEL5_GEN1_CFG0_REFU_ONETIME 0x04
468#define ACCEL5_GEN1_CFG0_REFU_EVERYTIME 0x08
469#define ACCEL5_GEN1_CFG0_HYST_24mg 0x01
470#define ACCEL5_GEN1_CFG0_HYST_48mg 0x02
471#define ACCEL5_GEN1_CFG0_HYST_96mg 0x03
472#define ACCEL5_GEN1_CFG0_HYST_NO_ACTIVE 0x00
479#define ACCEL5_GEN1_CFG1_CRITERION_SEL_ACTIVE 0x20
480#define ACCEL5_GEN1_CFG1_CRITERION_SEL_INACTIVE 0x00
481#define ACCEL5_GEN1_CFG1_COMB_SEL_AND 0x10
482#define ACCEL5_GEN1_CFG1_COMB_SEL_OR 0x00
489#define ACCEL5_GEN2_CFG0_ACT_Z_ENABLE 0x80
490#define ACCEL5_GEN2_CFG0_ACT_Y_ENABLE 0x40
491#define ACCEL5_GEN2_CFG0_ACT_X_ENABLE 0x20
492#define ACCEL5_GEN2_CFG0_DATA_ENABLE 0x10
493#define ACCEL5_GEN2_CFG0_REFU_MANUAL 0x00
494#define ACCEL5_GEN2_CFG0_REFU_ONETIME 0x04
495#define ACCEL5_GEN2_CFG0_REFU_EVERYTIME 0x08
496#define ACCEL5_GEN2_CFG0_HYST_24mg 0x01
497#define ACCEL5_GEN2_CFG0_HYST_48mg 0x02
498#define ACCEL5_GEN2_CFG0_HYST_96mg 0x03
499#define ACCEL5_GEN2_CFG0_HYST_NO_ACTIVE 0x00
506#define ACCEL5_GEN2_CFG1_CRITERION_SEL_ACTIVE 0x20
507#define ACCEL5_GEN2_CFG1_CRITERION_SEL_INACTIVE 0x00
508#define ACCEL5_GEN2_CFG1_COMB_SEL_AND 0x10
509#define ACCEL5_GEN2_CFG1_COMB_SEL_OR 0x00
516#define ACCEL5_ACTCH_CFG0_Z_AXIS_ENABLE 0x80
517#define ACCEL5_ACTCH_CFG0_Y_AXIS_ENABLE 0x40
518#define ACCEL5_ACTCH_CFG0_X_AXIS_ENABLE 0x20
519#define ACCEL5_ACTCH_CFG0_DATA_ENABLE 0x10
520#define ACCEL5_ACTCH_CFG0_NPTS_POINT_32 0x00
521#define ACCEL5_ACTCH_CFG0_NPTS_POINT_64 0x01
522#define ACCEL5_ACTCH_CFG0_NPTS_POINT_128 0x02
523#define ACCEL5_ACTCH_CFG0_NPTS_POINT_256 0x03
524#define ACCEL5_ACTCH_CFG0_NPTS_POINT_512 0x04
531#define ACCEL5_TAP_CFG0_USE_Z_AXIS 0x00
532#define ACCEL5_TAP_CFG0_USE_Y_AXIS 0x01
533#define ACCEL5_TAP_CFG0_USE_X_AXIS 0x02
534#define ACCEL5_TAP_CFG0_TAP_SEL_HIGH 0x00
535#define ACCEL5_TAP_CFG0_TAP_SEL_LOW 0x10
542#define ACCEL5_TAP_CFG1_QUIET_DT_SAMPLE_4 0x00
543#define ACCEL5_TAP_CFG1_QUIET_DT_SAMPLE_8 0x10
544#define ACCEL5_TAP_CFG1_QUIET_DT_SAMPLE_12 0x20
545#define ACCEL5_TAP_CFG1_QUIET_DT_SAMPLE_16 0x30
546#define ACCEL5_TAP_CFG1_QUIET_SAMPLE_60 0x00
547#define ACCEL5_TAP_CFG1_QUIET_SAMPLE_80 0x04
548#define ACCEL5_TAP_CFG1_QUIET_SAMPLE_100 0x08
549#define ACCEL5_TAP_CFG1_QUIET_SAMPLE_120 0x0C
550#define ACCEL5_TAP_CFG1_TICS_TH_SAMPLE_6 0x00
551#define ACCEL5_TAP_CFG1_TICS_TH_SAMPLE_9 0x01
552#define ACCEL5_TAP_CFG1_TICS_TH_SAMPLE_12 0x02
553#define ACCEL5_TAP_CFG1_TICS_TH_SAMPLE_18 0x03
560#define ACCEL5_IF_CONFIG_SPI_4_WIRE 0x00
561#define ACCEL5_IF_CONFIG_SPI_3_WIRE 0x01
568#define ACCEL5_TEST_SIGN_ENABLE 0x08
569#define ACCEL5_TEST_Z_AXIS_ENABLE 0x04
570#define ACCEL5_TEST_Y_AXIS_ENABLE 0x02
571#define ACCEL5_TEST_X_AXIS_ENABLE 0x01
578#define ACCEL5_CMD_FIFO_FLUSH 0xB0
579#define ACCEL5_CMD_STEP_CNT_CLEAR 0xB1
580#define ACCEL5_CMD_SOFTWARE_RESET 0xB6
587#define ACCEL5_X_AXIS 0x04
588#define ACCEL5_Y_AXIS 0x06
589#define ACCEL5_Z_AXIS 0x08
596#define DEVICE_ERROR 0x01
597#define DEVICE_OK 0x00
782 // End click Driver group
void accel5_default_cfg(accel5_t *ctx, uint8_t mode, uint8_t range)
Click Default Configuration function..
uint32_t accel5_sensor_time(accel5_t *ctx)
Functions for initialize the chip.
err_t accel5_init(accel5_t *ctx, accel5_cfg_t *cfg)
Initialization function.
int16_t accel5_get_axis(accel5_t *ctx, uint8_t axis)
Functions for read axis data.
err_t accel5_generic_read(accel5_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
uint16_t accel5_read_data(accel5_t *ctx, uint8_t reg)
Functions for read data from register.
uint8_t accel5_read_byte(accel5_t *ctx, uint8_t reg)
Functions for read byte from register.
float accel5_get_temperature(accel5_t *ctx)
Functions for read temperature.
void accel5_write_byte(accel5_t *ctx, uint8_t reg, uint8_t reg_data)
Functions for write one byte in register.
void accel5_cfg_setup(accel5_cfg_t *cfg)
Config Object Initialization function.
err_t accel5_generic_write(accel5_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
void accel5_soft_reset(accel5_t *ctx)
Functions for software reset.
Click configuration structure definition.
Definition accel5.h:632
pin_name_t it2
Definition accel5.h:640
uint32_t i2c_speed
Definition accel5.h:645
pin_name_t it1
Definition accel5.h:641
pin_name_t scl
Definition accel5.h:635
pin_name_t sda
Definition accel5.h:636
uint8_t i2c_address
Definition accel5.h:646
Click ctx object definition.
Definition accel5.h:611
digital_in_t it2
Definition accel5.h:615
i2c_master_t i2c
Definition accel5.h:620
uint8_t slave_address
Definition accel5.h:624
digital_in_t it1
Definition accel5.h:616