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"
55#include "drv_spi_master.h"
68#define C6DOFIMU12_MAP_MIKROBUS( cfg, mikrobus ) \
69 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
70 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
71 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
72 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
73 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
74 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
75 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
76 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
83#define C6DOFIMU12_MASTER_I2C 0
84#define C6DOFIMU12_MASTER_SPI 1
91#define C6DOFIMU12_RETVAL uint8_t
93#define C6DOFIMU12_OK 0x00
94#define C6DOFIMU12_INIT_ERROR 0xFF
101#define C6DOFIMU12_REG_I2C_ADDR_GND 0x68
102#define C6DOFIMU12_REG_I2C_ADDR_VCC 0x69
110#define C6DOFIMU12_REG_CHIP_ID_ADDR 0x00
111#define C6DOFIMU12_REG_ERROR 0x02
112#define C6DOFIMU12_REG_STATUS_ADDR 0x03
113#define C6DOFIMU12_REG_AUX_X_LSB_ADDR 0x04
114#define C6DOFIMU12_REG_ACC_X_LSB_ADDR 0x0C
115#define C6DOFIMU12_REG_GYR_X_LSB_ADDR 0x12
116#define C6DOFIMU12_REG_EVENT_ADDR 0x1B
117#define C6DOFIMU12_REG_INT_STATUS_0_ADDR 0x1C
118#define C6DOFIMU12_REG_INT_STATUS_1_ADDR 0x1D
119#define C6DOFIMU12_REG_SC_OUT_0_ADDR 0x1E
120#define C6DOFIMU12_REG_SYNC_COMMAND_ADDR 0x1E
121#define C6DOFIMU12_REG_GYR_CAS_GPIO0_ADDR 0x1E
122#define C6DOFIMU12_REG_INTERNAL_STATUS_ADDR 0x21
123#define C6DOFIMU12_REG_FIFO_LENGTH_0_ADDR 0X24
124#define C6DOFIMU12_REG_FIFO_DATA_ADDR 0X26
125#define C6DOFIMU12_REG_FEAT_PAGE_ADDR 0x2F
126#define C6DOFIMU12_REG_FEATURES_REG_ADDR 0x30
127#define C6DOFIMU12_REG_ACC_CONF_ADDR 0x40
128#define C6DOFIMU12_REG_GYR_CONF_ADDR 0x42
129#define C6DOFIMU12_REG_AUX_CONF_ADDR 0x44
130#define C6DOFIMU12_REG_FIFO_DOWNS_ADDR 0X45
131#define C6DOFIMU12_REG_FIFO_WTM_0_ADDR 0X46
132#define C6DOFIMU12_REG_FIFO_WTM_1_ADDR 0X47
133#define C6DOFIMU12_REG_FIFO_CONFIG_0_ADDR 0X48
134#define C6DOFIMU12_REG_FIFO_CONFIG_1_ADDR 0X49
135#define C6DOFIMU12_REG_AUX_DEV_ID_ADDR 0x4B
136#define C6DOFIMU12_REG_AUX_IF_CONF_ADDR 0x4C
137#define C6DOFIMU12_REG_AUX_RD_ADDR 0x4D
138#define C6DOFIMU12_REG_AUX_WR_ADDR 0x4E
139#define C6DOFIMU12_REG_AUX_WR_DATA_ADDR 0x4F
140#define C6DOFIMU12_REG_INT1_IO_CTRL_ADDR 0x53
141#define C6DOFIMU12_REG_INT2_IO_CTRL_ADDR 0x54
142#define C6DOFIMU12_REG_INT1_MAP_FEAT_ADDR 0x56
143#define C6DOFIMU12_REG_INT2_MAP_FEAT_ADDR 0x57
144#define C6DOFIMU12_REG_INT_MAP_DATA_ADDR 0x58
145#define C6DOFIMU12_REG_INIT_CTRL_ADDR 0x59
146#define C6DOFIMU12_REG_INIT_ADDR_0 0x5B
147#define C6DOFIMU12_REG_INIT_ADDR_1 0x5C
148#define C6DOFIMU12_REG_INIT_DATA_ADDR 0x5E
149#define C6DOFIMU12_REG_GYR_CRT_CONF_ADDR 0X69
150#define C6DOFIMU12_REG_NVM_CONF_ADDR 0x6A
151#define C6DOFIMU12_REG_IF_CONF_ADDR 0X6B
152#define C6DOFIMU12_REG_ACC_SELF_TEST_ADDR 0X6D
153#define C6DOFIMU12_REG_GYR_SELF_TEST_AXES_ADDR 0x6E
154#define C6DOFIMU12_REG_SELF_TEST_MEMS_ADDR 0X6F
155#define C6DOFIMU12_REG_NV_CONF_ADDR 0x70
156#define C6DOFIMU12_REG_ACC_OFF_COMP_0_ADDR 0X71
157#define C6DOFIMU12_REG_GYR_OFF_COMP_3_ADDR 0X74
158#define C6DOFIMU12_REG_GYR_OFF_COMP_6_ADDR 0X77
159#define C6DOFIMU12_REG_GYR_USR_GAIN_0_ADDR 0X78
160#define C6DOFIMU12_REG_PWR_CONF_ADDR 0x7C
161#define C6DOFIMU12_REG_PWR_CTRL_ADDR 0x7D
162#define C6DOFIMU12_REG_CMD_REG_ADDR 0x7E
169#define C6DOFIMU12_DEVICE_ID_VAL 0x24
176#define C6DOFIMU12_AUX_EN_MASK 0x01
177#define C6DOFIMU12_GYR_EN_MASK 0x02
178#define C6DOFIMU12_ACC_EN_MASK 0x04
179#define C6DOFIMU12_TEMP_EN_MASK 0x08
186#define C6DOFIMU12_ACC_PWR_OPTIMIZED 0x00
187#define C6DOFIMU12_ACC_OSR2_PWR_PERFORMANCE 0x80
194#define C6DOFIMU12_ACC_OSR4_AVG1 0x00
195#define C6DOFIMU12_ACC_OSR2_AVG2 0x10
196#define C6DOFIMU12_ACC_NORMAL_AVG4 0x20
197#define C6DOFIMU12_ACC_CIC_AVG8 0x30
198#define C6DOFIMU12_ACC_RES_AVG16 0x40
199#define C6DOFIMU12_ACC_RES_AVG32 0x50
200#define C6DOFIMU12_ACC_RES_AVG64 0x60
201#define C6DOFIMU12_ACC_RES_AVG128 0x70
208#define C6DOFIMU12_ACC_ODR_0_78HZ 0x01
209#define C6DOFIMU12_ACC_ODR_1_56HZ 0x02
210#define C6DOFIMU12_ACC_ODR_3_12HZ 0x03
211#define C6DOFIMU12_ACC_ODR_6_25HZ 0x04
212#define C6DOFIMU12_ACC_ODR_12_5HZ 0x05
213#define C6DOFIMU12_ACC_ODR_25HZ 0x06
214#define C6DOFIMU12_ACC_ODR_50HZ 0x07
215#define C6DOFIMU12_ACC_ODR_100HZ 0x08
216#define C6DOFIMU12_ACC_ODR_200HZ 0x09
217#define C6DOFIMU12_ACC_ODR_400HZ 0x0A
218#define C6DOFIMU12_ACC_ODR_800HZ 0x0B
219#define C6DOFIMU12_ACC_ODR_1600HZ 0x0C
226#define C6DOFIMU12_ACC_RANGE_2G 0x00
227#define C6DOFIMU12_ACC_RANGE_4G 0x01
228#define C6DOFIMU12_ACC_RANGE_8G 0x02
229#define C6DOFIMU12_ACC_RANGE_16G 0x03
236#define C6DOFIMU12_ACC_RANGE_MASK 0x03
237#define C6DOFIMU12_ACC_ODR_MASK 0x0F
238#define C6DOFIMU12_ACC_BW_PARAM_MASK 0x70
239#define C6DOFIMU12_ACC_FILTER_PERF_MODE_MASK 0x80
245#define C6DOFIMU12_ACC_BW_PARAM_POS 0x04
246#define C6DOFIMU12_ACC_FILTER_PERF_MODE_POS 0x07
252#define C6DOFIMU12_ACC_SELF_TEST_RANGE 16
258#define C6DOFIMU12_ST_ACC_X_SIG_MIN_DIFF 1800
259#define C6DOFIMU12_ST_ACC_X_SIG_MAX_DIFF 10200
260#define C6DOFIMU12_ST_ACC_Y_SIG_MIN_DIFF -10200
261#define C6DOFIMU12_ST_ACC_Y_SIG_MAX_DIFF -1800
262#define C6DOFIMU12_ST_ACC_Z_SIG_MIN_DIFF 800
263#define C6DOFIMU12_ST_ACC_Z_SIG_MAX_DIFF 10200
269#define C6DOFIMU12_ACC_SELF_TEST_EN_MASK 0x01
270#define C6DOFIMU12_ACC_SELF_TEST_SIGN_MASK 0x04
271#define C6DOFIMU12_ACC_SELF_TEST_AMP_MASK 0x08
277#define C6DOFIMU12_ACC_SELF_TEST_SIGN_POS 0x02
278#define C6DOFIMU12_ACC_SELF_TEST_AMP_POS 0x03
282#define C6DOFIMU12_GYR_ST_AXES_DONE_MASK 0X01
283#define C6DOFIMU12_GYR_AXIS_X_OK_MASK 0x02
284#define C6DOFIMU12_GYR_AXIS_Y_OK_MASK 0x04
285#define C6DOFIMU12_GYR_AXIS_Z_OK_MASK 0x08
288#define C6DOFIMU12_GYR_AXIS_X_OK_POS 0x01
289#define C6DOFIMU12_GYR_AXIS_Y_OK_POS 0x02
290#define C6DOFIMU12_GYR_AXIS_Z_OK_POS 0x03
293#define C6DOFIMU12_GYR_PWR_OPTIMIZED 0x00
294#define C6DOFIMU12_GYR_PWR_PERFORMANCE 0x80
297#define C6DOFIMU12_GYR_NOISE_OPTIMIZED 0x00
298#define C6DOFIMU12_GYR_NOISE_PERFORMANCE 0x40
301#define C6DOFIMU12_GYR_OSR4_MODE 0x00
302#define C6DOFIMU12_GYR_OSR2_MODE 0x10
303#define C6DOFIMU12_GYR_NORMAL_MODE 0x20
304#define C6DOFIMU12_GYR_CIC_MODE 0x30
307#define C6DOFIMU12_GYR_ODR_25HZ 0x06
308#define C6DOFIMU12_GYR_ODR_50HZ 0x07
309#define C6DOFIMU12_GYR_ODR_100HZ 0x08
310#define C6DOFIMU12_GYR_ODR_200HZ 0x09
311#define C6DOFIMU12_GYR_ODR_400HZ 0x0A
312#define C6DOFIMU12_GYR_ODR_800HZ 0x0B
313#define C6DOFIMU12_GYR_ODR_1600HZ 0x0C
314#define C6DOFIMU12_GYR_ODR_3200HZ 0x0D
317#define C6DOFIMU12_GYR_OIS_250 0x00
318#define C6DOFIMU12_GYR_OIS_2000 0x01
321#define C6DOFIMU12_GYR_RANGE_2000 0x00
322#define C6DOFIMU12_GYR_RANGE_1000 0x01
323#define C6DOFIMU12_GYR_RANGE_500 0x02
324#define C6DOFIMU12_GYR_RANGE_250 0x03
325#define C6DOFIMU12_GYR_RANGE_125 0x04
328#define C6DOFIMU12_GYR_RANGE_MASK 0x07
329#define C6DOFIMU12_GYR_OIS_RANGE_MASK 0x08
330#define C6DOFIMU12_GYR_ODR_MASK 0x0F
331#define C6DOFIMU12_GYR_BW_PARAM_MASK 0x30
332#define C6DOFIMU12_GYR_NOISE_PERF_MODE_MASK 0x40
333#define C6DOFIMU12_GYR_FILTER_PERF_MODE_MASK 0x80
336#define C6DOFIMU12_GYR_OIS_RANGE_POS 0x03
337#define C6DOFIMU12_GYR_BW_PARAM_POS 0x04
338#define C6DOFIMU12_GYR_NOISE_PERF_MODE_POS 0x06
339#define C6DOFIMU12_GYR_FILTER_PERF_MODE_POS 0x07
342#define C6DOFIMU12_AUX_ODR_RESERVED 0x00
343#define C6DOFIMU12_AUX_ODR_0_78HZ 0x01
344#define C6DOFIMU12_AUX_ODR_1_56HZ 0x02
345#define C6DOFIMU12_AUX_ODR_3_12HZ 0x03
346#define C6DOFIMU12_AUX_ODR_6_25HZ 0x04
347#define C6DOFIMU12_AUX_ODR_12_5HZ 0x05
348#define C6DOFIMU12_AUX_ODR_25HZ 0x06
349#define C6DOFIMU12_AUX_ODR_50HZ 0x07
350#define C6DOFIMU12_AUX_ODR_100HZ 0x08
351#define C6DOFIMU12_AUX_ODR_200HZ 0x09
352#define C6DOFIMU12_AUX_ODR_400HZ 0x0A
353#define C6DOFIMU12_AUX_ODR_800HZ 0x0B
356#define C6DOFIMU12_PWR_CONF_ADV_PWR_SAVE_DISABLED 0x00
357#define C6DOFIMU12_PWR_CONF_ADV_PWR_SAVE_ENABLED 0x01
358#define C6DOFIMU12_FIFO_READ_DISABLED 0x00
359#define C6DOFIMU12_FIFO_READ_ENABLED 0x02
360#define C6DOFIMU12_FAST_PWR_UP_DISABLED 0x00
361#define C6DOFIMU12_FAST_PWR_UP_ENABLED 0x04
364#define C6DOFIMU12_CMD_INITIALIZATION_START 0x00
365#define C6DOFIMU12_CMD_INITIALIZATION_STOP 0x01
368#define C6DOFIMU12_AUX_READ_LEN_0 0x00
369#define C6DOFIMU12_AUX_READ_LEN_1 0x01
370#define C6DOFIMU12_AUX_READ_LEN_2 0x02
371#define C6DOFIMU12_AUX_READ_LEN_3 0x03
374#define C6DOFIMU12_AUX_SET_I2C_ADDR_MASK 0xFE
375#define C6DOFIMU12_AUX_MAN_MODE_EN_MASK 0x80
376#define C6DOFIMU12_AUX_FCU_WR_EN_MASK 0x40
377#define C6DOFIMU12_AUX_MAN_READ_BURST_MASK 0x0C
378#define C6DOFIMU12_AUX_READ_BURST_MASK 0x03
379#define C6DOFIMU12_AUX_ODR_EN_MASK 0x0F
380#define C6DOFIMU12_AUX_OFFSET_READ_OUT_MASK 0xF0
383#define C6DOFIMU12_AUX_SET_I2C_ADDR_POS 0x01
384#define C6DOFIMU12_AUX_MAN_MODE_EN_POS 0x07
385#define C6DOFIMU12_AUX_FCU_WR_EN_POS 0x06
386#define C6DOFIMU12_AUX_MAN_READ_BURST_POS 0x02
387#define C6DOFIMU12_AUX_OFFSET_READ_OUT_POS 0x04
390#define C6DOFIMU12_FIFO_VIRT_FRM_MODE 0x03
393#define C6DOFIMU12_FIFO_HEADER_ACC_FRM 0x84
394#define C6DOFIMU12_FIFO_HEADER_AUX_FRM 0x90
395#define C6DOFIMU12_FIFO_HEADER_GYR_FRM 0x88
396#define C6DOFIMU12_FIFO_HEADER_GYR_ACC_FRM 0x8C
397#define C6DOFIMU12_FIFO_HEADER_AUX_ACC_FRM 0x94
398#define C6DOFIMU12_FIFO_HEADER_AUX_GYR_FRM 0x98
399#define C6DOFIMU12_FIFO_HEADER_ALL_FRM 0x9C
400#define C6DOFIMU12_FIFO_HEADER_SENS_TIME_FRM 0x44
401#define C6DOFIMU12_FIFO_HEADER_SKIP_FRM 0x40
402#define C6DOFIMU12_FIFO_HEADER_INPUT_CFG_FRM 0x48
403#define C6DOFIMU12_FIFO_HEAD_OVER_READ_MSB 0x80
404#define C6DOFIMU12_FIFO_VIRT_ACT_RECOG_FRM 0xC8
407#define C6DOFIMU12_FIFO_HEAD_LESS_ACC_FRM 0x40
408#define C6DOFIMU12_FIFO_HEAD_LESS_AUX_FRM 0x20
409#define C6DOFIMU12_FIFO_HEAD_LESS_GYR_FRM 0x80
410#define C6DOFIMU12_FIFO_HEAD_LESS_GYR_AUX_FRM 0xA0
411#define C6DOFIMU12_FIFO_HEAD_LESS_GYR_ACC_FRM 0xC0
412#define C6DOFIMU12_FIFO_HEAD_LESS_AUX_ACC_FRM 0x60
413#define C6DOFIMU12_FIFO_HEAD_LESS_ALL_FRM 0xE0
416#define C6DOFIMU12_FIFO_STOP_ON_FULL 0x0001
417#define C6DOFIMU12_FIFO_TIME_EN 0x0002
418#define C6DOFIMU12_FIFO_TAG_INT1 0x0300
419#define C6DOFIMU12_FIFO_TAG_INT2 0x0C00
420#define C6DOFIMU12_FIFO_HEADER_EN 0x1000
421#define C6DOFIMU12_FIFO_AUX_EN 0x2000
422#define C6DOFIMU12_FIFO_ACC_EN 0x4000
423#define C6DOFIMU12_FIFO_GYR_EN 0x8000
424#define C6DOFIMU12_FIFO_ALL_EN 0xE000
427#define C6DOFIMU12_FIFO_ACC_LENGTH 6
428#define C6DOFIMU12_FIFO_GYR_LENGTH 6
429#define C6DOFIMU12_FIFO_AUX_LENGTH 8
430#define C6DOFIMU12_FIFO_ACC_AUX_LENGTH 14
431#define C6DOFIMU12_FIFO_GYR_AUX_LENGTH 14
432#define C6DOFIMU12_FIFO_ACC_GYR_LENGTH 12
433#define C6DOFIMU12_FIFO_ALL_LENGTH 20
434#define C6DOFIMU12_SENSOR_TIME_LENGTH 3
435#define C6DOFIMU12_FIFO_CONFIG_LENGTH 2
436#define C6DOFIMU12_FIFO_WM_LENGTH 2
437#define C6DOFIMU12_MAX_VALUE_FIFO_FILTER 1
438#define C6DOFIMU12_FIFO_DATA_LENGTH 2
439#define C6DOFIMU12_FIFO_LENGTH_MSB_BYTE 1
440#define C6DOFIMU12_FIFO_INPUT_CFG_LENGTH 4
441#define C6DOFIMU12_FIFO_SKIP_FRM_LENGTH 1
444#define C6DOFIMU12_FIFO_VIRT_ACC_LENGTH 9
445#define C6DOFIMU12_FIFO_VIRT_GYR_LENGTH 9
446#define C6DOFIMU12_FIFO_VIRT_AUX_LENGTH 11
447#define C6DOFIMU12_FIFO_VIRT_ACC_AUX_LENGTH 17
448#define C6DOFIMU12_FIFO_VIRT_GYR_AUX_LENGTH 17
449#define C6DOFIMU12_FIFO_VIRT_ACC_GYR_LENGTH 15
450#define C6DOFIMU12_FIFO_VIRT_ALL_LENGTH 23
453#define C6DOFIMU12_FIFO_VIRT_ACT_DATA_LENGTH 6
454#define C6DOFIMU12_FIFO_VIRT_ACT_TIME_LENGTH 4
455#define C6DOFIMU12_FIFO_VIRT_ACT_TYPE_LENGTH 1
456#define C6DOFIMU12_FIFO_VIRT_ACT_STAT_LENGTH 1
459#define C6DOFIMU12_FIFO_UNFILTERED_DATA 0
460#define C6DOFIMU12_FIFO_FILTERED_DATA 1
463#define C6DOFIMU12_FIFO_LSB_CONFIG_CHECK 0x00
464#define C6DOFIMU12_FIFO_MSB_CONFIG_CHECK 0x80
465#define C6DOFIMU12_FIFO_TAG_INTR_MASK 0xFF
468#define C6DOFIMU12_FIFO_CONFIG_0_MASK 0x0003
469#define C6DOFIMU12_FIFO_CONFIG_1_MASK 0xFF00
472#define C6DOFIMU12_FIFO_SELF_WAKE_UP_MASK 0x02
475#define C6DOFIMU12_ACC_FIFO_DOWNS_MASK 0x70
476#define C6DOFIMU12_GYR_FIFO_DOWNS_MASK 0x07
479#define C6DOFIMU12_ACC_FIFO_DOWNS_POS 0x04
482#define C6DOFIMU12_ACC_FIFO_FILT_DATA_MASK 0x80
483#define C6DOFIMU12_GYR_FIFO_FILT_DATA_MASK 0x08
486#define C6DOFIMU12_ACC_FIFO_FILT_DATA_POS 0x07
487#define C6DOFIMU12_GYR_FIFO_FILT_DATA_POS 0x03
490#define C6DOFIMU12_FIFO_BYTE_COUNTER_MSB_MASK 0x3F
493#define C6DOFIMU12_FIFO_SELF_WAKE_UP_POS 0x02
496#define C6DOFIMU12_FIFO_VIRT_FRM_MODE_MASK 0xC0
497#define C6DOFIMU12_FIFO_VIRT_PAYLOAD_MASK 0x3C
500#define C6DOFIMU12_FIFO_VIRT_FRM_MODE_POS 0x06
501#define C6DOFIMU12_FIFO_VIRT_PAYLOAD_POS 0x02
504#define C6DOFIMU12_INT_NON_LATCH 0
507#define C6DOFIMU12_INT_LATCH 1
510#define C6DOFIMU12_INT_PUSH_PULL 0
511#define C6DOFIMU12_INT_OPEN_DRAIN 1
514#define C6DOFIMU12_INT_ACTIVE_LOW 0
515#define C6DOFIMU12_INT_ACTIVE_HIGH 1
518#define C6DOFIMU12_INT_OUTPUT_DISABLE 0
519#define C6DOFIMU12_INT_OUTPUT_ENABLE 1
522#define C6DOFIMU12_INT_INPUT_DISABLE 0
523#define C6DOFIMU12_INT_INPUT_ENABLE 1
526#define C6DOFIMU12_INT_LATCH_MASK 0x01
527#define C6DOFIMU12_INT_LEVEL_MASK 0x02
528#define C6DOFIMU12_INT_OPEN_DRAIN_MASK 0x04
529#define C6DOFIMU12_INT_OUTPUT_EN_MASK 0x08
530#define C6DOFIMU12_INT_INPUT_EN_MASK 0x10
533#define C6DOFIMU12_INT_LEVEL_POS 0x01
534#define C6DOFIMU12_INT_OPEN_DRAIN_POS 0x02
535#define C6DOFIMU12_INT_OUTPUT_EN_POS 0x03
536#define C6DOFIMU12_INT_INPUT_EN_POS 0x04
539#define C6DOFIMU12_FFULL_INT 0x01
540#define C6DOFIMU12_FWM_INT 0x02
541#define C6DOFIMU12_DRDY_INT 0x04
542#define C6DOFIMU12_ERR_INT 0x08
545#define C6DOFIMU12_FFULL_INT_STATUS_MASK 0x0100
546#define C6DOFIMU12_FWM_INT_STATUS_MASK 0x0200
547#define C6DOFIMU12_ERR_INT_STATUS_MASK 0x0400
548#define C6DOFIMU12_AUX_DRDY_INT_MASK 0x2000
549#define C6DOFIMU12_GYR_DRDY_INT_MASK 0x4000
550#define C6DOFIMU12_ACC_DRDY_INT_MASK 0x8000
553#define C6DOFIMU12_INT_PIN_MAX_NUM 2
556#define C6DOFIMU12_FEAT_BIT_DISABLE 0
557#define C6DOFIMU12_FEAT_BIT0 1
558#define C6DOFIMU12_FEAT_BIT1 2
559#define C6DOFIMU12_FEAT_BIT2 3
560#define C6DOFIMU12_FEAT_BIT3 4
561#define C6DOFIMU12_FEAT_BIT4 5
562#define C6DOFIMU12_FEAT_BIT5 6
563#define C6DOFIMU12_FEAT_BIT6 7
564#define C6DOFIMU12_FEAT_BIT7 8
565#define C6DOFIMU12_FEAT_BIT_MAX 9
568#define C6DOFIMU12_OIS_IF_EN_MASK 0x10
569#define C6DOFIMU12_AUX_IF_EN_MASK 0x20
572#define C6DOFIMU12_OIS_IF_EN_POS 0x04
573#define C6DOFIMU12_AUX_IF_EN_POS 0x05
576#define C6DOFIMU12_X 0x01
577#define C6DOFIMU12_NEG_X 0x09
578#define C6DOFIMU12_Y 0x02
579#define C6DOFIMU12_NEG_Y 0x0A
580#define C6DOFIMU12_Z 0x04
581#define C6DOFIMU12_NEG_Z 0x0C
582#define C6DOFIMU12_AXIS_MASK 0x07
583#define C6DOFIMU12_AXIS_SIGN 0x08
586#define C6DOFIMU12_GYR_GAIN_EN_MASK 0x80
587#define C6DOFIMU12_GYR_OFF_COMP_EN_MASK 0x40
590#define C6DOFIMU12_GYR_OFF_COMP_EN_POS 0x06
593#define C6DOFIMU12_GYR_USR_GAIN_X_MASK 0x7F
594#define C6DOFIMU12_GYR_USR_GAIN_Y_MASK 0x7F
595#define C6DOFIMU12_GYR_USR_GAIN_Z_MASK 0x7F
598#define C6DOFIMU12_GYR_GAIN_EN_POS 0x07
601#define C6DOFIMU12_NOT_INIT 0x00
602#define C6DOFIMU12_INIT_OK 0x01
603#define C6DOFIMU12_INIT_ERR 0x02
604#define C6DOFIMU12_DRV_ERR 0x03
605#define C6DOFIMU12_SNS_STOP 0x04
606#define C6DOFIMU12_NVM_ERROR 0x05
607#define C6DOFIMU12_START_UP_ERROR 0x06
608#define C6DOFIMU12_COMPAT_ERROR 0x07
609#define C6DOFIMU12_VFM_SKIPPED 0x10
610#define C6DOFIMU12_AXES_MAP_ERROR 0x20
611#define C6DOFIMU12_ODR_50_HZ_ERROR 0x40
612#define C6DOFIMU12_ODR_HIGH_ERROR 0x80
615#define C6DOFIMU12_G_TRIGGER_NO_ERROR 0x00
616#define C6DOFIMU12_G_TRIGGER_PRECON_ERROR 0x01
617#define C6DOFIMU12_G_TRIGGER_DL_ERROR 0x02
618#define C6DOFIMU12_G_TRIGGER_ABORT_ERROR 0x03
621#define C6DOFIMU12_CRT_RTOSK_ENABLE 0x01
622#define C6DOFIMU12_GYRO_CROSS_SENS_ENABLE 0x02
623#define C6DOFIMU12_GYRO_USER_GAIN_ENABLE 0x08
624#define C6DOFIMU12_NO_FEATURE_ENABLE 0x00
625#define C6DOFIMU12_CRT_IN_FIFO_NOT_REQ 0x10
626#define C6DOFIMU12_MINIMAL_VARIANT 0x20
629#define C6DOFIMU12_ERROR 0x00
630#define C6DOFIMU12_SUCCESS 0x01
635#define C6DOFIMU12_SPI_CMD_WRITE 0x00
636#define C6DOFIMU12_SPI_CMD_READ 0x80
637#define C6DOFIMU12_SPI_COMMUNICATION_DUMMY 0x00
#define C6DOFIMU12_RETVAL
Definition c6dofimu12.h:91
C6DOFIMU12_RETVAL c6dofimu12_check_init_status(c6dofimu12_t *ctx)
Check ID function.
C6DOFIMU12_RETVAL c6dofimu12_check_int1(c6dofimu12_t *ctx)
Get interrupt 1 status function.
void c6dofimu12_default_cfg(c6dofimu12_t *ctx)
Click Default Configuration function.
void c6dofimu12_get_data(c6dofimu12_t *ctx, c6dofimu12_accel_t *accel_data, c6dofimu12_gyro_t *gyro_data)
Read Accel and Gyro data function.
void c6dofimu12_generic_write(c6dofimu12_t *ctx, uint8_t reg, uint8_t *data_buf, uint16_t len)
Generic write function.
void c6dofimu12_cfg_setup(c6dofimu12_cfg_t *cfg)
Config Object Initialization function.
C6DOFIMU12_RETVAL c6dofimu12_check_id(c6dofimu12_t *ctx)
Check ID function.
void c6dofimu12_generic_read(c6dofimu12_t *ctx, uint8_t reg, uint8_t *data_buf, uint16_t len)
Generic read function.
C6DOFIMU12_RETVAL c6dofimu12_check_int2(c6dofimu12_t *ctx)
Get interrupt 2 status function.
C6DOFIMU12_RETVAL c6dofimu12_init(c6dofimu12_t *ctx, c6dofimu12_cfg_t *cfg)
Initialization function.
struct c6dofimu12_accel_t c6dofimu12_accel_t
struct c6dofimu12_gyro_t c6dofimu12_gyro_t
struct c6dofimu12_s c6dofimu12_t
Click ctx object definition.
void(* c6dofimu12_master_io_t)(struct c6dofimu12_s *, uint8_t, uint8_t *, uint16_t)
Master Input/Output type.
Definition c6dofimu12.h:655
uint8_t c6dofimu12_select_t
Communication type.
Definition c6dofimu12.h:650
Definition c6dofimu12.h:683
int16_t z
Definition c6dofimu12.h:686
int16_t x
Definition c6dofimu12.h:684
int16_t y
Definition c6dofimu12.h:685
Click configuration structure definition.
Definition c6dofimu12.h:700
c6dofimu12_select_t sel
Definition c6dofimu12.h:724
uint32_t i2c_speed
Definition c6dofimu12.h:717
spi_master_chip_select_polarity_t cs_polarity
Definition c6dofimu12.h:722
pin_name_t sck
Definition c6dofimu12.h:707
spi_master_mode_t spi_mode
Definition c6dofimu12.h:721
pin_name_t mosi
Definition c6dofimu12.h:706
uint32_t spi_speed
Definition c6dofimu12.h:720
pin_name_t scl
Definition c6dofimu12.h:703
pin_name_t int_pin
Definition c6dofimu12.h:713
pin_name_t pwm
Definition c6dofimu12.h:712
pin_name_t miso
Definition c6dofimu12.h:705
pin_name_t sda
Definition c6dofimu12.h:704
pin_name_t cs
Definition c6dofimu12.h:708
uint8_t i2c_address
Definition c6dofimu12.h:718
Definition c6dofimu12.h:690
int16_t z
Definition c6dofimu12.h:693
int16_t x
Definition c6dofimu12.h:691
int16_t y
Definition c6dofimu12.h:692
Click ctx object definition.
Definition c6dofimu12.h:661
digital_out_t cs
Definition c6dofimu12.h:664
spi_master_t spi
Definition c6dofimu12.h:671
c6dofimu12_master_io_t read_f
Definition c6dofimu12.h:678
digital_in_t pwm
Definition c6dofimu12.h:665
digital_in_t int_pin
Definition c6dofimu12.h:666
c6dofimu12_master_io_t write_f
Definition c6dofimu12.h:677
i2c_master_t i2c
Definition c6dofimu12.h:670
uint8_t slave_address
Definition c6dofimu12.h:675
c6dofimu12_select_t master_sel
Definition c6dofimu12.h:679
pin_name_t chip_select
Definition c6dofimu12.h:676