c6dofimu10  2.0.0.0
c6dofimu10.h
Go to the documentation of this file.
1 /*
2  * MikroSDK - MikroE Software Development Kit
3  * Copyright© 2020 MikroElektronika d.o.o.
4  *
5  * Permission is hereby granted, free of charge, to any person
6  * obtaining a copy of this software and associated documentation
7  * files (the "Software"), to deal in the Software without restriction,
8  * including without limitation the rights to use, copy, modify, merge,
9  * publish, distribute, sublicense, and/or sell copies of the Software,
10  * and to permit persons to whom the Software is furnished to do so,
11  * subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
22  * OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
33 // ----------------------------------------------------------------------------
34 
35 #ifndef c6DOFIMU10_H
36 #define c6DOFIMU10_H
37 
38 #include "mikrosdk_version.h"
39 
40 #ifdef __GNUC__
41 #if mikroSDK_GET_VERSION < 20800ul
42 #include "rcu_delays.h"
43 #else
44 #include "delays.h"
45 #endif
46 #endif
47 
48 #include "drv_digital_out.h"
49 #include "drv_digital_in.h"
50 #include "drv_i2c_master.h"
51 
52 
53 // -------------------------------------------------------------- PUBLIC MACROS
63 #define c6DOFIMU10_MAP_MIKROBUS( cfg, mikrobus ) \
64  cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
65  cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
66  cfg.gp2 = MIKROBUS( mikrobus, MIKROBUS_RST ); \
67  cfg.gp1 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
68 
74 #define c6DOFIMU10_RETVAL uint8_t
75 
76 #define c6DOFIMU10_OK 0x00
77 #define c6DOFIMU10_INIT_ERROR 0xFF
78 
84 #define C6DOFIMU10_SLAVE_ADDRESS_GND 0x0E
85 #define C6DOFIMU10_SLAVE_ADDRESS_VCC 0x0F
86 
92 #define C6DOFIMU10_REG_WHO_AM_I 0x00
93 #define C6DOFIMU10_REG_INS_1 0x01
94 #define C6DOFIMU10_REG_INS_2 0x02
95 #define C6DOFIMU10_REG_INS_3 0x03
96 #define C6DOFIMU10_REG_INL 0x05
97 #define C6DOFIMU10_REG_ACCEL_XOUT_L 0x0A
98 #define C6DOFIMU10_REG_ACCEL_XOUT 0x0A
99 #define C6DOFIMU10_REG_ACCEL_XOUT_H 0x0B
100 #define C6DOFIMU10_REG_ACCEL_YOUT_L 0x0C
101 #define C6DOFIMU10_REG_ACCEL_YOUT 0x0C
102 #define C6DOFIMU10_REG_ACCEL_YOUT_H 0x0D
103 #define C6DOFIMU10_REG_ACCEL_ZOUT_L 0x0E
104 #define C6DOFIMU10_REG_ACCEL_ZOUT 0x0E
105 #define C6DOFIMU10_REG_ACCEL_ZOUT_H 0x0F
106 #define C6DOFIMU10_REG_MAG_XOUT_L 0x10
107 #define C6DOFIMU10_REG_MAG_XOUT 0x10
108 #define C6DOFIMU10_REG_MAG_XOUT_H 0x11
109 #define C6DOFIMU10_REG_MAG_YOUT_L 0x12
110 #define C6DOFIMU10_REG_MAG_YOUT 0x12
111 #define C6DOFIMU10_REG_MAG_YOUT_H 0x13
112 #define C6DOFIMU10_REG_MAG_ZOUT_L 0x14
113 #define C6DOFIMU10_REG_MAG_ZOUT 0x14
114 #define C6DOFIMU10_REG_MAG_ZOUT_H 0x15
115 #define C6DOFIMU10_REG_TEMP_OUT_L 0x16
116 #define C6DOFIMU10_REG_TEMP_OUT 0x16
117 #define C6DOFIMU10_REG_TEMP_OUT_H 0x17
118 #define C6DOFIMU10_REG_INC_1 0x2A
119 #define C6DOFIMU10_REG_INC_2 0x2B
120 #define C6DOFIMU10_REG_INC_3 0x2C
121 #define C6DOFIMU10_REG_INC_4 0x2D
122 #define C6DOFIMU10_REG_INC_5 0x2E
123 #define C6DOFIMU10_REG_AMI_CNTL_1 0x2F
124 #define C6DOFIMU10_REG_AMI_CNTL_2 0x30
125 #define C6DOFIMU10_REG_AMI_CNTL_3 0x31
126 #define C6DOFIMU10_REG_MMI_CNTL_1 0x32
127 #define C6DOFIMU10_REG_MMI_CNTL_2 0x33
128 #define C6DOFIMU10_REG_MMI_CNTL_3 0x34
129 #define C6DOFIMU10_REG_FFI_CNTL_1 0x35
130 #define C6DOFIMU10_REG_FFI_CNTL_2 0x36
131 #define C6DOFIMU10_REG_FFI_CNTL_3 0x37
132 #define C6DOFIMU10_REG_ODCNTL 0x38
133 #define C6DOFIMU10_REG_CNTL_1 0x39
134 #define C6DOFIMU10_REG_CNTL_2 0x3A
135 #define C6DOFIMU10_REG_COTR 0x3C
136 #define C6DOFIMU10_REG_BUF_CTRL_1 0x77
137 #define C6DOFIMU10_REG_BUF_CTRL_2 0x78
138 #define C6DOFIMU10_REG_BUF_CTRL_3 0x79
139 #define C6DOFIMU10_REG_BUF_CLEAR 0x7A
140 #define C6DOFIMU10_REG_BUF_STATUS_1 0x7B
141 #define C6DOFIMU10_REG_BUF_STATUS_2 0x7C
142 #define C6DOFIMU10_REG_BUF_STATUS_3 0x7D
143 #define C6DOFIMU10_REG_BUF_READ 0x7E
144 
150 #define C6DOFIMU10_DEF_WHO_AM_I 0x18
151 
157 #define C6DOFIMU10_INS1_NO_INTERRUPT_EVENT 0x00
158 #define C6DOFIMU10_INS1_INTERRUPT_EVENT 0x80
159 #define C6DOFIMU10_INS1_BUFFER_IS_NOT_FULL 0x00
160 #define C6DOFIMU10_INS1_BUFFER_IS_FULL 0x40
161 #define C6DOFIMU10_INS1_BUFFER_WM_NOT_REACHED 0x00
162 #define C6DOFIMU10_INS1_BUFFER_WM_REACHED 0x20
163 #define C6DOFIMU10_INS1_ACCEL_DATA_NOT_AVAILABLE 0x00
164 #define C6DOFIMU10_INS1_ACCEL_DATA_AVAILABLE 0x10
165 #define C6DOFIMU10_INS1_MAG_DATA_NOT_AVAILABLE 0x00
166 #define C6DOFIMU10_INS1_MAG_DATA_AVAILABLE 0x08
167 #define C6DOFIMU10_INS1_FREE_FALL_HAS_ACTIVATED 0x00
168 #define C6DOFIMU10_INS1_NO_FREE_FALL 0x04
169 #define C6DOFIMU10_INS1_ACCEL_MOTION_HAS_ACTIVATED 0x00
170 #define C6DOFIMU10_INS1_NO_ACCEL_MOTION 0x02
171 #define C6DOFIMU10_INS1_MAG_MOTION_HAS_ACTIVATED 0x00
172 #define C6DOFIMU10_INS1_NO_MAG_MOTION 0x01
173 
179 #define C6DOFIMU10_INS2_ACCEL_NEGATIVE_X 0x20
180 #define C6DOFIMU10_INS2_ACCEL_POSITIVE_X 0x10
181 #define C6DOFIMU10_INS2_ACCEL_NEGATIVE_Y 0x08
182 #define C6DOFIMU10_INS2_ACCEL_POSITIVE_Y 0x04
183 #define C6DOFIMU10_INS2_ACCEL_NEGATIVE_Z 0x02
184 #define C6DOFIMU10_INS2_ACCEL_POSITIVE_Z 0x01
185 
191 #define C6DOFIMU10_INS3_MAG_NEGATIVE_X 0x20
192 #define C6DOFIMU10_INS3_MAG_POSITIVE_X 0x10
193 #define C6DOFIMU10_INS3_MAG_NEGATIVE_Y 0x08
194 #define C6DOFIMU10_INS3_MAG_POSITIVE_Y 0x04
195 #define C6DOFIMU10_INS3_MAG_NEGATIVE_Z 0x02
196 #define C6DOFIMU10_INS3_MAG_POSITIVE_Z 0x01
197 
203 #define C6DOFIMU10_INC1_GP1_BUFF_FULL_INT_DISABLE 0x00
204 #define C6DOFIMU10_INC1_GP1_BUFF_FULL_INT_ENABLE 0x40
205 #define C6DOFIMU10_INC1_GP1_WM_INT_DISABLE 0x00
206 #define C6DOFIMU10_INC1_GP1_WM_INT_ENABLE 0x20
207 #define C6DOFIMU10_INC1_GP1_ACCEL_DRDY_DISABLE 0x00
208 #define C6DOFIMU10_INC1_GP1_ACCEL_DRDY_ENABLE 0x10
209 #define C6DOFIMU10_INC1_GP1_MAG_DRDY_DISABLE 0x00
210 #define C6DOFIMU10_INC1_GP1_MAG_DRDY_ENABLE 0x08
211 #define C6DOFIMU10_INC1_GP1_FREE_FALL_INT_DISABLE 0x00
212 #define C6DOFIMU10_INC1_GP1_FREE_FALL_INT_ENABLE 0x04
213 #define C6DOFIMU10_INC1_GP1_ACCEL_MOTION_DISABLE 0x00
214 #define C6DOFIMU10_INC1_GP1_ACCEL_MOTION_ENABLE 0x02
215 #define C6DOFIMU10_INC1_GP1_MAG_MOTION_DISABLE 0x00
216 #define C6DOFIMU10_INC1_GP1_MAG_MOTION_ENABLE 0x01
217 
223 #define C6DOFIMU10_INC2_GP2_BUFF_FULL_INT_DISABLE 0x00
224 #define C6DOFIMU10_INC2_GP2_BUFF_FULL_INT_ENABLE 0x40
225 #define C6DOFIMU10_INC2_GP2_WM_INT_DISABLE 0x00
226 #define C6DOFIMU10_INC2_GP2_WM_INT_ENABLE 0x20
227 #define C6DOFIMU10_INC2_GP2_ACCEL_DRDY_DISABLE 0x00
228 #define C6DOFIMU10_INC2_GP2_ACCEL_DRDY_ENABLE 0x10
229 #define C6DOFIMU10_INC2_GP2_MAG_DRDY_DISABLE 0x00
230 #define C6DOFIMU10_INC2_GP2_MAG_DRDY_ENABLE 0x08
231 #define C6DOFIMU10_INC2_GP2_FREE_FALL_INT_DISABLE 0x00
232 #define C6DOFIMU10_INC2_GP2_FREE_FALL_INT_ENABLE 0x04
233 #define C6DOFIMU10_INC2_GP2_ACCEL_MOTION_DISABLE 0x00
234 #define C6DOFIMU10_INC2_GP2_ACCEL_MOTION_ENABLE 0x02
235 #define C6DOFIMU10_INC2_GP2_MAG_MOTION_DISABLE 0x00
236 #define C6DOFIMU10_INC2_GP2_MAG_MOTION_ENABLE 0x01
237 
243 #define C6DOFIMU10_INC3_IED2_PUSH_PULL 0x00
244 #define C6DOFIMU10_INC3_IED2_OPEN_DRAIN 0x80
245 #define C6DOFIMU10_INC3_IEA2_ACTIVE_LOW 0x00
246 #define C6DOFIMU10_INC3_IEA2_ACTIVE_HIGH 0x40
247 #define C6DOFIMU10_INC3_IEL2_LATCHED 0x00
248 #define C6DOFIMU10_INC3_IEL2_PULSED 0x10
249 #define C6DOFIMU10_INC3_IEL2_TRIGGER 0x20
250 #define C6DOFIMU10_INC3_IED1_PUSH_PULL 0x00
251 #define C6DOFIMU10_INC3_IED1_OPEN_DRAIN 0x08
252 #define C6DOFIMU10_INC3_IEA1_ACTIVE_LOW 0x00
253 #define C6DOFIMU10_INC3_IEA1_ACTIVE_HIGH 0x04
254 #define C6DOFIMU10_INC3_IEL1_LATCHED 0x00
255 #define C6DOFIMU10_INC3_IEL1_PULSED 0x01
256 #define C6DOFIMU10_INC3_IEL1_TRIGGER 0x02
257 
263 #define C6DOFIMU10_INC4_ACCEL_NEGATIVE_X_ENABLE 0x20
264 #define C6DOFIMU10_INC4_ACCEL_POSITIVE_X_ENABLE 0x10
265 #define C6DOFIMU10_INC4_ACCEL_NEGATIVE_Y_ENABLE 0x08
266 #define C6DOFIMU10_INC4_ACCEL_POSITIVE_Y_ENABLE 0x04
267 #define C6DOFIMU10_INC4_ACCEL_NEGATIVE_Z_ENABLE 0x02
268 #define C6DOFIMU10_INC4_ACCEL_POSITIVE_Z_ENABLE 0x01
269 #define C6DOFIMU10_INC4_ACCEL_NEGATIVE_X_DISABLE 0x00
270 #define C6DOFIMU10_INC4_ACCEL_POSITIVE_X_DISABLE 0x00
271 #define C6DOFIMU10_INC4_ACCEL_NEGATIVE_Y_DISABLE 0x00
272 #define C6DOFIMU10_INC4_ACCEL_POSITIVE_Y_DISABLE 0x00
273 #define C6DOFIMU10_INC4_ACCEL_NEGATIVE_Z_DISABLE 0x00
274 #define C6DOFIMU10_INC4_ACCEL_POSITIVE_Z_DISABLE 0x00
275 
281 #define C6DOFIMU10_INC4_MAG_NEGATIVE_X_ENABLE 0x20
282 #define C6DOFIMU10_INC4_MAG_POSITIVE_X_ENABLE 0x10
283 #define C6DOFIMU10_INC4_MAG_NEGATIVE_Y_ENABLE 0x08
284 #define C6DOFIMU10_INC4_MAG_POSITIVE_Y_ENABLE 0x04
285 #define C6DOFIMU10_INC4_MAG_NEGATIVE_Z_ENABLE 0x02
286 #define C6DOFIMU10_INC4_MAG_POSITIVE_Z_ENABLE 0x01
287 #define C6DOFIMU10_INC4_MAG_NEGATIVE_X_DISABLE 0x00
288 #define C6DOFIMU10_INC4_MAG_POSITIVE_X_DISABLE 0x00
289 #define C6DOFIMU10_INC4_MAG_NEGATIVE_Y_DISABLE 0x00
290 #define C6DOFIMU10_INC4_MAG_POSITIVE_Y_DISABLE 0x00
291 #define C6DOFIMU10_INC4_MAG_NEGATIVE_Z_DISABLE 0x00
292 #define C6DOFIMU10_INC4_MAG_POSITIVE_Z_DISABLE 0x00
293 
299 #define C6DOFIMU10_AMICNTL3_ACCEL_MOTION_DISABLE 0x00
300 #define C6DOFIMU10_AMICNTL3_ACCEL_MOTION_ENABLE 0x80
301 #define C6DOFIMU10_AMICNTL3_ACCEL_MOTION_LATCHED 0x00
302 #define C6DOFIMU10_AMICNTL3_ACCEL_MOTION_UNLATCHED 0x40
303 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_0p781 0x00
304 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_1p563 0x01
305 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_3p125 0x02
306 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_6p25 0x03
307 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_12p5 0x04
308 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_25 0x05
309 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_50 0x06
310 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_100 0x07
311 
317 #define C6DOFIMU10_MMICNTL3_MAG_MOTION_DISABLE 0x00
318 #define C6DOFIMU10_MMICNTL3_MAG_MOTION_ENABLE 0x80
319 #define C6DOFIMU10_MMICNTL3_MAG_MOTION_LATCHED 0x00
320 #define C6DOFIMU10_MMICNTL3_MAG_MOTION_UNLATCHED 0x40
321 #define C6DOFIMU10_MMICNTL3_MAG_ODR_0p781 0x00
322 #define C6DOFIMU10_MMICNTL3_MAG_ODR_1p563 0x01
323 #define C6DOFIMU10_MMICNTL3_MAG_ODR_3p125 0x02
324 #define C6DOFIMU10_MMICNTL3_MAG_ODR_6p25 0x03
325 #define C6DOFIMU10_MMICNTL3_MAG_ODR_12p5 0x04
326 #define C6DOFIMU10_MMICNTL3_MAG_ODR_25 0x05
327 #define C6DOFIMU10_MMICNTL3_MAG_ODR_50 0x06
328 #define C6DOFIMU10_MMICNTL3_MAG_ODR_100 0x07
329 
335 #define C6DOFIMU10_FFICNTL3_FREE_FALL_DISABLE 0x00
336 #define C6DOFIMU10_FFICNTL3_FREE_FALL_ENABLE 0x80
337 #define C6DOFIMU10_FFICNTL3_FREE_FALL_LATCHED 0x00
338 #define C6DOFIMU10_FFICNTL3_FREE_FALL_UNLATCHED 0x40
339 #define C6DOFIMU10_FFICNTL3_FFI_DEBOUNCE_CNT_UP_DOWN 0x00
340 #define C6DOFIMU10_FFICNTL3_FFI_DEBOUNCE_CNT_UP_RESET 0x08
341 #define C6DOFIMU10_FFICNTL3_ODR_12p5 0x00
342 #define C6DOFIMU10_FFICNTL3_ODR_25 0x01
343 #define C6DOFIMU10_FFICNTL3_ODR_50 0x02
344 #define C6DOFIMU10_FFICNTL3_ODR_100 0x03
345 #define C6DOFIMU10_FFICNTL3_ODR_200 0x04
346 #define C6DOFIMU10_FFICNTL3_ODR_400 0x05
347 #define C6DOFIMU10_FFICNTL3_ODR_800 0x06
348 #define C6DOFIMU10_FFICNTL3_ODR_1600 0x07
349 
355 #define C6DOFIMU10_ODCNTL_MAG_ODR_12p5 0x00
356 #define C6DOFIMU10_ODCNTL_MAG_ODR_15 0x10
357 #define C6DOFIMU10_ODCNTL_MAG_ODR_50 0x20
358 #define C6DOFIMU10_ODCNTL_MAG_ODR_100 0x30
359 #define C6DOFIMU10_ODCNTL_MAG_ODR_200 0x40
360 #define C6DOFIMU10_ODCNTL_MAG_ODR_400 0x50
361 #define C6DOFIMU10_ODCNTL_MAG_ODR_800 0x60
362 #define C6DOFIMU10_ODCNTL_MAG_ODR_1600 0x70
363 #define C6DOFIMU10_ODCNTL_MAG_ODR_0p781 0x80
364 #define C6DOFIMU10_ODCNTL_MAG_ODR_1p563 0x90
365 #define C6DOFIMU10_ODCNTL_MAG_ODR_3p125 0xA0
366 #define C6DOFIMU10_ODCNTL_MAG_ODR_6p25 0xB0
367 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_12p5 0x00
368 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_15 0x01
369 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_50 0x02
370 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_100 0x03
371 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_200 0x04
372 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_400 0x05
373 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_800 0x06
374 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_1600 0x07
375 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_0p781 0x08
376 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_1p563 0x09
377 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_3p125 0x0A
378 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_6p25 0x0B
379 
385 #define C6DOFIMU10_CNTL1_SW_RESET_NO_ACTION 0x00
386 #define C6DOFIMU10_CNTL1_SW_RESET_START_REBOOT 0x80
387 #define C6DOFIMU10_CNTL1_ST_MODE_DISABLE 0x00
388 #define C6DOFIMU10_CNTL1_ST_MODE_ENABLE 0x40
389 #define C6DOFIMU10_CNTL1_ST_POLARITY_POSITIVE 0x00
390 #define C6DOFIMU10_CNTL1_ST_POLARITY_NEGATIVE 0x20
391 #define C6DOFIMU10_CNTL1_COTC_NO_ACTION 0x00
392 #define C6DOFIMU10_CNTL1_COTC_SETS_COTR 0x08
393 
399 #define C6DOFIMU10_CNTL2_TEMP_STANDBY_MODE 0x00
400 #define C6DOFIMU10_CNTL2_TEMP_OPERATING_MODE 0x40
401 #define C6DOFIMU10_CNTL2_ACCEL_RANGE_2g 0x00
402 #define C6DOFIMU10_CNTL2_ACCEL_RANGE_4g 0x10
403 #define C6DOFIMU10_CNTL2_ACCEL_RANGE_8g 0x20
404 #define C6DOFIMU10_CNTL2_ACCEL_RANGE_16g 0x30
405 #define C6DOFIMU10_CNTL2_RES_SAMBLE_A4_M2 0x00
406 #define C6DOFIMU10_CNTL2_RES_SAMBLE_A32_M16 0x04
407 #define C6DOFIMU10_CNTL2_RES_SAMBLE_MAX_MAX 0x08
408 #define C6DOFIMU10_CNTL2_MAG_STANDBY_MODE 0x00
409 #define C6DOFIMU10_CNTL2_MAG_OPERATING_MODE 0x02
410 #define C6DOFIMU10_CNTL2_ACCEL_STANDBY_MODE 0x00
411 #define C6DOFIMU10_CNTL2_ACCEL_OPERATING_MODE 0x01
412 
418 #define C6DOFIMU10_DEVICE_OK 0
419 #define C6DOFIMU10_DEVICE_ERROR 1
420 
426 #define C6DOFIMU10_TEMP_FORMAT_FARENHAJT 2
427 #define C6DOFIMU10_TEMP_FORMAT_KELVIN 1
428 #define C6DOFIMU10_TEMP_FORMAT_CELSIUS 0
429 
435 #define C6DOFIMU10_GP1_INT_PIN 0
436 #define C6DOFIMU10_GP2_INT_PIN 1
437  // End group macro
440 // --------------------------------------------------------------- PUBLIC TYPES
453 typedef struct
454 {
455  int16_t x;
456  int16_t y;
457  int16_t z;
458 
460 
471 typedef struct
472 {
473  uint8_t neg_x;
474  uint8_t pos_x;
475  uint8_t neg_y;
476  uint8_t pos_y;
477  uint8_t neg_z;
478  uint8_t pos_z;
479 
481 
485 typedef struct
486 {
487  // Output pins
488 
489  digital_out_t gp2;
490 
491  // Input pins
492 
493  digital_in_t gp1;
494 
495  // Modules
496 
497  i2c_master_t i2c;
498 
499  // ctx variable
500 
501  uint8_t slave_address;
502 
505 
506 } c6dofimu10_t;
507 
511 typedef struct
512 {
513  // Communication gpio pins
514 
515  pin_name_t scl;
516  pin_name_t sda;
517 
518  // Additional gpio pins
519 
520  pin_name_t gp2;
521  pin_name_t gp1;
522 
523  // static variable
524 
525  uint32_t i2c_speed;
526  uint8_t i2c_address;
527 
528  uint8_t op_temp;
529  uint8_t op_accel;
530  uint8_t op_mag;
531  uint8_t accel_range;
532  uint8_t res_sample;
533 
535  // End types group
537 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
538 
544 #ifdef __cplusplus
545 extern "C"{
546 #endif
547 
557 
566 
575 
586 void c6dofimu10_generic_write ( c6dofimu10_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
587 
598 void c6dofimu10_generic_read ( c6dofimu10_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
599 
609 
626 
643 
659 float c6dofimu10_get_temperature ( c6dofimu10_t *ctx, uint8_t temp_format );
660 
675 
691 void c6dofimu10_get_motion ( c6dofimu10_t *ctx, uint8_t sensor_reg, c6dofimu10_motion_t *motion_obj );
692 
707 uint8_t c6dofimu10_get_interrupt ( c6dofimu10_t *ctx, uint8_t int_pin );
708 
709 #ifdef __cplusplus
710 }
711 #endif
712 #endif // _c6DOFIMU10_H_
713  // End public_function group
716 
717 // ------------------------------------------------------------------------- END
c6dofimu10_motion_t::pos_x
uint8_t pos_x
Definition: c6dofimu10.h:474
c6dofimu10_t::gp2
digital_out_t gp2
Definition: c6dofimu10.h:489
c6dofimu10_get_mag_axis
void c6dofimu10_get_mag_axis(c6dofimu10_t *ctx, c6dofimu10_axis_t *axis)
Magnetometer axis data.
c6dofimu10_cfg_t::op_accel
uint8_t op_accel
Definition: c6dofimu10.h:529
c6dofimu10_cfg_t::scl
pin_name_t scl
Definition: c6dofimu10.h:515
c6dofimu10_motion_t::pos_y
uint8_t pos_y
Definition: c6dofimu10.h:476
c6dofimu10_axis_t::z
int16_t z
Definition: c6dofimu10.h:457
c6dofimu10_t::gp1
digital_in_t gp1
Definition: c6dofimu10.h:493
c6dofimu10_cfg_setup
void c6dofimu10_cfg_setup(c6dofimu10_cfg_t *cfg)
Config Object Initialization function.
c6dofimu10_get_temperature
float c6dofimu10_get_temperature(c6dofimu10_t *ctx, uint8_t temp_format)
Temperature data.
c6dofimu10_get_interrupt
uint8_t c6dofimu10_get_interrupt(c6dofimu10_t *ctx, uint8_t int_pin)
Get interrupt pin status.
c6dofimu10_cfg_t::gp1
pin_name_t gp1
Definition: c6dofimu10.h:521
c6dofimu10_cfg_t::i2c_speed
uint32_t i2c_speed
Definition: c6dofimu10.h:525
c6dofimu10_cfg_t
Click configuration structure definition.
Definition: c6dofimu10.h:512
c6dofimu10_axis_t
Axis structure.
Definition: c6dofimu10.h:454
c6dofimu10_init
c6DOFIMU10_RETVAL c6dofimu10_init(c6dofimu10_t *ctx, c6dofimu10_cfg_t *cfg)
Initialization function.
c6dofimu10_measurement_cfg
void c6dofimu10_measurement_cfg(c6dofimu10_t *ctx, c6dofimu10_cfg_t *cfg)
Measurement config.
c6dofimu10_cfg_t::gp2
pin_name_t gp2
Definition: c6dofimu10.h:520
c6dofimu10_t::motion
c6dofimu10_motion_t motion
Definition: c6dofimu10.h:504
c6dofimu10_communication_test
uint8_t c6dofimu10_communication_test(c6dofimu10_t *ctx)
Communication test.
c6dofimu10_generic_write
void c6dofimu10_generic_write(c6dofimu10_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
c6dofimu10_get_accel_axis
void c6dofimu10_get_accel_axis(c6dofimu10_t *ctx, c6dofimu10_axis_t *axis)
Accelerometer axis data.
c6dofimu10_motion_t::neg_y
uint8_t neg_y
Definition: c6dofimu10.h:475
c6dofimu10_motion_t
Motion interrupt structure.
Definition: c6dofimu10.h:472
c6dofimu10_get_motion
void c6dofimu10_get_motion(c6dofimu10_t *ctx, uint8_t sensor_reg, c6dofimu10_motion_t *motion_obj)
Get motion interrupt status.
c6dofimu10_t::axis
c6dofimu10_axis_t axis
Definition: c6dofimu10.h:503
c6dofimu10_cfg_t::res_sample
uint8_t res_sample
Definition: c6dofimu10.h:532
c6dofimu10_axis_t::x
int16_t x
Definition: c6dofimu10.h:455
c6DOFIMU10_RETVAL
#define c6DOFIMU10_RETVAL
Definition: c6dofimu10.h:74
c6dofimu10_axis_t::y
int16_t y
Definition: c6dofimu10.h:456
c6dofimu10_motion_t::neg_x
uint8_t neg_x
Definition: c6dofimu10.h:473
c6dofimu10_default_cfg
void c6dofimu10_default_cfg(c6dofimu10_t *ctx)
Click Default Configuration function.
c6dofimu10_cfg_t::accel_range
uint8_t accel_range
Definition: c6dofimu10.h:531
c6dofimu10_motion_t::pos_z
uint8_t pos_z
Definition: c6dofimu10.h:478
c6dofimu10_motion_t::neg_z
uint8_t neg_z
Definition: c6dofimu10.h:477
c6dofimu10_t::i2c
i2c_master_t i2c
Definition: c6dofimu10.h:497
c6dofimu10_cfg_t::op_temp
uint8_t op_temp
Definition: c6dofimu10.h:528
c6dofimu10_cfg_t::sda
pin_name_t sda
Definition: c6dofimu10.h:516
c6dofimu10_t::slave_address
uint8_t slave_address
Definition: c6dofimu10.h:501
c6dofimu10_t
Click ctx object definition.
Definition: c6dofimu10.h:486
c6dofimu10_cfg_t::i2c_address
uint8_t i2c_address
Definition: c6dofimu10.h:526
c6dofimu10_generic_read
void c6dofimu10_generic_read(c6dofimu10_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
c6dofimu10_cfg_t::op_mag
uint8_t op_mag
Definition: c6dofimu10.h:530