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 
42 #ifdef PREINIT_SUPPORTED
43 #include "preinit.h"
44 #endif
45 
46 #ifdef MikroCCoreVersion
47  #if MikroCCoreVersion >= 1
48  #include "delays.h"
49  #endif
50 #endif
51 
52 #include "drv_digital_out.h"
53 #include "drv_digital_in.h"
54 #include "drv_i2c_master.h"
55 
56 
57 // -------------------------------------------------------------- PUBLIC MACROS
67 #define c6DOFIMU10_MAP_MIKROBUS( cfg, mikrobus ) \
68  cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
69  cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
70  cfg.gp2 = MIKROBUS( mikrobus, MIKROBUS_RST ); \
71  cfg.gp1 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
72 
78 #define c6DOFIMU10_RETVAL uint8_t
79 
80 #define c6DOFIMU10_OK 0x00
81 #define c6DOFIMU10_INIT_ERROR 0xFF
82 
88 #define C6DOFIMU10_SLAVE_ADDRESS_GND 0x0E
89 #define C6DOFIMU10_SLAVE_ADDRESS_VCC 0x0F
90 
96 #define C6DOFIMU10_REG_WHO_AM_I 0x00
97 #define C6DOFIMU10_REG_INS_1 0x01
98 #define C6DOFIMU10_REG_INS_2 0x02
99 #define C6DOFIMU10_REG_INS_3 0x03
100 #define C6DOFIMU10_REG_INL 0x05
101 #define C6DOFIMU10_REG_ACCEL_XOUT_L 0x0A
102 #define C6DOFIMU10_REG_ACCEL_XOUT 0x0A
103 #define C6DOFIMU10_REG_ACCEL_XOUT_H 0x0B
104 #define C6DOFIMU10_REG_ACCEL_YOUT_L 0x0C
105 #define C6DOFIMU10_REG_ACCEL_YOUT 0x0C
106 #define C6DOFIMU10_REG_ACCEL_YOUT_H 0x0D
107 #define C6DOFIMU10_REG_ACCEL_ZOUT_L 0x0E
108 #define C6DOFIMU10_REG_ACCEL_ZOUT 0x0E
109 #define C6DOFIMU10_REG_ACCEL_ZOUT_H 0x0F
110 #define C6DOFIMU10_REG_MAG_XOUT_L 0x10
111 #define C6DOFIMU10_REG_MAG_XOUT 0x10
112 #define C6DOFIMU10_REG_MAG_XOUT_H 0x11
113 #define C6DOFIMU10_REG_MAG_YOUT_L 0x12
114 #define C6DOFIMU10_REG_MAG_YOUT 0x12
115 #define C6DOFIMU10_REG_MAG_YOUT_H 0x13
116 #define C6DOFIMU10_REG_MAG_ZOUT_L 0x14
117 #define C6DOFIMU10_REG_MAG_ZOUT 0x14
118 #define C6DOFIMU10_REG_MAG_ZOUT_H 0x15
119 #define C6DOFIMU10_REG_TEMP_OUT_L 0x16
120 #define C6DOFIMU10_REG_TEMP_OUT 0x16
121 #define C6DOFIMU10_REG_TEMP_OUT_H 0x17
122 #define C6DOFIMU10_REG_INC_1 0x2A
123 #define C6DOFIMU10_REG_INC_2 0x2B
124 #define C6DOFIMU10_REG_INC_3 0x2C
125 #define C6DOFIMU10_REG_INC_4 0x2D
126 #define C6DOFIMU10_REG_INC_5 0x2E
127 #define C6DOFIMU10_REG_AMI_CNTL_1 0x2F
128 #define C6DOFIMU10_REG_AMI_CNTL_2 0x30
129 #define C6DOFIMU10_REG_AMI_CNTL_3 0x31
130 #define C6DOFIMU10_REG_MMI_CNTL_1 0x32
131 #define C6DOFIMU10_REG_MMI_CNTL_2 0x33
132 #define C6DOFIMU10_REG_MMI_CNTL_3 0x34
133 #define C6DOFIMU10_REG_FFI_CNTL_1 0x35
134 #define C6DOFIMU10_REG_FFI_CNTL_2 0x36
135 #define C6DOFIMU10_REG_FFI_CNTL_3 0x37
136 #define C6DOFIMU10_REG_ODCNTL 0x38
137 #define C6DOFIMU10_REG_CNTL_1 0x39
138 #define C6DOFIMU10_REG_CNTL_2 0x3A
139 #define C6DOFIMU10_REG_COTR 0x3C
140 #define C6DOFIMU10_REG_BUF_CTRL_1 0x77
141 #define C6DOFIMU10_REG_BUF_CTRL_2 0x78
142 #define C6DOFIMU10_REG_BUF_CTRL_3 0x79
143 #define C6DOFIMU10_REG_BUF_CLEAR 0x7A
144 #define C6DOFIMU10_REG_BUF_STATUS_1 0x7B
145 #define C6DOFIMU10_REG_BUF_STATUS_2 0x7C
146 #define C6DOFIMU10_REG_BUF_STATUS_3 0x7D
147 #define C6DOFIMU10_REG_BUF_READ 0x7E
148 
154 #define C6DOFIMU10_DEF_WHO_AM_I 0x18
155 
161 #define C6DOFIMU10_INS1_NO_INTERRUPT_EVENT 0x00
162 #define C6DOFIMU10_INS1_INTERRUPT_EVENT 0x80
163 #define C6DOFIMU10_INS1_BUFFER_IS_NOT_FULL 0x00
164 #define C6DOFIMU10_INS1_BUFFER_IS_FULL 0x40
165 #define C6DOFIMU10_INS1_BUFFER_WM_NOT_REACHED 0x00
166 #define C6DOFIMU10_INS1_BUFFER_WM_REACHED 0x20
167 #define C6DOFIMU10_INS1_ACCEL_DATA_NOT_AVAILABLE 0x00
168 #define C6DOFIMU10_INS1_ACCEL_DATA_AVAILABLE 0x10
169 #define C6DOFIMU10_INS1_MAG_DATA_NOT_AVAILABLE 0x00
170 #define C6DOFIMU10_INS1_MAG_DATA_AVAILABLE 0x08
171 #define C6DOFIMU10_INS1_FREE_FALL_HAS_ACTIVATED 0x00
172 #define C6DOFIMU10_INS1_NO_FREE_FALL 0x04
173 #define C6DOFIMU10_INS1_ACCEL_MOTION_HAS_ACTIVATED 0x00
174 #define C6DOFIMU10_INS1_NO_ACCEL_MOTION 0x02
175 #define C6DOFIMU10_INS1_MAG_MOTION_HAS_ACTIVATED 0x00
176 #define C6DOFIMU10_INS1_NO_MAG_MOTION 0x01
177 
183 #define C6DOFIMU10_INS2_ACCEL_NEGATIVE_X 0x20
184 #define C6DOFIMU10_INS2_ACCEL_POSITIVE_X 0x10
185 #define C6DOFIMU10_INS2_ACCEL_NEGATIVE_Y 0x08
186 #define C6DOFIMU10_INS2_ACCEL_POSITIVE_Y 0x04
187 #define C6DOFIMU10_INS2_ACCEL_NEGATIVE_Z 0x02
188 #define C6DOFIMU10_INS2_ACCEL_POSITIVE_Z 0x01
189 
195 #define C6DOFIMU10_INS3_MAG_NEGATIVE_X 0x20
196 #define C6DOFIMU10_INS3_MAG_POSITIVE_X 0x10
197 #define C6DOFIMU10_INS3_MAG_NEGATIVE_Y 0x08
198 #define C6DOFIMU10_INS3_MAG_POSITIVE_Y 0x04
199 #define C6DOFIMU10_INS3_MAG_NEGATIVE_Z 0x02
200 #define C6DOFIMU10_INS3_MAG_POSITIVE_Z 0x01
201 
207 #define C6DOFIMU10_INC1_GP1_BUFF_FULL_INT_DISABLE 0x00
208 #define C6DOFIMU10_INC1_GP1_BUFF_FULL_INT_ENABLE 0x40
209 #define C6DOFIMU10_INC1_GP1_WM_INT_DISABLE 0x00
210 #define C6DOFIMU10_INC1_GP1_WM_INT_ENABLE 0x20
211 #define C6DOFIMU10_INC1_GP1_ACCEL_DRDY_DISABLE 0x00
212 #define C6DOFIMU10_INC1_GP1_ACCEL_DRDY_ENABLE 0x10
213 #define C6DOFIMU10_INC1_GP1_MAG_DRDY_DISABLE 0x00
214 #define C6DOFIMU10_INC1_GP1_MAG_DRDY_ENABLE 0x08
215 #define C6DOFIMU10_INC1_GP1_FREE_FALL_INT_DISABLE 0x00
216 #define C6DOFIMU10_INC1_GP1_FREE_FALL_INT_ENABLE 0x04
217 #define C6DOFIMU10_INC1_GP1_ACCEL_MOTION_DISABLE 0x00
218 #define C6DOFIMU10_INC1_GP1_ACCEL_MOTION_ENABLE 0x02
219 #define C6DOFIMU10_INC1_GP1_MAG_MOTION_DISABLE 0x00
220 #define C6DOFIMU10_INC1_GP1_MAG_MOTION_ENABLE 0x01
221 
227 #define C6DOFIMU10_INC2_GP2_BUFF_FULL_INT_DISABLE 0x00
228 #define C6DOFIMU10_INC2_GP2_BUFF_FULL_INT_ENABLE 0x40
229 #define C6DOFIMU10_INC2_GP2_WM_INT_DISABLE 0x00
230 #define C6DOFIMU10_INC2_GP2_WM_INT_ENABLE 0x20
231 #define C6DOFIMU10_INC2_GP2_ACCEL_DRDY_DISABLE 0x00
232 #define C6DOFIMU10_INC2_GP2_ACCEL_DRDY_ENABLE 0x10
233 #define C6DOFIMU10_INC2_GP2_MAG_DRDY_DISABLE 0x00
234 #define C6DOFIMU10_INC2_GP2_MAG_DRDY_ENABLE 0x08
235 #define C6DOFIMU10_INC2_GP2_FREE_FALL_INT_DISABLE 0x00
236 #define C6DOFIMU10_INC2_GP2_FREE_FALL_INT_ENABLE 0x04
237 #define C6DOFIMU10_INC2_GP2_ACCEL_MOTION_DISABLE 0x00
238 #define C6DOFIMU10_INC2_GP2_ACCEL_MOTION_ENABLE 0x02
239 #define C6DOFIMU10_INC2_GP2_MAG_MOTION_DISABLE 0x00
240 #define C6DOFIMU10_INC2_GP2_MAG_MOTION_ENABLE 0x01
241 
247 #define C6DOFIMU10_INC3_IED2_PUSH_PULL 0x00
248 #define C6DOFIMU10_INC3_IED2_OPEN_DRAIN 0x80
249 #define C6DOFIMU10_INC3_IEA2_ACTIVE_LOW 0x00
250 #define C6DOFIMU10_INC3_IEA2_ACTIVE_HIGH 0x40
251 #define C6DOFIMU10_INC3_IEL2_LATCHED 0x00
252 #define C6DOFIMU10_INC3_IEL2_PULSED 0x10
253 #define C6DOFIMU10_INC3_IEL2_TRIGGER 0x20
254 #define C6DOFIMU10_INC3_IED1_PUSH_PULL 0x00
255 #define C6DOFIMU10_INC3_IED1_OPEN_DRAIN 0x08
256 #define C6DOFIMU10_INC3_IEA1_ACTIVE_LOW 0x00
257 #define C6DOFIMU10_INC3_IEA1_ACTIVE_HIGH 0x04
258 #define C6DOFIMU10_INC3_IEL1_LATCHED 0x00
259 #define C6DOFIMU10_INC3_IEL1_PULSED 0x01
260 #define C6DOFIMU10_INC3_IEL1_TRIGGER 0x02
261 
267 #define C6DOFIMU10_INC4_ACCEL_NEGATIVE_X_ENABLE 0x20
268 #define C6DOFIMU10_INC4_ACCEL_POSITIVE_X_ENABLE 0x10
269 #define C6DOFIMU10_INC4_ACCEL_NEGATIVE_Y_ENABLE 0x08
270 #define C6DOFIMU10_INC4_ACCEL_POSITIVE_Y_ENABLE 0x04
271 #define C6DOFIMU10_INC4_ACCEL_NEGATIVE_Z_ENABLE 0x02
272 #define C6DOFIMU10_INC4_ACCEL_POSITIVE_Z_ENABLE 0x01
273 #define C6DOFIMU10_INC4_ACCEL_NEGATIVE_X_DISABLE 0x00
274 #define C6DOFIMU10_INC4_ACCEL_POSITIVE_X_DISABLE 0x00
275 #define C6DOFIMU10_INC4_ACCEL_NEGATIVE_Y_DISABLE 0x00
276 #define C6DOFIMU10_INC4_ACCEL_POSITIVE_Y_DISABLE 0x00
277 #define C6DOFIMU10_INC4_ACCEL_NEGATIVE_Z_DISABLE 0x00
278 #define C6DOFIMU10_INC4_ACCEL_POSITIVE_Z_DISABLE 0x00
279 
285 #define C6DOFIMU10_INC4_MAG_NEGATIVE_X_ENABLE 0x20
286 #define C6DOFIMU10_INC4_MAG_POSITIVE_X_ENABLE 0x10
287 #define C6DOFIMU10_INC4_MAG_NEGATIVE_Y_ENABLE 0x08
288 #define C6DOFIMU10_INC4_MAG_POSITIVE_Y_ENABLE 0x04
289 #define C6DOFIMU10_INC4_MAG_NEGATIVE_Z_ENABLE 0x02
290 #define C6DOFIMU10_INC4_MAG_POSITIVE_Z_ENABLE 0x01
291 #define C6DOFIMU10_INC4_MAG_NEGATIVE_X_DISABLE 0x00
292 #define C6DOFIMU10_INC4_MAG_POSITIVE_X_DISABLE 0x00
293 #define C6DOFIMU10_INC4_MAG_NEGATIVE_Y_DISABLE 0x00
294 #define C6DOFIMU10_INC4_MAG_POSITIVE_Y_DISABLE 0x00
295 #define C6DOFIMU10_INC4_MAG_NEGATIVE_Z_DISABLE 0x00
296 #define C6DOFIMU10_INC4_MAG_POSITIVE_Z_DISABLE 0x00
297 
303 #define C6DOFIMU10_AMICNTL3_ACCEL_MOTION_DISABLE 0x00
304 #define C6DOFIMU10_AMICNTL3_ACCEL_MOTION_ENABLE 0x80
305 #define C6DOFIMU10_AMICNTL3_ACCEL_MOTION_LATCHED 0x00
306 #define C6DOFIMU10_AMICNTL3_ACCEL_MOTION_UNLATCHED 0x40
307 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_0p781 0x00
308 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_1p563 0x01
309 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_3p125 0x02
310 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_6p25 0x03
311 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_12p5 0x04
312 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_25 0x05
313 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_50 0x06
314 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_100 0x07
315 
321 #define C6DOFIMU10_MMICNTL3_MAG_MOTION_DISABLE 0x00
322 #define C6DOFIMU10_MMICNTL3_MAG_MOTION_ENABLE 0x80
323 #define C6DOFIMU10_MMICNTL3_MAG_MOTION_LATCHED 0x00
324 #define C6DOFIMU10_MMICNTL3_MAG_MOTION_UNLATCHED 0x40
325 #define C6DOFIMU10_MMICNTL3_MAG_ODR_0p781 0x00
326 #define C6DOFIMU10_MMICNTL3_MAG_ODR_1p563 0x01
327 #define C6DOFIMU10_MMICNTL3_MAG_ODR_3p125 0x02
328 #define C6DOFIMU10_MMICNTL3_MAG_ODR_6p25 0x03
329 #define C6DOFIMU10_MMICNTL3_MAG_ODR_12p5 0x04
330 #define C6DOFIMU10_MMICNTL3_MAG_ODR_25 0x05
331 #define C6DOFIMU10_MMICNTL3_MAG_ODR_50 0x06
332 #define C6DOFIMU10_MMICNTL3_MAG_ODR_100 0x07
333 
339 #define C6DOFIMU10_FFICNTL3_FREE_FALL_DISABLE 0x00
340 #define C6DOFIMU10_FFICNTL3_FREE_FALL_ENABLE 0x80
341 #define C6DOFIMU10_FFICNTL3_FREE_FALL_LATCHED 0x00
342 #define C6DOFIMU10_FFICNTL3_FREE_FALL_UNLATCHED 0x40
343 #define C6DOFIMU10_FFICNTL3_FFI_DEBOUNCE_CNT_UP_DOWN 0x00
344 #define C6DOFIMU10_FFICNTL3_FFI_DEBOUNCE_CNT_UP_RESET 0x08
345 #define C6DOFIMU10_FFICNTL3_ODR_12p5 0x00
346 #define C6DOFIMU10_FFICNTL3_ODR_25 0x01
347 #define C6DOFIMU10_FFICNTL3_ODR_50 0x02
348 #define C6DOFIMU10_FFICNTL3_ODR_100 0x03
349 #define C6DOFIMU10_FFICNTL3_ODR_200 0x04
350 #define C6DOFIMU10_FFICNTL3_ODR_400 0x05
351 #define C6DOFIMU10_FFICNTL3_ODR_800 0x06
352 #define C6DOFIMU10_FFICNTL3_ODR_1600 0x07
353 
359 #define C6DOFIMU10_ODCNTL_MAG_ODR_12p5 0x00
360 #define C6DOFIMU10_ODCNTL_MAG_ODR_15 0x10
361 #define C6DOFIMU10_ODCNTL_MAG_ODR_50 0x20
362 #define C6DOFIMU10_ODCNTL_MAG_ODR_100 0x30
363 #define C6DOFIMU10_ODCNTL_MAG_ODR_200 0x40
364 #define C6DOFIMU10_ODCNTL_MAG_ODR_400 0x50
365 #define C6DOFIMU10_ODCNTL_MAG_ODR_800 0x60
366 #define C6DOFIMU10_ODCNTL_MAG_ODR_1600 0x70
367 #define C6DOFIMU10_ODCNTL_MAG_ODR_0p781 0x80
368 #define C6DOFIMU10_ODCNTL_MAG_ODR_1p563 0x90
369 #define C6DOFIMU10_ODCNTL_MAG_ODR_3p125 0xA0
370 #define C6DOFIMU10_ODCNTL_MAG_ODR_6p25 0xB0
371 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_12p5 0x00
372 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_15 0x01
373 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_50 0x02
374 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_100 0x03
375 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_200 0x04
376 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_400 0x05
377 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_800 0x06
378 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_1600 0x07
379 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_0p781 0x08
380 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_1p563 0x09
381 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_3p125 0x0A
382 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_6p25 0x0B
383 
389 #define C6DOFIMU10_CNTL1_SW_RESET_NO_ACTION 0x00
390 #define C6DOFIMU10_CNTL1_SW_RESET_START_REBOOT 0x80
391 #define C6DOFIMU10_CNTL1_ST_MODE_DISABLE 0x00
392 #define C6DOFIMU10_CNTL1_ST_MODE_ENABLE 0x40
393 #define C6DOFIMU10_CNTL1_ST_POLARITY_POSITIVE 0x00
394 #define C6DOFIMU10_CNTL1_ST_POLARITY_NEGATIVE 0x20
395 #define C6DOFIMU10_CNTL1_COTC_NO_ACTION 0x00
396 #define C6DOFIMU10_CNTL1_COTC_SETS_COTR 0x08
397 
403 #define C6DOFIMU10_CNTL2_TEMP_STANDBY_MODE 0x00
404 #define C6DOFIMU10_CNTL2_TEMP_OPERATING_MODE 0x40
405 #define C6DOFIMU10_CNTL2_ACCEL_RANGE_2g 0x00
406 #define C6DOFIMU10_CNTL2_ACCEL_RANGE_4g 0x10
407 #define C6DOFIMU10_CNTL2_ACCEL_RANGE_8g 0x20
408 #define C6DOFIMU10_CNTL2_ACCEL_RANGE_16g 0x30
409 #define C6DOFIMU10_CNTL2_RES_SAMBLE_A4_M2 0x00
410 #define C6DOFIMU10_CNTL2_RES_SAMBLE_A32_M16 0x04
411 #define C6DOFIMU10_CNTL2_RES_SAMBLE_MAX_MAX 0x08
412 #define C6DOFIMU10_CNTL2_MAG_STANDBY_MODE 0x00
413 #define C6DOFIMU10_CNTL2_MAG_OPERATING_MODE 0x02
414 #define C6DOFIMU10_CNTL2_ACCEL_STANDBY_MODE 0x00
415 #define C6DOFIMU10_CNTL2_ACCEL_OPERATING_MODE 0x01
416 
422 #define C6DOFIMU10_DEVICE_OK 0
423 #define C6DOFIMU10_DEVICE_ERROR 1
424 
430 #define C6DOFIMU10_TEMP_FORMAT_FARENHAJT 2
431 #define C6DOFIMU10_TEMP_FORMAT_KELVIN 1
432 #define C6DOFIMU10_TEMP_FORMAT_CELSIUS 0
433 
439 #define C6DOFIMU10_GP1_INT_PIN 0
440 #define C6DOFIMU10_GP2_INT_PIN 1
441  // End group macro
444 // --------------------------------------------------------------- PUBLIC TYPES
457 typedef struct
458 {
459  int16_t x;
460  int16_t y;
461  int16_t z;
462 
464 
475 typedef struct
476 {
477  uint8_t neg_x;
478  uint8_t pos_x;
479  uint8_t neg_y;
480  uint8_t pos_y;
481  uint8_t neg_z;
482  uint8_t pos_z;
483 
485 
489 typedef struct
490 {
491  // Output pins
492 
493  digital_out_t gp2;
494 
495  // Input pins
496 
497  digital_in_t gp1;
498 
499  // Modules
500 
501  i2c_master_t i2c;
502 
503  // ctx variable
504 
505  uint8_t slave_address;
506 
509 
510 } c6dofimu10_t;
511 
515 typedef struct
516 {
517  // Communication gpio pins
518 
519  pin_name_t scl;
520  pin_name_t sda;
521 
522  // Additional gpio pins
523 
524  pin_name_t gp2;
525  pin_name_t gp1;
526 
527  // static variable
528 
529  uint32_t i2c_speed;
530  uint8_t i2c_address;
531 
532  uint8_t op_temp;
533  uint8_t op_accel;
534  uint8_t op_mag;
535  uint8_t accel_range;
536  uint8_t res_sample;
537 
539  // End types group
541 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
542 
548 #ifdef __cplusplus
549 extern "C"{
550 #endif
551 
561 
570 
579 
590 void c6dofimu10_generic_write ( c6dofimu10_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
591 
602 void c6dofimu10_generic_read ( c6dofimu10_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
603 
613 
630 
647 
663 float c6dofimu10_get_temperature ( c6dofimu10_t *ctx, uint8_t temp_format );
664 
679 
695 void c6dofimu10_get_motion ( c6dofimu10_t *ctx, uint8_t sensor_reg, c6dofimu10_motion_t *motion_obj );
696 
711 uint8_t c6dofimu10_get_interrupt ( c6dofimu10_t *ctx, uint8_t int_pin );
712 
713 #ifdef __cplusplus
714 }
715 #endif
716 #endif // _c6DOFIMU10_H_
717  // End public_function group
720 
721 // ------------------------------------------------------------------------- END
c6dofimu10_motion_t::pos_x
uint8_t pos_x
Definition: c6dofimu10.h:478
c6dofimu10_t::gp2
digital_out_t gp2
Definition: c6dofimu10.h:493
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:533
c6dofimu10_cfg_t::scl
pin_name_t scl
Definition: c6dofimu10.h:519
c6dofimu10_motion_t::pos_y
uint8_t pos_y
Definition: c6dofimu10.h:480
c6dofimu10_axis_t::z
int16_t z
Definition: c6dofimu10.h:461
c6dofimu10_t::gp1
digital_in_t gp1
Definition: c6dofimu10.h:497
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:525
c6dofimu10_cfg_t::i2c_speed
uint32_t i2c_speed
Definition: c6dofimu10.h:529
c6dofimu10_cfg_t
Click configuration structure definition.
Definition: c6dofimu10.h:516
c6dofimu10_axis_t
Axis structure.
Definition: c6dofimu10.h:458
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:524
c6dofimu10_t::motion
c6dofimu10_motion_t motion
Definition: c6dofimu10.h:508
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:479
c6dofimu10_motion_t
Motion interrupt structure.
Definition: c6dofimu10.h:476
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:507
c6dofimu10_cfg_t::res_sample
uint8_t res_sample
Definition: c6dofimu10.h:536
c6dofimu10_axis_t::x
int16_t x
Definition: c6dofimu10.h:459
c6DOFIMU10_RETVAL
#define c6DOFIMU10_RETVAL
Definition: c6dofimu10.h:78
c6dofimu10_axis_t::y
int16_t y
Definition: c6dofimu10.h:460
c6dofimu10_motion_t::neg_x
uint8_t neg_x
Definition: c6dofimu10.h:477
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:535
c6dofimu10_motion_t::pos_z
uint8_t pos_z
Definition: c6dofimu10.h:482
c6dofimu10_motion_t::neg_z
uint8_t neg_z
Definition: c6dofimu10.h:481
c6dofimu10_t::i2c
i2c_master_t i2c
Definition: c6dofimu10.h:501
c6dofimu10_cfg_t::op_temp
uint8_t op_temp
Definition: c6dofimu10.h:532
c6dofimu10_cfg_t::sda
pin_name_t sda
Definition: c6dofimu10.h:520
c6dofimu10_t::slave_address
uint8_t slave_address
Definition: c6dofimu10.h:505
c6dofimu10_t
Click ctx object definition.
Definition: c6dofimu10.h:490
c6dofimu10_cfg_t::i2c_address
uint8_t i2c_address
Definition: c6dofimu10.h:530
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:534