c6dofimu20 2.1.0.0
c6dofimu20.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 C6DOFIMU20_H
29#define C6DOFIMU20_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
61#define C6DOFIMU20_REG_CHIP_ID 0x00
62#define C6DOFIMU20_REG_ERR 0x01
63#define C6DOFIMU20_REG_STATUS 0x02
64#define C6DOFIMU20_REG_ACC_DATA_X 0x03
65#define C6DOFIMU20_REG_ACC_DATA_Y 0x04
66#define C6DOFIMU20_REG_ACC_DATA_Z 0x05
67#define C6DOFIMU20_REG_GYR_DATA_X 0x06
68#define C6DOFIMU20_REG_GYR_DATA_Y 0x07
69#define C6DOFIMU20_REG_GYR_DATA_Z 0x08
70#define C6DOFIMU20_REG_TEMP_DATA 0x09
71#define C6DOFIMU20_REG_SENSOR_TIME_0 0x0A
72#define C6DOFIMU20_REG_SENSOR_TIME_1 0x0B
73#define C6DOFIMU20_REG_SAT_FLAGS 0x0C
74#define C6DOFIMU20_REG_INT_STATUS_INT1 0x0D
75#define C6DOFIMU20_REG_INT_STATUS_INT2 0x0E
76#define C6DOFIMU20_REG_INT_STATUS_IBI 0x0F
77#define C6DOFIMU20_REG_FEATURE_IO0 0x10
78#define C6DOFIMU20_REG_FEATURE_IO1 0x11
79#define C6DOFIMU20_REG_FEATURE_IO2 0x12
80#define C6DOFIMU20_REG_FEATURE_IO3 0x13
81#define C6DOFIMU20_REG_FEATURE_IO_STATUS 0x14
82#define C6DOFIMU20_REG_FIFO_FILL_LEVEL 0x15
83#define C6DOFIMU20_REG_FIFO_DATA 0x16
84#define C6DOFIMU20_REG_ACC_CONF 0x20
85#define C6DOFIMU20_REG_GYR_CONF 0x21
86#define C6DOFIMU20_REG_ALT_ACC_CONF 0x28
87#define C6DOFIMU20_REG_ALT_GYR_CONF 0x29
88#define C6DOFIMU20_REG_ALT_CONF 0x2A
89#define C6DOFIMU20_REG_ALT_STATUS 0x2B
90#define C6DOFIMU20_REG_FIFO_WATERMARK 0x35
91#define C6DOFIMU20_REG_FIFO_CONF 0x36
92#define C6DOFIMU20_REG_FIFO_CTRL 0x37
93#define C6DOFIMU20_REG_IO_INT_CTRL 0x38
94#define C6DOFIMU20_REG_INT_CONF 0x39
95#define C6DOFIMU20_REG_INT_MAP1 0x3A
96#define C6DOFIMU20_REG_INT_MAP2 0x3B
97#define C6DOFIMU20_REG_FEATURE_CTRL 0x40
98#define C6DOFIMU20_REG_FEATURE_DATA_ADDR 0x41
99#define C6DOFIMU20_REG_FEATURE_DATA_TX 0x42
100#define C6DOFIMU20_REG_FEATURE_DATA_STATUS 0x43
101#define C6DOFIMU20_REG_FEATURE_ENGINE_STATUS 0x45
102#define C6DOFIMU20_REG_FEATURE_EVENT_EXT 0x47
103#define C6DOFIMU20_REG_IO_PDN_CTRL 0x4F
104#define C6DOFIMU20_REG_IO_SPI_IF 0x50
105#define C6DOFIMU20_REG_IO_PAD_STRENGTH 0x51
106#define C6DOFIMU20_REG_IO_I2C_IF 0x52
107#define C6DOFIMU20_REG_IO_ODR_DEVIATION 0x53
108#define C6DOFIMU20_REG_ACC_DP_OFF_X 0x60
109#define C6DOFIMU20_REG_ACC_DP_DGAIN_X 0x61
110#define C6DOFIMU20_REG_ACC_DP_OFF_Y 0x62
111#define C6DOFIMU20_REG_ACC_DP_DGAIN_Y 0x63
112#define C6DOFIMU20_REG_ACC_DP_OFF_Z 0x64
113#define C6DOFIMU20_REG_ACC_DP_DGAIN_Z 0x65
114#define C6DOFIMU20_REG_GYR_DP_OFF_X 0x66
115#define C6DOFIMU20_REG_GYR_DP_DGAIN_X 0x67
116#define C6DOFIMU20_REG_GYR_DP_OFF_Y 0x68
117#define C6DOFIMU20_REG_GYR_DP_DGAIN_Y 0x69
118#define C6DOFIMU20_REG_GYR_DP_OFF_Z 0x6A
119#define C6DOFIMU20_REG_GYR_DP_DGAIN_Z 0x6B
120#define C6DOFIMU20_REG_CMD 0x7E
121#define C6DOFIMU20_REG_CFG_RES 0x7F
122
127#define C6DOFIMU20_REG_SC_ST_VALUE4 0x2C
128#define C6DOFIMU20_REG_SC_ST_VALUE3 0x2B
129#define C6DOFIMU20_REG_SC_ST_VALUE2 0x2A
130#define C6DOFIMU20_REG_SC_ST_VALUE1 0x29
131#define C6DOFIMU20_REG_SC_ST_VALUE0 0x28
132#define C6DOFIMU20_REG_GYR_SC_ST_CONF_RE 0x27
133#define C6DOFIMU20_REG_GYR_SC_SELECT 0x26
134#define C6DOFIMU20_REG_ST_SELECT 0x25
135#define C6DOFIMU20_REG_ST_RESULT 0x24
136#define C6DOFIMU20_REG_ALT_CONFIG_CHG 0x23
137#define C6DOFIMU20_REG_TILT_2 0x22
138#define C6DOFIMU20_REG_TILT_1 0x21
139#define C6DOFIMU20_REG_TAP_3 0x20
140#define C6DOFIMU20_REG_TAP_2 0x1F
141#define C6DOFIMU20_REG_TAP_1 0x1E
142#define C6DOFIMU20_REG_ORIENT_2 0x1D
143#define C6DOFIMU20_REG_ORIENT_1 0x1C
144#define C6DOFIMU20_REG_SC_12 0x1B
145#define C6DOFIMU20_REG_SC_11 0x1A
146#define C6DOFIMU20_REG_SC_10 0x19
147#define C6DOFIMU20_REG_SC_9 0x18
148#define C6DOFIMU20_REG_SC_8 0x17
149#define C6DOFIMU20_REG_SC_7 0x16
150#define C6DOFIMU20_REG_SC_6 0x15
151#define C6DOFIMU20_REG_SC_5 0x14
152#define C6DOFIMU20_REG_SC_4 0x13
153#define C6DOFIMU20_REG_SC_3 0x12
154#define C6DOFIMU20_REG_SC_2 0x11
155#define C6DOFIMU20_REG_SC_1 0x10
156#define C6DOFIMU20_REG_SIGMO_3 0x0F
157#define C6DOFIMU20_REG_SIGMO_2 0x0E
158#define C6DOFIMU20_REG_SIGMO_1 0x0D
159#define C6DOFIMU20_REG_FLAT_2 0x0C
160#define C6DOFIMU20_REG_FLAT_1 0x0B
161#define C6DOFIMU20_REG_MOMO_3 0x0A
162#define C6DOFIMU20_REG_MOMO_2 0x09
163#define C6DOFIMU20_REG_MOMO_1 0x08
164#define C6DOFIMU20_REG_ANYMO_3 0x07
165#define C6DOFIMU20_REG_ANYMO_2 0x06
166#define C6DOFIMU20_REG_ANYMO_1 0x05
167#define C6DOFIMU20_REG_AXIS_MAP_1 0x03
168#define C6DOFIMU20_REG_GEN_SET_1 0x02
169 // c6dofimu20_reg
171
186#define C6DOFIMU20_SW_RESET_CMD 0xDEAF
187
192#define C6DOFIMU20_REG_ERR_FATAL_ERR_FLAG 0x0001
193#define C6DOFIMU20_REG_ERR_FEAT_ENG_OVRLD_FLAG 0x0004
194#define C6DOFIMU20_REG_ERR_ACC_CONF_ERR_FLAG 0x0020
195#define C6DOFIMU20_REG_ERR_GYR_CONF_ERR_FLAG 0x0040
196
201#define C6DOFIMU20_STATUS_POR_DETECTED_FLAG 0x0001
202#define C6DOFIMU20_STATUS_DRDY_TEMP_FLAG 0x0020
203#define C6DOFIMU20_STATUS_DRDY_GYR_FLAG 0x0040
204#define C6DOFIMU20_STATUS_DRDY_ACC_FLAG 0x0080
205
210#define C6DOFIMU20_SAT_FLAGS_SATF_ACC_X_FLAG 0x0001
211#define C6DOFIMU20_SAT_FLAGS_SATF_ACC_Y_FLAG 0x0002
212#define C6DOFIMU20_SAT_FLAGS_SATF_ACC_Z_FLAG 0x0004
213#define C6DOFIMU20_SAT_FLAGS_SATF_GYR_X_FLAG 0x0008
214#define C6DOFIMU20_SAT_FLAGS_SATF_GYR_Y_FLAG 0x0010
215#define C6DOFIMU20_SAT_FLAGS_SATF_GYR_Z_FLAG 0x0020
216
221#define C6DOFIMU20_INT_STATUS_INT1_NO_MOTION 0x0001
222#define C6DOFIMU20_INT_STATUS_INT1_ANY_MOTION 0x0002
223#define C6DOFIMU20_INT_STATUS_INT1_FLAT 0x0004
224#define C6DOFIMU20_INT_STATUS_INT1_ORIENTATION 0x0008
225#define C6DOFIMU20_INT_STATUS_INT1_STEP_DETECTOR 0x0010
226#define C6DOFIMU20_INT_STATUS_INT1_STEP_COUNTER 0x0020
227#define C6DOFIMU20_INT_STATUS_INT1_SIG_MOTION 0x0040
228#define C6DOFIMU20_INT_STATUS_INT1_TILT 0x0080
229#define C6DOFIMU20_INT_STATUS_INT1_TAP 0x0100
230#define C6DOFIMU20_INT_STATUS_INT1_ERR_STATUS 0x0400
231#define C6DOFIMU20_INT_STATUS_INT1_TEMP_DRDY 0x0800
232#define C6DOFIMU20_INT_STATUS_INT1_GYR_DRDY 0x1000
233#define C6DOFIMU20_INT_STATUS_INT1_ACC_DRDY 0x2000
234#define C6DOFIMU20_INT_STATUS_INT1_FWM 0x4000
235#define C6DOFIMU20_INT_STATUS_INT1_FFULL 0x8000
236
241#define C6DOFIMU20_INT_STATUS_INT2_NO_MOTION 0x0001
242#define C6DOFIMU20_INT_STATUS_INT2_ANY_MOTION 0x0002
243#define C6DOFIMU20_INT_STATUS_INT2_FLAT 0x0004
244#define C6DOFIMU20_INT_STATUS_INT2_ORIENTATION 0x0008
245#define C6DOFIMU20_INT_STATUS_INT2_STEP_DETECTOR 0x0010
246#define C6DOFIMU20_INT_STATUS_INT2_STEP_COUNTER 0x0020
247#define C6DOFIMU20_INT_STATUS_INT2_SIG_MOTION 0x0040
248#define C6DOFIMU20_INT_STATUS_INT2_TILT 0x0080
249#define C6DOFIMU20_INT_STATUS_INT2_TAP 0x0100
250#define C6DOFIMU20_INT_STATUS_INT2_ERR_STATUS 0x0400
251#define C6DOFIMU20_INT_STATUS_INT2_TEMP_DRDY 0x0800
252#define C6DOFIMU20_INT_STATUS_INT2_GYR_DRDY 0x1000
253#define C6DOFIMU20_INT_STATUS_INT2_ACC_DRDY 0x2000
254#define C6DOFIMU20_INT_STATUS_INT2_FWM 0x4000
255#define C6DOFIMU20_INT_STATUS_INT2_FFULL 0x8000
256
261#define C6DOFIMU20_ACC_CONF_ODR_0POINT78125_Hz 0x0001
262#define C6DOFIMU20_ACC_CONF_ODR_1POINT5625_Hz 0x0002
263#define C6DOFIMU20_ACC_CONF_ODR_3POINT125_Hz 0x0003
264#define C6DOFIMU20_ACC_CONF_ODR_6POINT25_Hz 0x0004
265#define C6DOFIMU20_ACC_CONF_ODR_12POINT5_Hz 0x0005
266#define C6DOFIMU20_ACC_CONF_ODR_25_Hz 0x0006
267#define C6DOFIMU20_ACC_CONF_ODR_50_Hz 0x0007
268#define C6DOFIMU20_ACC_CONF_ODR_100_Hz 0x0008
269#define C6DOFIMU20_ACC_CONF_ODR_200_Hz 0x0009
270#define C6DOFIMU20_ACC_CONF_ODR_400_Hz 0x000A
271#define C6DOFIMU20_ACC_CONF_ODR_800_Hz 0x000B
272#define C6DOFIMU20_ACC_CONF_ODR_1POINT6_kHz 0x000C
273#define C6DOFIMU20_ACC_CONF_ODR_3POINT2_kHz 0x000D
274#define C6DOFIMU20_ACC_CONF_ODR_6POINT4_kHz 0x000E
275#define C6DOFIMU20_ACC_CONF_ACC_RANGE_2G 0x0000
276#define C6DOFIMU20_ACC_CONF_ACC_RANGE_4G 0x0010
277#define C6DOFIMU20_ACC_CONF_ACC_RANGE_8G 0x0020
278#define C6DOFIMU20_ACC_CONF_ACC_RANGE_16G 0x0030
279#define C6DOFIMU20_ACC_CONF_ACC_BW_DIV_2 0x0000
280#define C6DOFIMU20_ACC_CONF_ACC_BW_DIV_4 0x0080
281#define C6DOFIMU20_ACC_CONF_ACC_AVG_NUM_0 0x0000
282#define C6DOFIMU20_ACC_CONF_ACC_AVG_NUM_2 0x0100
283#define C6DOFIMU20_ACC_CONF_ACC_AVG_NUM_4 0x0200
284#define C6DOFIMU20_ACC_CONF_ACC_AVG_NUM_8 0x0300
285#define C6DOFIMU20_ACC_CONF_ACC_AVG_NUM_16 0x0400
286#define C6DOFIMU20_ACC_CONF_ACC_AVG_NUM_32 0x0500
287#define C6DOFIMU20_ACC_CONF_ACC_AVG_NUM_64 0x0600
288#define C6DOFIMU20_ACC_CONF_ACC_MODE_DIS 0x0000
289#define C6DOFIMU20_ACC_CONF_ACC_MODE_DUTY_CYCLING 0x3000
290#define C6DOFIMU20_ACC_CONF_ACC_MODE_CONSTANT_OPERATION 0x4000
291#define C6DOFIMU20_ACC_CONF_ACC_MODE_HIGH_PERFORMANCE 0x7000
292
297#define C6DOFIMU20_GYR_CONF_ODR_0POINT78125_Hz 0x0001
298#define C6DOFIMU20_GYR_CONF_ODR_1POINT5625_Hz 0x0002
299#define C6DOFIMU20_GYR_CONF_ODR_3POINT125_Hz 0x0003
300#define C6DOFIMU20_GYR_CONF_ODR_6POINT25_Hz 0x0004
301#define C6DOFIMU20_GYR_CONF_ODR_12POINT5_Hz 0x0005
302#define C6DOFIMU20_GYR_CONF_ODR_25_Hz 0x0006
303#define C6DOFIMU20_GYR_CONF_ODR_50_Hz 0x0007
304#define C6DOFIMU20_GYR_CONF_ODR_100_Hz 0x0008
305#define C6DOFIMU20_GYR_CONF_ODR_200_Hz 0x0009
306#define C6DOFIMU20_GYR_CONF_ODR_400_Hz 0x000A
307#define C6DOFIMU20_GYR_CONF_ODR_800_Hz 0x000B
308#define C6DOFIMU20_GYR_CONF_ODR_1POINT6_kHz 0x000C
309#define C6DOFIMU20_GYR_CONF_ODR_3POINT2_kHz 0x000D
310#define C6DOFIMU20_GYR_CONF_ODR_6POINT4_kHz 0x000E
311#define C6DOFIMU20_GYR_CONF_GYR_RANGE_2G 0x0000
312#define C6DOFIMU20_GYR_CONF_GYR_RANGE_4G 0x0010
313#define C6DOFIMU20_GYR_CONF_GYR_RANGE_8G 0x0020
314#define C6DOFIMU20_GYR_CONF_GYR_RANGE_16G 0x0030
315#define C6DOFIMU20_GYR_CONF_GYR_BW_DIV_2 0x0000
316#define C6DOFIMU20_GYR_CONF_GYR_BW_DIV_4 0x0080
317#define C6DOFIMU20_GYR_CONF_GYR_AVG_NUM_0 0x0000
318#define C6DOFIMU20_GYR_CONF_GYR_AVG_NUM_2 0x0100
319#define C6DOFIMU20_GYR_CONF_GYR_AVG_NUM_4 0x0200
320#define C6DOFIMU20_GYR_CONF_GYR_AVG_NUM_8 0x0300
321#define C6DOFIMU20_GYR_CONF_GYR_AVG_NUM_16 0x0400
322#define C6DOFIMU20_GYR_CONF_GYR_AVG_NUM_32 0x0500
323#define C6DOFIMU20_GYR_CONF_GYR_AVG_NUM_64 0x0600
324#define C6DOFIMU20_GYR_CONF_GYR_MODE_DIS 0x0000
325#define C6DOFIMU20_GYR_CONF_GYR_MODE_DUTY_CYCLING 0x3000
326#define C6DOFIMU20_GYR_CONF_GYR_MODE_CONSTANT_OPERATION 0x4000
327#define C6DOFIMU20_GYR_CONF_GYR_MODE_HIGH_PERFORMANCE 0x7000
328
333#define C6DOFIMU20_IO_INT_CTRL_INT1_LVL_ACTIVE_HIGH 0x0001
334#define C6DOFIMU20_IO_INT_CTRL_INT1_LVL_ACTIVE_LOW 0x0000
335#define C6DOFIMU20_IO_INT_CTRL_INT1_OUTPUT_PUSH_PULL 0x0000
336#define C6DOFIMU20_IO_INT_CTRL_INT1_OUTPUT_OPEN_DRAIN 0x0002
337#define C6DOFIMU20_IO_INT_CTRL_INT1_OUTPUT_EN 0x0004
338#define C6DOFIMU20_IO_INT_CTRL_INT2_LVL_ACTIVE_HIGH 0x0100
339#define C6DOFIMU20_IO_INT_CTRL_INT2_LVL_ACTIVE_LOW 0x0000
340#define C6DOFIMU20_IO_INT_CTRL_INT2_OUTPUT_PUSH_PULL 0x0000
341#define C6DOFIMU20_IO_INT_CTRL_INT2_OUTPUT_OPEN_DRAIN 0x0200
342#define C6DOFIMU20_IO_INT_CTRL_INT2_OUTPUT_EN 0x0400
343
348#define C6DOFIMU20_INT_CONF_INT_LATCH_EN 0x0001
349#define C6DOFIMU20_INT_CONF_INT_LATCH_DIS 0x0000
350
355#define C6DOFIMU20_INT_MAP1_NO_MOTION_OUT_DIS 0x0000
356#define C6DOFIMU20_INT_MAP1_NO_MOTION_OUT_INT1 0x0001
357#define C6DOFIMU20_INT_MAP1_NO_MOTION_OUT_INT2 0x0002
358#define C6DOFIMU20_INT_MAP1_ANY_MOTION_OUT_DIS 0x0000
359#define C6DOFIMU20_INT_MAP1_ANY_MOTION_OUT_INT1 0x0004
360#define C6DOFIMU20_INT_MAP1_ANY_MOTION_OUT_INT2 0x0008
361#define C6DOFIMU20_INT_MAP1_FLAT_OUT_DIS 0x0000
362#define C6DOFIMU20_INT_MAP1_FLAT_OUT_INT1 0x0010
363#define C6DOFIMU20_INT_MAP1_FLAT_OUT_INT2 0x0020
364#define C6DOFIMU20_INT_MAP1_ORIENTATION_OUT_DIS 0x0000
365#define C6DOFIMU20_INT_MAP1_ORIENTATION_OUT_INT1 0x0040
366#define C6DOFIMU20_INT_MAP1_ORIENTATION_OUT_INT2 0x0080
367#define C6DOFIMU20_INT_MAP1_STEP_DETECTOR_OUT_DIS 0x0000
368#define C6DOFIMU20_INT_MAP1_STEP_DETECTOR_OUT_INT1 0x0100
369#define C6DOFIMU20_INT_MAP1_STEP_DETECTOR_OUT_INT2 0x0200
370#define C6DOFIMU20_INT_MAP1_STEP_COUNTER_OUT_DIS 0x0000
371#define C6DOFIMU20_INT_MAP1_STEP_COUNTER_OUT_INT1 0x0400
372#define C6DOFIMU20_INT_MAP1_STEP_COUNTER_OUT_INT2 0x0800
373#define C6DOFIMU20_INT_MAP1_SIG_MOTION_OUT_DIS 0x0000
374#define C6DOFIMU20_INT_MAP1_SIG_MOTION_OUT_INT1 0x1000
375#define C6DOFIMU20_INT_MAP1_SIG_MOTION_OUT_INT2 0x2000
376#define C6DOFIMU20_INT_MAP1_TILT_OUT_DIS 0x0000
377#define C6DOFIMU20_INT_MAP1_TILT_OUT_INT1 0x4000
378#define C6DOFIMU20_INT_MAP1_TILT_OUT_INT2 0x8000
379
384#define C6DOFIMU20_INT_MAP2_TAP_OUT_OUT_DIS 0x0000
385#define C6DOFIMU20_INT_MAP2_TAP_OUT_OUT_INT1 0x0001
386#define C6DOFIMU20_INT_MAP2_TAP_OUT_OUT_INT2 0x0002
387#define C6DOFIMU20_INT_MAP2_ERR_STATUS_DIS 0x0000
388#define C6DOFIMU20_INT_MAP2_ERR_STATUS_INT1 0x0010
389#define C6DOFIMU20_INT_MAP2_ERR_STATUS_INT2 0x0020
390#define C6DOFIMU20_INT_MAP2_TEMP_DRDY_INT_DIS 0x0000
391#define C6DOFIMU20_INT_MAP2_TEMP_DRDY_INT_INT1 0x0040
392#define C6DOFIMU20_INT_MAP2_TEMP_DRDY_INT_INT2 0x0080
393#define C6DOFIMU20_INT_MAP2_GYR_DRDY_INT_DIS 0x0000
394#define C6DOFIMU20_INT_MAP2_GYR_DRDY_INT_INT1 0x0100
395#define C6DOFIMU20_INT_MAP2_GYR_DRDY_INT_INT2 0x0200
396#define C6DOFIMU20_INT_MAP2_ACC_DRDY_INT_DIS 0x0000
397#define C6DOFIMU20_INT_MAP2_ACC_DRDY_INT_INT1 0x0400
398#define C6DOFIMU20_INT_MAP2_ACC_DRDY_INT_INT2 0x0800
399#define C6DOFIMU20_INT_MAP2_FIFO_WATERMARK_INT_DIS 0x0000
400#define C6DOFIMU20_INT_MAP2_FIFO_WATERMARK_INT_INT1 0x1000
401#define C6DOFIMU20_INT_MAP2_FIFO_WATERMARK_INT_INT2 0x2000
402#define C6DOFIMU20_INT_MAP2_FIFO_FULL_INT_DIS 0x0000
403#define C6DOFIMU20_INT_MAP2_FIFO_FULL_INT_INT1 0x4000
404#define C6DOFIMU20_INT_MAP2_FIFO_FULL_INT_INT2 0x8000
405
411#define C6DOFIMU20_TEMP_CALC_DIVIDER 512
412#define C6DOFIMU20_TEMP_CALC_VALUE 23
413
419#define C6DOFIMU20_CHIP_ID 0x43
420
426#define C6DOFIMU20_DEVICE_ADDRESS_GND 0x68
427#define C6DOFIMU20_DEVICE_ADDRESS_VCC 0x69
428
437#define C6DOFIMU20_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
438#define C6DOFIMU20_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
439 // c6dofimu20_set
441
456#define C6DOFIMU20_MAP_MIKROBUS( cfg, mikrobus ) \
457 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
458 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
459 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
460 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
461 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
462 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
463 cfg.it1 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
464 cfg.it2 = MIKROBUS( mikrobus, MIKROBUS_INT )
465 // c6dofimu20_map // c6dofimu20
468
473typedef enum
474{
479
484typedef err_t ( *c6dofimu20_master_io_t )( struct c6dofimu20_s*, uint8_t, uint8_t*, uint8_t );
490typedef struct c6dofimu20_s
491{
492 digital_out_t cs;
494 digital_in_t it1;
495 digital_in_t it2;
497 i2c_master_t i2c;
498 spi_master_t spi;
501 pin_name_t chip_select;
508
513typedef struct
514{
515 pin_name_t scl;
516 pin_name_t sda;
517 pin_name_t miso;
518 pin_name_t mosi;
519 pin_name_t sck;
520 pin_name_t cs;
521 pin_name_t it1;
522 pin_name_t it2;
524 uint32_t i2c_speed;
525 uint8_t i2c_address;
527 uint32_t spi_speed;
528 spi_master_mode_t spi_mode;
529 spi_master_chip_select_polarity_t cs_polarity;
534
539typedef struct
540{
541 uint16_t data_x;
542 uint16_t data_y;
543 uint16_t data_z;
544
546
551typedef enum
552{
555
557
574
590
605
619
634err_t c6dofimu20_generic_write ( c6dofimu20_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len );
635
650err_t c6dofimu20_generic_read ( c6dofimu20_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len );
651
664err_t c6dofimu20_set_reg ( c6dofimu20_t *ctx, uint8_t reg, uint16_t data_in );
665
678err_t c6dofimu20_get_reg ( c6dofimu20_t *ctx, uint8_t reg, uint16_t *data_out );
679
691err_t c6dofimu20_get_id ( c6dofimu20_t *ctx, uint8_t *chip_id );
692
702
712
726
740
752err_t c6dofimu20_get_temperature ( c6dofimu20_t *ctx, float *temp_data );
753
765
766#ifdef __cplusplus
767}
768#endif
769#endif // C6DOFIMU20_H
770 // c6dofimu20
772
773// ------------------------------------------------------------------------ END
c6dofimu20_return_value_t
6 DOF IMU 20 Click return value data.
Definition: c6dofimu20.h:552
@ C6DOFIMU20_OK
Definition: c6dofimu20.h:553
@ C6DOFIMU20_ERROR
Definition: c6dofimu20.h:554
err_t(* c6dofimu20_master_io_t)(struct c6dofimu20_s *, uint8_t, uint8_t *, uint8_t)
6 DOF IMU 20 Click driver interface.
Definition: c6dofimu20.h:484
struct c6dofimu20_s c6dofimu20_t
6 DOF IMU 20 Click context object.
c6dofimu20_drv_t
6 DOF IMU 20 Click driver selector.
Definition: c6dofimu20.h:474
@ C6DOFIMU20_DRV_SEL_I2C
Definition: c6dofimu20.h:476
@ C6DOFIMU20_DRV_SEL_SPI
Definition: c6dofimu20.h:475
err_t c6dofimu20_get_temperature(c6dofimu20_t *ctx, float *temp_data)
6 DOF IMU 20 temperature reading function.
err_t c6dofimu20_set_reg(c6dofimu20_t *ctx, uint8_t reg, uint16_t data_in)
6 DOF IMU 20 register data writing function.
void c6dofimu20_drv_interface_selection(c6dofimu20_cfg_t *cfg, c6dofimu20_drv_t drv_sel)
6 DOF IMU 20 driver interface setup function.
uint8_t c6dofimu20_get_int2_state(c6dofimu20_t *ctx)
6 DOF IMU 20 IT2 state reading function.
err_t c6dofimu20_generic_read(c6dofimu20_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
6 DOF IMU 20 data reading function.
err_t c6dofimu20_get_gyr_data(c6dofimu20_t *ctx, c6dofimu20_data_t *gyr_data)
6 DOF IMU 20 gyro data reading function.
uint8_t c6dofimu20_get_int1_state(c6dofimu20_t *ctx)
6 DOF IMU 20 IT1 state reading function.
err_t c6dofimu20_get_id(c6dofimu20_t *ctx, uint8_t *chip_id)
6 DOF IMU 20 register chip id reading function.
err_t c6dofimu20_init(c6dofimu20_t *ctx, c6dofimu20_cfg_t *cfg)
6 DOF IMU 20 initialization function.
err_t c6dofimu20_default_cfg(c6dofimu20_t *ctx)
6 DOF IMU 20 default configuration function.
err_t c6dofimu20_generic_write(c6dofimu20_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
6 DOF IMU 20 data writing function.
err_t c6dofimu20_get_reg(c6dofimu20_t *ctx, uint8_t reg, uint16_t *data_out)
6 DOF IMU 20 register data reading function.
err_t c6dofimu20_get_acc_data(c6dofimu20_t *ctx, c6dofimu20_data_t *acc_data)
6 DOF IMU 20 accel data reading function.
void c6dofimu20_cfg_setup(c6dofimu20_cfg_t *cfg)
6 DOF IMU 20 configuration object setup function.
err_t c6dofimu20_sw_reset(c6dofimu20_t *ctx)
6 DOF IMU 20 software reset function.
This file contains SPI specific macros, functions, etc.
6 DOF IMU 20 Click configuration object.
Definition: c6dofimu20.h:514
pin_name_t it2
Definition: c6dofimu20.h:522
uint32_t i2c_speed
Definition: c6dofimu20.h:524
pin_name_t it1
Definition: c6dofimu20.h:521
spi_master_chip_select_polarity_t cs_polarity
Definition: c6dofimu20.h:529
pin_name_t sck
Definition: c6dofimu20.h:519
spi_master_mode_t spi_mode
Definition: c6dofimu20.h:528
pin_name_t mosi
Definition: c6dofimu20.h:518
uint32_t spi_speed
Definition: c6dofimu20.h:527
pin_name_t scl
Definition: c6dofimu20.h:515
pin_name_t miso
Definition: c6dofimu20.h:517
pin_name_t sda
Definition: c6dofimu20.h:516
c6dofimu20_drv_t drv_sel
Definition: c6dofimu20.h:531
pin_name_t cs
Definition: c6dofimu20.h:520
uint8_t i2c_address
Definition: c6dofimu20.h:525
6 DOF IMU 20 Click data object.
Definition: c6dofimu20.h:540
uint16_t data_y
Definition: c6dofimu20.h:542
uint16_t data_z
Definition: c6dofimu20.h:543
uint16_t data_x
Definition: c6dofimu20.h:541
6 DOF IMU 20 Click context object.
Definition: c6dofimu20.h:491
digital_out_t cs
Definition: c6dofimu20.h:492
spi_master_t spi
Definition: c6dofimu20.h:498
digital_in_t it2
Definition: c6dofimu20.h:495
c6dofimu20_master_io_t write_f
Definition: c6dofimu20.h:504
i2c_master_t i2c
Definition: c6dofimu20.h:497
c6dofimu20_master_io_t read_f
Definition: c6dofimu20.h:505
uint8_t slave_address
Definition: c6dofimu20.h:500
c6dofimu20_drv_t drv_sel
Definition: c6dofimu20.h:502
pin_name_t chip_select
Definition: c6dofimu20.h:501
digital_in_t it1
Definition: c6dofimu20.h:494