c6dofimu18 2.1.0.0
c6dofimu18.h
Go to the documentation of this file.
1/****************************************************************************
2** Copyright (C) 2020 MikroElektronika d.o.o.
3** Contact: https://www.mikroe.com/contact
4**
5** Permission is hereby granted, free of charge, to any person obtaining a copy
6** of this software and associated documentation files (the "Software"), to deal
7** in the Software without restriction, including without limitation the rights
8** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9** copies of the Software, and to permit persons to whom the Software is
10** furnished to do so, subject to the following conditions:
11** The above copyright notice and this permission notice shall be
12** included in all copies or substantial portions of the Software.
13**
14** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20** USE OR OTHER DEALINGS IN THE SOFTWARE.
21****************************************************************************/
22
28#ifndef C6DOFIMU18_H
29#define C6DOFIMU18_H
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
35#include "drv_digital_out.h"
36#include "drv_digital_in.h"
37#include "drv_i2c_master.h"
38#include "drv_spi_master.h"
39#include "spi_specifics.h"
40
66#define C6DOFIMU18_REG_DEVICE_CONFIG 0x11
67#define C6DOFIMU18_REG_DRIVE_CONFIG 0x13
68#define C6DOFIMU18_REG_INT_CONFIG 0x14
69#define C6DOFIMU18_REG_FIFO_CONFIG 0x16
70#define C6DOFIMU18_REG_TEMP_DATA1 0x1D
71#define C6DOFIMU18_REG_TEMP_DATA0 0x1E
72#define C6DOFIMU18_REG_ACCEL_DATA_X1 0x1F
73#define C6DOFIMU18_REG_ACCEL_DATA_X0 0x20
74#define C6DOFIMU18_REG_ACCEL_DATA_Y1 0x21
75#define C6DOFIMU18_REG_ACCEL_DATA_Y0 0x22
76#define C6DOFIMU18_REG_ACCEL_DATA_Z1 0x23
77#define C6DOFIMU18_REG_ACCEL_DATA_Z0 0x24
78#define C6DOFIMU18_REG_GYRO_DATA_X1 0x25
79#define C6DOFIMU18_REG_GYRO_DATA_X0 0x26
80#define C6DOFIMU18_REG_GYRO_DATA_Y1 0x27
81#define C6DOFIMU18_REG_GYRO_DATA_Y0 0x28
82#define C6DOFIMU18_REG_GYRO_DATA_Z1 0x29
83#define C6DOFIMU18_REG_GYRO_DATA_Z0 0x2A
84#define C6DOFIMU18_REG_TMST_FSYNCH 0x2B
85#define C6DOFIMU18_REG_TMST_FSYNCL 0x2C
86#define C6DOFIMU18_REG_INT_STATUS 0x2D
87#define C6DOFIMU18_REG_FIFO_COUNTH 0x2E
88#define C6DOFIMU18_REG_FIFO_COUNTL 0x2F
89#define C6DOFIMU18_REG_FIFO_DATA 0x30
90#define C6DOFIMU18_REG_APEX_DATA0 0x31
91#define C6DOFIMU18_REG_APEX_DATA1 0x32
92#define C6DOFIMU18_REG_APEX_DATA2 0x33
93#define C6DOFIMU18_REG_APEX_DATA3 0x34
94#define C6DOFIMU18_REG_APEX_DATA4 0x35
95#define C6DOFIMU18_REG_APEX_DATA5 0x36
96#define C6DOFIMU18_REG_INT_STATUS2 0x37
97#define C6DOFIMU18_REG_INT_STATUS3 0x38
98#define C6DOFIMU18_REG_SIGNAL_PATH_RESET 0x4B
99#define C6DOFIMU18_REG_INTF_CONFIG0 0x4C
100#define C6DOFIMU18_REG_INTF_CONFIG1 0x4D
101#define C6DOFIMU18_REG_PWR_MGMT0 0x4E
102#define C6DOFIMU18_REG_GYRO_CONFIG0 0x4F
103#define C6DOFIMU18_REG_ACCEL_CONFIG0 0x50
104#define C6DOFIMU18_REG_GYRO_CONFIG1 0x51
105#define C6DOFIMU18_REG_GYRO_ACCEL_CONFIG0 0x52
106#define C6DOFIMU18_REG_ACCEL_CONFIG1 0x53
107#define C6DOFIMU18_REG_TMST_CONFIG 0x54
108#define C6DOFIMU18_REG_APEX_CONFIG0 0x56
109#define C6DOFIMU18_REG_SMD_CONFIG 0x57
110#define C6DOFIMU18_REG_FIFO_CONFIG1 0x5F
111#define C6DOFIMU18_REG_FIFO_CONFIG2 0x60
112#define C6DOFIMU18_REG_FIFO_CONFIG3 0x61
113#define C6DOFIMU18_REG_FSYNC_CONFIG 0x62
114#define C6DOFIMU18_REG_INT_CONFIG0 0x63
115#define C6DOFIMU18_REG_INT_CONFIG1 0x64
116#define C6DOFIMU18_REG_INT_SOURCE0 0x65
117#define C6DOFIMU18_REG_INT_SOURCE1 0x66
118#define C6DOFIMU18_REG_INT_SOURCE3 0x68
119#define C6DOFIMU18_REG_INT_SOURCE4 0x69
120#define C6DOFIMU18_REG_FIFO_LOST_PKT0 0x6C
121#define C6DOFIMU18_REG_FIFO_LOST_PKT1 0x6D
122#define C6DOFIMU18_REG_SELF_TEST_CONFIG 0x70
123#define C6DOFIMU18_REG_WHO_AM_I 0x75
124#define C6DOFIMU18_REG_BANK_SEL 0x76
125
130#define C6DOFIMU18_REG_SENSOR_CONFIG0 0x03
131#define C6DOFIMU18_REG_GYRO_CONFIG_STATIC2 0x0B
132#define C6DOFIMU18_REG_GYRO_CONFIG_STATIC3 0x0C
133#define C6DOFIMU18_REG_GYRO_CONFIG_STATIC4 0x0D
134#define C6DOFIMU18_REG_GYRO_CONFIG_STATIC5 0x0E
135#define C6DOFIMU18_REG_GYRO_CONFIG_STATIC6 0x0F
136#define C6DOFIMU18_REG_GYRO_CONFIG_STATIC7 0x10
137#define C6DOFIMU18_REG_GYRO_CONFIG_STATIC8 0x11
138#define C6DOFIMU18_REG_GYRO_CONFIG_STATIC9 0x12
139#define C6DOFIMU18_REG_GYRO_CONFIG_STATIC10 0x13
140#define C6DOFIMU18_REG_XG_ST_DATA 0x5F
141#define C6DOFIMU18_REG_YG_ST_DATA 0x60
142#define C6DOFIMU18_REG_ZG_ST_DATA 0x61
143#define C6DOFIMU18_REG_TMSTVAL0 0x62
144#define C6DOFIMU18_REG_TMSTVAL1 0x63
145#define C6DOFIMU18_REG_TMSTVAL2 0x64
146#define C6DOFIMU18_REG_INTF_CONFIG4 0x7A
147#define C6DOFIMU18_REG_INTF_CONFIG5 0x7B
148#define C6DOFIMU18_REG_INTF_CONFIG6 0x7C
149
154#define C6DOFIMU18_REG_ACCEL_CONFIG_STATIC2 0x03
155#define C6DOFIMU18_REG_ACCEL_CONFIG_STATIC3 0x04
156#define C6DOFIMU18_REG_ACCEL_CONFIG_STATIC4 0x05
157#define C6DOFIMU18_REG_XA_ST_DATA 0x3B
158#define C6DOFIMU18_REG_YA_ST_DATA 0x3C
159#define C6DOFIMU18_REG_ZA_ST_DATA 0x3D
160
165#define C6DOFIMU18_REG_APEX_CONFIG1 0x40
166#define C6DOFIMU18_REG_APEX_CONFIG2 0x41
167#define C6DOFIMU18_REG_APEX_CONFIG3 0x42
168#define C6DOFIMU18_REG_APEX_CONFIG4 0x43
169#define C6DOFIMU18_REG_APEX_CONFIG5 0x44
170#define C6DOFIMU18_REG_APEX_CONFIG6 0x45
171#define C6DOFIMU18_REG_APEX_CONFIG7 0x46
172#define C6DOFIMU18_REG_APEX_CONFIG8 0x47
173#define C6DOFIMU18_REG_APEX_CONFIG9 0x48
174#define C6DOFIMU18_REG_ACCEL_WOM_X_THR 0x4A
175#define C6DOFIMU18_REG_ACCEL_WOM_Y_THR 0x4B
176#define C6DOFIMU18_REG_ACCEL_WOM_Z_THR 0x4C
177#define C6DOFIMU18_REG_INT_SOURCE6 0x4D
178#define C6DOFIMU18_REG_INT_SOURCE7 0x4E
179#define C6DOFIMU18_REG_INT_SOURCE8 0x4F
180#define C6DOFIMU18_REG_INT_SOURCE9 0x50
181#define C6DOFIMU18_REG_INT_SOURCE10 0x51
182#define C6DOFIMU18_REG_OFFSET_USER0 0x77
183#define C6DOFIMU18_REG_OFFSET_USER1 0x78
184#define C6DOFIMU18_REG_OFFSET_USER2 0x79
185#define C6DOFIMU18_REG_OFFSET_USER3 0x7A
186#define C6DOFIMU18_REG_OFFSET_USER4 0x7B
187#define C6DOFIMU18_REG_OFFSET_USER5 0x7C
188#define C6DOFIMU18_REG_OFFSET_USER6 0x7D
189#define C6DOFIMU18_REG_OFFSET_USER7 0x7E
190#define C6DOFIMU18_REG_OFFSET_USER8 0x7F
191 // c6dofimu18_reg
193
209#define C6DOFIMU18_BANK0_SEL 0x00
210#define C6DOFIMU18_BANK1_SEL 0x01
211#define C6DOFIMU18_BANK2_SEL 0x02
212#define C6DOFIMU18_BANK3_SEL 0x03
213#define C6DOFIMU18_BANK4_SEL 0x04
214
219#define C6DOFIMU18_SLEW_RATE_60nS 0x00
220#define C6DOFIMU18_SLEW_RATE_36nS 0x01
221#define C6DOFIMU18_SLEW_RATE_18nS 0x02
222#define C6DOFIMU18_SLEW_RATE_12nS 0x03
223#define C6DOFIMU18_SLEW_RATE_6nS 0x04
224#define C6DOFIMU18_SLEW_RATE_2nS 0x05
225
230#define C6DOFIMU18_SPI_MODE0_MODE3 0x00
231#define C6DOFIMU18_SPI_MODE1_MODE2 0x01
232
233#define C6DOFIMU18_ENABLE_SW_RESET 0x01
234
239#define C6DOFIMU18_DMP_IDEL_FLAG 0x04
240#define C6DOFIMU18_ACTIVITY_UNKNOWN 0x00
241#define C6DOFIMU18_ACTIVITY_WALK 0x01
242#define C6DOFIMU18_ACTIVITY_RUN 0x02
243#define C6DOFIMU18_ACTIVITY_MASK 0x03
244
245#define C6DOFIMU18_TAP_NUM_MASK 0x18
246#define C6DOFIMU18_TAP_SINGLE 0x08
247#define C6DOFIMU18_TAP_DOUBLE 0x10
248#define C6DOFIMU18_TAP_AXIS_MASK 0x06
249#define C6DOFIMU18_TAP_AXIS_X 0x00
250#define C6DOFIMU18_TAP_AXIS_Y 0x02
251#define C6DOFIMU18_TAP_AXIS_Z 0x04
252#define C6DOFIMU18_TAP_DIR_MASK 0x01
253#define C6DOFIMU18_TAP_DIR_POSITIVE 0x00
254#define C6DOFIMU18_TAP_DIR_NEGATIVE 0x01
255
260#define C6DOFIMU18_INT_INT2_MODE_PULSED 0x00
261#define C6DOFIMU18_INT_INT2_MODE_LATCHED 0x20
262#define C6DOFIMU18_INT_INT2_OPEN_DRAIN 0x00
263#define C6DOFIMU18_INT_INT2_PUSH_PULL 0x10
264#define C6DOFIMU18_INT_INT2_ACTIVE_LOW 0x00
265#define C6DOFIMU18_INT_INT2_ACTIVE_HIGH 0x08
266#define C6DOFIMU18_INT_INT1_MODE_PULSED 0x00
267#define C6DOFIMU18_INT_INT1_MODE_LATCHED 0x04
268#define C6DOFIMU18_INT_INT1_OPEN_DRAIN 0x00
269#define C6DOFIMU18_INT_INT1_PUSH_PULL 0x02
270#define C6DOFIMU18_INT_INT1_ACTIVE_LOW 0x00
271#define C6DOFIMU18_INT_INT1_ACTIVE_HIGH 0x01
272#define C6DOFIMU18_INT_CONFIG_MASK 0x3F
273
278#define C6DOFIMU18_DRDY_INT_CLR_ON_STATUS_READ 0x00
279#define C6DOFIMU18_DRDY_INT_CLR_FIFO_READ 0x20
280#define C6DOFIMU18_DRDY_INT_CLR_STATUS_AND_REG 0x30
281#define C6DOFIMU18_FIFO_INT_CLR_ON_STATUS_READ 0x00
282#define C6DOFIMU18_FIFO_INT_CLR_FIFO_READ 0x80
283#define C6DOFIMU18_FIFO_INT_CLR_STATUS_AND_REG 0xc0
284#define C6DOFIMU18_FIFO_FULL_CLR_ON_STATUS_READ 0x00
285#define C6DOFIMU18_FIFO_FULL_CLR_FIFO_READ 0x02
286#define C6DOFIMU18_FIFO_FULL_CLR_STATUS_AND_REG 0x03
287
292#define C6DOFIMU18_INT_TPULSE_100uS 0x00
293#define C6DOFIMU18_INT_TPULSE_8uS 0x40
294#define C6DOFIMU18_INT_TDEASSERT_DISABLE 0x20
295#define C6DOFIMU18_INT_ASYNC_RESET_DISABLE 0x10
296#define C6DOFIMU18_INT_ASYNC_RESET_ENABLE 0x00
297#define C6DOFIMU18_INT_CONFIG1_MASK 0x70
298
303#define C6DOFIMU18_INT_UI_FSYNC_INT1_EN 0x40
304#define C6DOFIMU18_INT_PLL_RDY_INT1_EN 0x20
305#define C6DOFIMU18_INT_RESET_DONE_INT1_EN 0x10
306#define C6DOFIMU18_INT_UI_DRDY_INT1_EN 0x08
307#define C6DOFIMU18_INT_FIFO_THS_INT1_EN 0x04
308#define C6DOFIMU18_INT_FIFO_FULL_INT1_EN 0x02
309#define C6DOFIMU18_INT_UI_AGC_RDY_INT1_EN 0x01
310#define C6DOFIMU18_INT_SOURCE0_MASK 0x7F
311
316#define C6DOFIMU18_SMD_INT1_EN 0x08
317#define C6DOFIMU18_WOM_Z_INT1_EN 0x04
318#define C6DOFIMU18_WOM_Y_INT1_EN 0x02
319#define C6DOFIMU18_WOM_X_INT1_EN 0x01
320#define C6DOFIMU18_INT_SOURCE1_MASK 0x0F
321
326#define C6DOFIMU18_INT_UI_FSYNC_INT2_EN 0x40
327#define C6DOFIMU18_INT_PLL_RDY_INT2_EN 0x20
328#define C6DOFIMU18_INT_RESET_DONE_INT2_EN 0x10
329#define C6DOFIMU18_INT_UI_DRDY_INT2_EN 0x08
330#define C6DOFIMU18_INT_FIFO_THS_INT2_EN 0x04
331#define C6DOFIMU18_INT_FIFO_FULL_INT2_EN 0x02
332#define C6DOFIMU18_INT_UI_AGC_RDY_INT2_EN 0x01
333#define C6DOFIMU18_INT_SOURCE3_MASK 0x7F
334
339#define C6DOFIMU18_SMD_INT2_EN 0x08
340#define C6DOFIMU18_WOM_Z_INT2_EN 0x04
341#define C6DOFIMU18_WOM_Y_INT2_EN 0x02
342#define C6DOFIMU18_WOM_X_INT2_EN 0x01
343#define C6DOFIMU18_INT_SOURCE4_MASK 0x0F
344
349#define C6DOFIMU18_INT_SOURCE6_STEP_DET_INT1_EN 0x20
350#define C6DOFIMU18_INT_SOURCE6_STEP_CNT_INT1_EN 0x10
351#define C6DOFIMU18_INT_SOURCE6_TILT_DET_INT1_EN 0x08
352#define C6DOFIMU18_INT_SOURCE6_TAP_DET_INT1_EN 0x01
353#define C6DOFIMU18_INT_SOURCE6_MASK 0x39
354
359#define C6DOFIMU18_INT_SOURCE7_STEP_DET_INT2_EN 0x20
360#define C6DOFIMU18_INT_SOURCE7_STEP_CNT_INT2_EN 0x10
361#define C6DOFIMU18_INT_SOURCE7_TILT_DET_INT2_EN 0x08
362#define C6DOFIMU18_INT_SOURCE7_TAP_DET_INT2_EN 0x01
363#define C6DOFIMU18_INT_SOURCE7_MASK 0x39
364
369#define C6DOFIMU18_UI_FSYNC_INT_FLAG 0x40
370#define C6DOFIMU18_PLL_DONE_INT_FLAG 0x20
371#define C6DOFIMU18_RESET_DONE_INT_FLAG 0x10
372#define C6DOFIMU18_DATA_RDY_INT_FLAG 0x08
373#define C6DOFIMU18_FIFO_THS_INT_FLAG 0x04
374#define C6DOFIMU18_FIFO_FULL_INT_FLAG 0x02
375#define C6DOFIMU18_AGC_RDY_INT_FLAG 0x01
376
381#define C6DOFIMU18_SMD_INT_FLAG 0x08
382#define C6DOFIMU18_WOM_Z_INT_FLAG 0x04
383#define C6DOFIMU18_WOM_Y_INT_FLAG 0x02
384#define C6DOFIMU18_WOM_X_INT_FLAG 0x01
385
390#define C6DOFIMU18_STEP_DET_INT_FLAG 0x10
391#define C6DOFIMU18_STEP_CNT_OVF_INT_FLAG 0x08
392#define C6DOFIMU18_TILT_DET_INT_FLAG 0x04
393#define C6DOFIMU18_SLEEP_INT_FLAG 0x02
394#define C6DOFIMU18_TAP_DET_INT_FLAG 0x01
395
400#define C6DOFIMU18_FIFO_HLD_LAST_DATA_EN 0x80
401#define C6DOFIMU18_FIFO_COUNT_REC 0x40
402#define C6DOFIMU18_FIFO_COUNT_ENDIAN 0x20
403#define C6DOFIMU18_FIFO_DATA_ENDIAN 0x10
404#define C6DOFIMU18_UI_SIFS_CFG_DISABLE_I2C 0x03
405#define C6DOFIMU18_UI_SIFS_CFG_DISABLE_SPI 0x02
406#define C6DOFIMU18_INTF_CONFIG0_MASK 0xF3
407
412#define C6DOFIMU18_ACCEL_LP_CLK_SEL_WAKE_UP_OSC 0x00
413#define C6DOFIMU18_ACCEL_LP_CLK_SEL_RC_OSC 0x08
414#define C6DOFIMU18_ACCEL_CLKSEL_RC 0x00
415#define C6DOFIMU18_ACCEL_CLKSEL_PLL_OR_RC 0x01
416#define C6DOFIMU18_ACCEL_CLKSEL_DISABLE 0x03
417
422#define C6DOFIMU18_SPI_3WIRE 0x00
423#define C6DOFIMU18_SPI_4WIRE 0x02
424
429#define C6DOFIMU18_PIN9_INT2 0x00
430#define C6DOFIMU18_PIN9_FSYNC 0x01
431
436#define C6DOFIMU18_DMP_INIT_EN 0x40
437#define C6DOFIMU18_DMP_MEM_RESET_EN 0x20
438#define C6DOFIMU18_ABORT_AND_RESET 0x08
439#define C6DOFIMU18_TMST_STROBE 0x04
440#define C6DOFIMU18_FIFO_FLUSH 0x02
441
446#define C6DOFIMU18_PWR_TEMP_DIS 0x20
447#define C6DOFIMU18_PWR_IDLE_OFF 0x10
448#define C6DOFIMU18_PWR_GYRO_MODE_OFF 0x00
449#define C6DOFIMU18_PWR_GYRO_STANDBY 0x04
450#define C6DOFIMU18_PWR_GYRO_LN_MODE 0x0C
451#define C6DOFIMU18_PWR_ACCEL_MODE_OFF 0x00
452#define C6DOFIMU18_PWR_ACCEL_LP_MODE 0x02
453#define C6DOFIMU18_PWR_ACCEL_LN_MODE 0x03
454
459#define C6DOFIMU18_GYRO_FS_SEL_2000DPS 0x00
460#define C6DOFIMU18_GYRO_FS_SEL_1000DPS 0x20
461#define C6DOFIMU18_GYRO_FS_SEL_500DPS 0x40
462#define C6DOFIMU18_GYRO_FS_SEL_250DPS 0x60
463#define C6DOFIMU18_GYRO_FS_SEL_125DPS 0x80
464#define C6DOFIMU18_GYRO_FS_SEL_62DPS 0xA0
465#define C6DOFIMU18_GYRO_FS_SEL_32DPS 0xC0
466#define C6DOFIMU18_GYRO_FS_SEL_15DPS 0xE0
467#define C6DOFIMU18_GYRO_FS_SEL_MASK 0xE0
468#define C6DOFIMU18_GYRO_ODR_8kHz 0x03
469#define C6DOFIMU18_GYRO_ODR_4kHz 0x04
470#define C6DOFIMU18_GYRO_ODR_2kHz 0x05
471#define C6DOFIMU18_GYRO_ODR_1kHz 0x06
472#define C6DOFIMU18_GYRO_ODR_200Hz 0x07
473#define C6DOFIMU18_GYRO_ODR_100Hz 0x08
474#define C6DOFIMU18_GYRO_ODR_50Hz 0x09
475#define C6DOFIMU18_GYRO_ODR_25Hz 0x0A
476#define C6DOFIMU18_GYRO_ODR_12Hz 0x0B
477#define C6DOFIMU18_GYRO_ODR_500Hz 0x0F
478#define C6DOFIMU18_GYRO_ODR_MASK 0x0F
479#define C6DOFIMU18_GYRO_ODR_MASK 0x0F
480
485#define C6DOFIMU18_TEMP_FILT_BW_4kHz 0x00
486#define C6DOFIMU18_TEMP_FILT_BW_170Hz 0x20
487#define C6DOFIMU18_TEMP_FILT_BW_82Hz 0x40
488#define C6DOFIMU18_TEMP_FILT_BW_40Hz 0x60
489#define C6DOFIMU18_TEMP_FILT_BW_20Hz 0x80
490#define C6DOFIMU18_TEMP_FILT_BW_10Hz 0xA0
491#define C6DOFIMU18_TEMP_FILT_BW_5Hz_0 0xC0
492#define C6DOFIMU18_TEMP_FILT_BW_5Hz_1 0xE0
493#define C6DOFIMU18_GYRO_UI_FILT_ORD_1st 0x00
494#define C6DOFIMU18_GYRO_UI_FILT_ORD_2nd 0x04
495#define C6DOFIMU18_GYRO_UI_FILT_ORD_3rd 0x08
496#define C6DOFIMU18_GYRO_UI_FILT_ORD_MASK 0x0C
497#define C6DOFIMU18_GYRO_DEC2_M2_ORD_3rd 0x02
498#define C6DOFIMU18_GYRO_CONFIG1_MASK 0xEF
499
504#define C6DOFIMU18_ACCEL_FS_SEL_16G 0x00
505#define C6DOFIMU18_ACCEL_FS_SEL_8G 0x20
506#define C6DOFIMU18_ACCEL_FS_SEL_4G 0x40
507#define C6DOFIMU18_ACCEL_FS_SEL_2G 0x60
508#define C6DOFIMU18_ACCEL_FS_SEL_MASK 0x60
509#define C6DOFIMU18_ACCEL_ODR_8kHz_LN 0x03
510#define C6DOFIMU18_ACCEL_ODR_4kHz_LN 0x04
511#define C6DOFIMU18_ACCEL_ODR_2kHz_LN 0x05
512#define C6DOFIMU18_ACCEL_ODR_1kHz_LN 0x06
513#define C6DOFIMU18_ACCEL_ODR_200Hz_LP_LN 0x07
514#define C6DOFIMU18_ACCEL_ODR_100Hz_LP_LN 0x08
515#define C6DOFIMU18_ACCEL_ODR_50Hz_LP_LN 0x09
516#define C6DOFIMU18_ACCEL_ODR_25Hz_LP_LN 0x0A
517#define C6DOFIMU18_ACCEL_ODR_12Hz_LP_LN 0x0B
518#define C6DOFIMU18_ACCEL_ODR_6Hz_LP 0x0C
519#define C6DOFIMU18_ACCEL_ODR_3Hz_LP 0x0D
520#define C6DOFIMU18_ACCEL_ODR_1Hz_LP 0x0E
521#define C6DOFIMU18_ACCEL_ODR_500Hz_LP_LN 0x0F
522#define C6DOFIMU18_ACCEL_ODR_MASK 0x0F
523
528#define C6DOFIMU18_ACCEL_UI_FILT_ORD_1st 0x00
529#define C6DOFIMU18_ACCEL_UI_FILT_ORD_2nd 0x08
530#define C6DOFIMU18_ACCEL_UI_FILT_ORD_3rd 0x10
531#define C6DOFIMU18_ACCEL_UI_FILT_ORD_MASK 0x18
532#define C6DOFIMU18_ACCEL_DEC2_M2_ORD_3rd 0x04
533
538#define C6DOFIMU18_TMST_TO_REGS_EN 0x10
539#define C6DOFIMU18_TMST_RES 0x08
540#define C6DOFIMU18_TMST_DELTA_EN 0x04
541#define C6DOFIMU18_TMST_FSYNC_EN 0x02
542#define C6DOFIMU18_TMST_EN 0x01
543#define C6DOFIMU18_TMST_MASK 0x1F
544
549#define C6DOFIMU18_FIFO_BYPASS 0x00
550#define C6DOFIMU18_FIFO_STREAM_TO_FIFO 0x40
551#define C6DOFIMU18_FIFO_STOP_ON_FULL 0x80
552#define C6DOFIMU18_FIFO_CONFIG_MASK 0xC0
553
558#define C6DOFIMU18_FIFO_RESUME_PARTIAL_RD 0x40
559#define C6DOFIMU18_FIFO_WM_GT_TH 0x20
560#define C6DOFIMU18_FIFO_TMST_FSYNC_EN 0x08
561#define C6DOFIMU18_FIFO_TEMP_EN 0x04
562#define C6DOFIMU18_FIFO_GYRO_EN 0x02
563#define C6DOFIMU18_FIFO_ACCEL_EN 0x01
564
569#define C6DOFIMU18_DO_NOT_TAG_FSYNC 0x00
570#define C6DOFIMU18_FSYNC_TAG_TEMP_OUT_LSB 0x10
571#define C6DOFIMU18_FSYNC_GYRO_XOUT_LSB 0x20
572#define C6DOFIMU18_FSYNC_GYRO_YOUT_LSB 0x30
573#define C6DOFIMU18_FSYNC_GYRO_ZOUT_LSB 0x40
574#define C6DOFIMU18_FSYNC_ACCEL_XOUT_LSB 0x50
575#define C6DOFIMU18_FSYNC_ACCEL_YOUT_LSB 0x60
576#define C6DOFIMU18_FSYNC_ACCEL_ZOUT_LSB 0x70
577#define C6DOFIMU18_FSYNC_UI_SEL_MASK 0x70
578#define C6DOFIMU18_FSYNC_UI_FLAG_CLEAR_SEL 0x02
579#define C6DOFIMU18_FSYNC_POLARITY_RISING_EGDE 0x01
580#define C6DOFIMU18_FSYNC_POLARITY_FALLING_EGDE 0x01
581
586#define C6DOFIMU18_DMP_POVER_SAVE_EN 0x80
587#define C6DOFIMU18_TAP_ENABLE 0x40
588#define C6DOFIMU18_PED_ENABLE 0x20
589#define C6DOFIMU18_TILT_ENABLE 0x10
590#define C6DOFIMU18_R2W_ENABLE 0x08
591#define C6DOFIMU18_DMP_ODR_25Hz 0x00
592#define C6DOFIMU18_DMP_ODR_50Hz 0x02
593
598#define C6DOFIMU18_LOW_ENERGY_AMP_TH_SEL 0xA0
599#define C6DOFIMU18_DMP_POVER_SAVE_TIME_0S 0x00
600#define C6DOFIMU18_DMP_POVER_SAVE_TIME_4S 0x01
601#define C6DOFIMU18_DMP_POWER_SAVE_TIME_8S 0x02
602#define C6DOFIMU18_DMP_POWER_SAVE_TIME_12S 0x03
603#define C6DOFIMU18_DMP_POWER_SAVE_TIME_16S 0x04
604#define C6DOFIMU18_DMP_POWER_SAVE_TIME_20S 0x05
605#define C6DOFIMU18_DMP_POWER_SAVE_TIME_24S 0x06
606#define C6DOFIMU18_DMP_POWER_SAVE_TIME_28S 0x07
607#define C6DOFIMU18_DMP_POWER_SAVE_TIME_32S 0x08
608#define C6DOFIMU18_DMP_POWER_SAVE_TIME_36S 0x09
609#define C6DOFIMU18_DMP_POWER_SAVE_TIME_40S 0x0A
610#define C6DOFIMU18_DMP_POWER_SAVE_TIME_44S 0x0B
611#define C6DOFIMU18_DMP_POWER_SAVE_TIME_48S 0x0C
612#define C6DOFIMU18_DMP_POWER_SAVE_TIME_52S 0x0D
613#define C6DOFIMU18_DMP_POWER_SAVE_TIME_56S 0x0E
614#define C6DOFIMU18_DMP_POWER_SAVE_TIME_60S 0x0F
615
620#define C6DOFIMU18_PED_AMP_TH_SEL 0x80
621#define C6DOFIMU18_PED_STEP_CNT_TH_0_STEPS 0x00
622#define C6DOFIMU18_PED_STEP_CNT_TH_1_STEPS 0x01
623#define C6DOFIMU18_PED_STEP_CNT_TH_2_STEPS 0x02
624#define C6DOFIMU18_PED_STEP_CNT_TH_3_STEPS 0x03
625#define C6DOFIMU18_PED_STEP_CNT_TH_4_STEPS 0x04
626#define C6DOFIMU18_PED_STEP_CNT_TH_5_STEPS 0x05
627#define C6DOFIMU18_PED_STEP_CNT_TH_6_STEPS 0x06
628#define C6DOFIMU18_PED_STEP_CNT_TH_7_STEPS 0x07
629#define C6DOFIMU18_PED_STEP_CNT_TH_8_STEPS 0x08
630#define C6DOFIMU18_PED_STEP_CNT_TH_9_STEPS 0x09
631#define C6DOFIMU18_PED_STEP_CNT_TH_10_STEPS 0x0A
632#define C6DOFIMU18_PED_STEP_CNT_TH_11_STEPS 0x0B
633#define C6DOFIMU18_PED_STEP_CNT_TH_12_STEPS 0x0C
634#define C6DOFIMU18_PED_STEP_CNT_TH_13_STEPS 0x0D
635#define C6DOFIMU18_PED_STEP_CNT_TH_14_STEPS 0x0E
636#define C6DOFIMU18_PED_STEP_CNT_TH_15_STEPS 0x0F
637#define C6DOFIMU18_PED_STEP_CNT_TH_MASK 0x0F
638
643#define C6DOFIMU18_PED_STEP_DET_TH_0_STEPS 0x00
644#define C6DOFIMU18_PED_STEP_DET_TH_1_STEPS 0x20
645#define C6DOFIMU18_PED_STEP_DET_TH_2_STEPS 0x40
646#define C6DOFIMU18_PED_STEP_DET_TH_3_STEPS 0x60
647#define C6DOFIMU18_PED_STEP_DET_TH_4_STEPS 0x80
648#define C6DOFIMU18_PED_STEP_DET_TH_5_STEPS 0xA0
649#define C6DOFIMU18_PED_STEP_DET_TH_6_STEPS 0xC0
650#define C6DOFIMU18_PED_STEP_DET_TH_7_STEPS 0xE0
651#define C6DOFIMU18_PED_SB_TIMER_TH_0_SAMPLES 0x00
652#define C6DOFIMU18_PED_SB_TIMER_TH_1_SAMPLES 0x04
653#define C6DOFIMU18_PED_SB_TIMER_TH_2_SAMPLES 0x08
654#define C6DOFIMU18_PED_SB_TIMER_TH_3_SAMPLES 0x0C
655#define C6DOFIMU18_PED_SB_TIMER_TH_4_SAMPLES 0x10
656#define C6DOFIMU18_PED_SB_TIMER_TH_5_SAMPLES 0x14
657#define C6DOFIMU18_PED_SB_TIMER_TH_6_SAMPLES 0x18
658#define C6DOFIMU18_PED_SB_TIMER_TH_7_SAMPLES 0x1C
659#define C6DOFIMU18_PED_HI_EN_TH_SEL 0x01
660
665#define C6DOFIMU18_TILT_WAIT_TIME_0S 0x00
666#define C6DOFIMU18_TILT_WAIT_TIME_2S 0x40
667#define C6DOFIMU18_TILT_WAIT_TIME_4S 0x80
668#define C6DOFIMU18_TILT_WAIT_TIME_6S 0xC0
669#define C6DOFIMU18_TILT_WAIT_TIME_MASK 0xC0
670#define C6DOFIMU18_SLEEP_TIME_OUT_1s28 0x00
671#define C6DOFIMU18_SLEEP_TIME_OUT_2s56 0x08
672#define C6DOFIMU18_SLEEP_TIME_OUT_3s84 0x10
673#define C6DOFIMU18_SLEEP_TIME_OUT_5s12 0x18
674#define C6DOFIMU18_SLEEP_TIME_OUT_6s4 0x20
675#define C6DOFIMU18_SLEEP_TIME_OUT_7s68 0x28
676#define C6DOFIMU18_SLEEP_TIME_OUT_8s96 0x30
677#define C6DOFIMU18_SLEEP_TIME_OUT_10s24 0x38
678#define C6DOFIMU18_SLEEP_TIME_OUT_MASK 0x38
679
684#define C6DOFIMU18_TAP_MIN_JERK_THR 0x44
685#define C6DOFIMU18_TAP_MAX_OEAK_TOL 0x01
686
691#define C6DOFIMU18_TAP_TMAX 0x20
692#define C6DOFIMU18_TAP_TAVG 0x08
693#define C6DOFIMU18_TAP_TMIN 0x03
694
699#define C6DOFIMU18_SENSITIVITY_MODE_HIGH_PERF 0x00
700#define C6DOFIMU18_SENSITIVITY_MODE_SLOW_WALK 0x01
701
706#define C6DOFIMU18_TEMPERATURE_DIV 132.48
707#define C6DOFIMU18_TEMPERATURE_ADD 25
708
713#define C6DOFIMU18_WHO_AM_I_VALUE 0x42
714
720#define C6DOFIMU18_DEVICE_ADDRESS_GND 0x68
721#define C6DOFIMU18_DEVICE_ADDRESS_VCC 0x69
722
731#define C6DOFIMU18_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
732#define C6DOFIMU18_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
733 // c6dofimu18_set
735
750#define C6DOFIMU18_MAP_MIKROBUS( cfg, mikrobus ) \
751 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
752 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
753 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
754 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
755 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
756 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
757 cfg.ryc = MIKROBUS( mikrobus, MIKROBUS_AN ); \
758 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
759 // c6dofimu18_map // c6dofimu18
762
767typedef enum
768{
773
778typedef err_t ( *c6dofimu18_master_io_t )( struct c6dofimu18_s*, uint8_t, uint8_t*, uint8_t );
784typedef struct c6dofimu18_s
785{
786 digital_in_t ryc;
787 digital_in_t int_pin;
789 i2c_master_t i2c;
790 spi_master_t spi;
793 pin_name_t chip_select;
794 spi_master_mode_t spi_mode;
795 uint8_t slew_rate;
802
807typedef struct
808{
809 pin_name_t scl;
810 pin_name_t sda;
811 pin_name_t miso;
812 pin_name_t mosi;
813 pin_name_t sck;
814 pin_name_t cs;
815 pin_name_t ryc;
816 pin_name_t int_pin;
818 uint32_t i2c_speed;
819 uint8_t i2c_address;
821 uint32_t spi_speed;
822 spi_master_mode_t spi_mode;
823 spi_master_chip_select_polarity_t cs_polarity;
828
833typedef struct
834{
835 int16_t data_x;
836 int16_t data_y;
837 int16_t data_z;
838
840
845typedef enum
846{
850
852
869
885
900
914
929err_t c6dofimu18_generic_write ( c6dofimu18_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len );
930
945err_t c6dofimu18_generic_read ( c6dofimu18_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len );
946
959err_t c6dofimu18_set_reg_bank( c6dofimu18_t *ctx, uint8_t bank );
960
977err_t c6dofimu18_reg_write ( c6dofimu18_t *ctx, uint8_t reg_bank, uint8_t reg, uint8_t *data_in, uint8_t len );
978
993err_t c6dofimu18_reg_read ( c6dofimu18_t *ctx, uint8_t reg_bank, uint8_t reg, uint8_t *data_out, uint8_t len );
994
1007
1017
1027
1040
1053err_t c6dofimu18_read_temperature ( c6dofimu18_t *ctx, float *temperature_data );
1054
1067err_t c6dofimu18_read_timestamp ( c6dofimu18_t *ctx, uint32_t *tmst_data );
1068
1084err_t c6dofimu18_get_data_from_register ( c6dofimu18_t *ctx, float *temperature_data,
1085 c6dofimu18_data_t *accel_data, c6dofimu18_data_t *gyro_data,
1086 uint32_t *tmst_data );
1087
1099
1113err_t c6dofimu18_get_tap_detection ( c6dofimu18_t *ctx, uint8_t *tap_num, uint8_t *tap_axis, uint8_t *tap_dir );
1114
1115#ifdef __cplusplus
1116}
1117#endif
1118#endif // C6DOFIMU18_H
1119 // c6dofimu18
1121
1122// ------------------------------------------------------------------------ END
c6dofimu18_return_value_t
6DOF IMU 18 Click return value data.
Definition: c6dofimu18.h:846
@ C6DOFIMU18_OK
Definition: c6dofimu18.h:847
@ C6DOFIMU18_RESET_ERROR
Definition: c6dofimu18.h:849
@ C6DOFIMU18_ERROR
Definition: c6dofimu18.h:848
c6dofimu18_drv_t
6DOF IMU 18 Click driver selector.
Definition: c6dofimu18.h:768
@ C6DOFIMU18_DRV_SEL_I2C
Definition: c6dofimu18.h:770
@ C6DOFIMU18_DRV_SEL_SPI
Definition: c6dofimu18.h:769
err_t(* c6dofimu18_master_io_t)(struct c6dofimu18_s *, uint8_t, uint8_t *, uint8_t)
6DOF IMU 18 Click driver interface.
Definition: c6dofimu18.h:778
struct c6dofimu18_s c6dofimu18_t
6DOF IMU 18 Click context object.
err_t c6dofimu18_read_timestamp(c6dofimu18_t *ctx, uint32_t *tmst_data)
6DOF IMU 18 read timestamp function.
err_t c6dofimu18_reg_write(c6dofimu18_t *ctx, uint8_t reg_bank, uint8_t reg, uint8_t *data_in, uint8_t len)
6DOF IMU 18 register data writing function.
err_t c6dofimu18_read_temperature(c6dofimu18_t *ctx, float *temperature_data)
6DOF IMU 18 read temperature function.
err_t c6dofimu18_reg_read(c6dofimu18_t *ctx, uint8_t reg_bank, uint8_t reg, uint8_t *data_out, uint8_t len)
6DOF IMU 18 data reading function.
err_t c6dofimu18_get_data_from_register(c6dofimu18_t *ctx, float *temperature_data, c6dofimu18_data_t *accel_data, c6dofimu18_data_t *gyro_data, uint32_t *tmst_data)
6DOF IMU 18 read data function.
err_t c6dofimu18_default_cfg(c6dofimu18_t *ctx)
6DOF IMU 18 default configuration function.
void c6dofimu18_cfg_setup(c6dofimu18_cfg_t *cfg)
6DOF IMU 18 configuration object setup function.
err_t c6dofimu18_set_reg_bank(c6dofimu18_t *ctx, uint8_t bank)
6DOF IMU 18 set register bank function.
err_t c6dofimu18_generic_write(c6dofimu18_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
6DOF IMU 18 data writing function.
uint8_t c6dofimu18_get_int1_state(c6dofimu18_t *ctx)
6DOF IMU 18 read INT1 pin state function.
err_t c6dofimu18_sw_reset(c6dofimu18_t *ctx)
6DOF IMU 18 software reset function.
err_t c6dofimu18_set_basic_tap_detection(c6dofimu18_t *ctx)
6DOF IMU 18 basic tap detection configuration function.
err_t c6dofimu18_get_tap_detection(c6dofimu18_t *ctx, uint8_t *tap_num, uint8_t *tap_axis, uint8_t *tap_dir)
6DOF IMU 18 get tap detection data function.
err_t c6dofimu18_generic_read(c6dofimu18_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
6DOF IMU 18 data reading function.
void c6dofimu18_drv_interface_selection(c6dofimu18_cfg_t *cfg, c6dofimu18_drv_t drv_sel)
6DOF IMU 18 driver interface setup function.
err_t c6dofimu18_init(c6dofimu18_t *ctx, c6dofimu18_cfg_t *cfg)
6DOF IMU 18 initialization function.
err_t c6dofimu18_configure_digital_interface(c6dofimu18_t *ctx, uint8_t slew_rate)
6DOF IMU 18 configure digital interface function.
This file contains SPI specific macros, functions, etc.
6DOF IMU 18 Click configuration object.
Definition: c6dofimu18.h:808
uint32_t i2c_speed
Definition: c6dofimu18.h:818
pin_name_t ryc
Definition: c6dofimu18.h:815
spi_master_chip_select_polarity_t cs_polarity
Definition: c6dofimu18.h:823
pin_name_t sck
Definition: c6dofimu18.h:813
spi_master_mode_t spi_mode
Definition: c6dofimu18.h:822
pin_name_t mosi
Definition: c6dofimu18.h:812
uint32_t spi_speed
Definition: c6dofimu18.h:821
pin_name_t scl
Definition: c6dofimu18.h:809
pin_name_t int_pin
Definition: c6dofimu18.h:816
pin_name_t miso
Definition: c6dofimu18.h:811
pin_name_t sda
Definition: c6dofimu18.h:810
pin_name_t cs
Definition: c6dofimu18.h:814
uint8_t i2c_address
Definition: c6dofimu18.h:819
c6dofimu18_drv_t drv_sel
Definition: c6dofimu18.h:825
6DOF IMU 18 data object.
Definition: c6dofimu18.h:834
int16_t data_y
Definition: c6dofimu18.h:836
int16_t data_z
Definition: c6dofimu18.h:837
int16_t data_x
Definition: c6dofimu18.h:835
6DOF IMU 18 Click context object.
Definition: c6dofimu18.h:785
spi_master_t spi
Definition: c6dofimu18.h:790
digital_in_t ryc
Definition: c6dofimu18.h:786
uint8_t slew_rate
Definition: c6dofimu18.h:795
c6dofimu18_master_io_t read_f
Definition: c6dofimu18.h:799
spi_master_mode_t spi_mode
Definition: c6dofimu18.h:794
digital_in_t int_pin
Definition: c6dofimu18.h:787
i2c_master_t i2c
Definition: c6dofimu18.h:789
uint8_t slave_address
Definition: c6dofimu18.h:792
c6dofimu18_master_io_t write_f
Definition: c6dofimu18.h:798
pin_name_t chip_select
Definition: c6dofimu18.h:793
c6dofimu18_drv_t drv_sel
Definition: c6dofimu18.h:796