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 "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 #include "drv_i2c_master.h"
41 
42 
43 // -------------------------------------------------------------- PUBLIC MACROS
53 #define c6DOFIMU10_MAP_MIKROBUS( cfg, mikrobus ) \
54  cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
55  cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
56  cfg.gp2 = MIKROBUS( mikrobus, MIKROBUS_RST ); \
57  cfg.gp1 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
58 
64 #define c6DOFIMU10_RETVAL uint8_t
65 
66 #define c6DOFIMU10_OK 0x00
67 #define c6DOFIMU10_INIT_ERROR 0xFF
68 
74 #define C6DOFIMU10_SLAVE_ADDRESS_GND 0x0E
75 #define C6DOFIMU10_SLAVE_ADDRESS_VCC 0x0F
76 
82 #define C6DOFIMU10_REG_WHO_AM_I 0x00
83 #define C6DOFIMU10_REG_INS_1 0x01
84 #define C6DOFIMU10_REG_INS_2 0x02
85 #define C6DOFIMU10_REG_INS_3 0x03
86 #define C6DOFIMU10_REG_INL 0x05
87 #define C6DOFIMU10_REG_ACCEL_XOUT_L 0x0A
88 #define C6DOFIMU10_REG_ACCEL_XOUT 0x0A
89 #define C6DOFIMU10_REG_ACCEL_XOUT_H 0x0B
90 #define C6DOFIMU10_REG_ACCEL_YOUT_L 0x0C
91 #define C6DOFIMU10_REG_ACCEL_YOUT 0x0C
92 #define C6DOFIMU10_REG_ACCEL_YOUT_H 0x0D
93 #define C6DOFIMU10_REG_ACCEL_ZOUT_L 0x0E
94 #define C6DOFIMU10_REG_ACCEL_ZOUT 0x0E
95 #define C6DOFIMU10_REG_ACCEL_ZOUT_H 0x0F
96 #define C6DOFIMU10_REG_MAG_XOUT_L 0x10
97 #define C6DOFIMU10_REG_MAG_XOUT 0x10
98 #define C6DOFIMU10_REG_MAG_XOUT_H 0x11
99 #define C6DOFIMU10_REG_MAG_YOUT_L 0x12
100 #define C6DOFIMU10_REG_MAG_YOUT 0x12
101 #define C6DOFIMU10_REG_MAG_YOUT_H 0x13
102 #define C6DOFIMU10_REG_MAG_ZOUT_L 0x14
103 #define C6DOFIMU10_REG_MAG_ZOUT 0x14
104 #define C6DOFIMU10_REG_MAG_ZOUT_H 0x15
105 #define C6DOFIMU10_REG_TEMP_OUT_L 0x16
106 #define C6DOFIMU10_REG_TEMP_OUT 0x16
107 #define C6DOFIMU10_REG_TEMP_OUT_H 0x17
108 #define C6DOFIMU10_REG_INC_1 0x2A
109 #define C6DOFIMU10_REG_INC_2 0x2B
110 #define C6DOFIMU10_REG_INC_3 0x2C
111 #define C6DOFIMU10_REG_INC_4 0x2D
112 #define C6DOFIMU10_REG_INC_5 0x2E
113 #define C6DOFIMU10_REG_AMI_CNTL_1 0x2F
114 #define C6DOFIMU10_REG_AMI_CNTL_2 0x30
115 #define C6DOFIMU10_REG_AMI_CNTL_3 0x31
116 #define C6DOFIMU10_REG_MMI_CNTL_1 0x32
117 #define C6DOFIMU10_REG_MMI_CNTL_2 0x33
118 #define C6DOFIMU10_REG_MMI_CNTL_3 0x34
119 #define C6DOFIMU10_REG_FFI_CNTL_1 0x35
120 #define C6DOFIMU10_REG_FFI_CNTL_2 0x36
121 #define C6DOFIMU10_REG_FFI_CNTL_3 0x37
122 #define C6DOFIMU10_REG_ODCNTL 0x38
123 #define C6DOFIMU10_REG_CNTL_1 0x39
124 #define C6DOFIMU10_REG_CNTL_2 0x3A
125 #define C6DOFIMU10_REG_COTR 0x3C
126 #define C6DOFIMU10_REG_BUF_CTRL_1 0x77
127 #define C6DOFIMU10_REG_BUF_CTRL_2 0x78
128 #define C6DOFIMU10_REG_BUF_CTRL_3 0x79
129 #define C6DOFIMU10_REG_BUF_CLEAR 0x7A
130 #define C6DOFIMU10_REG_BUF_STATUS_1 0x7B
131 #define C6DOFIMU10_REG_BUF_STATUS_2 0x7C
132 #define C6DOFIMU10_REG_BUF_STATUS_3 0x7D
133 #define C6DOFIMU10_REG_BUF_READ 0x7E
134 
140 #define C6DOFIMU10_DEF_WHO_AM_I 0x18
141 
147 #define C6DOFIMU10_INS1_NO_INTERRUPT_EVENT 0x00
148 #define C6DOFIMU10_INS1_INTERRUPT_EVENT 0x80
149 #define C6DOFIMU10_INS1_BUFFER_IS_NOT_FULL 0x00
150 #define C6DOFIMU10_INS1_BUFFER_IS_FULL 0x40
151 #define C6DOFIMU10_INS1_BUFFER_WM_NOT_REACHED 0x00
152 #define C6DOFIMU10_INS1_BUFFER_WM_REACHED 0x20
153 #define C6DOFIMU10_INS1_ACCEL_DATA_NOT_AVAILABLE 0x00
154 #define C6DOFIMU10_INS1_ACCEL_DATA_AVAILABLE 0x10
155 #define C6DOFIMU10_INS1_MAG_DATA_NOT_AVAILABLE 0x00
156 #define C6DOFIMU10_INS1_MAG_DATA_AVAILABLE 0x08
157 #define C6DOFIMU10_INS1_FREE_FALL_HAS_ACTIVATED 0x00
158 #define C6DOFIMU10_INS1_NO_FREE_FALL 0x04
159 #define C6DOFIMU10_INS1_ACCEL_MOTION_HAS_ACTIVATED 0x00
160 #define C6DOFIMU10_INS1_NO_ACCEL_MOTION 0x02
161 #define C6DOFIMU10_INS1_MAG_MOTION_HAS_ACTIVATED 0x00
162 #define C6DOFIMU10_INS1_NO_MAG_MOTION 0x01
163 
169 #define C6DOFIMU10_INS2_ACCEL_NEGATIVE_X 0x20
170 #define C6DOFIMU10_INS2_ACCEL_POSITIVE_X 0x10
171 #define C6DOFIMU10_INS2_ACCEL_NEGATIVE_Y 0x08
172 #define C6DOFIMU10_INS2_ACCEL_POSITIVE_Y 0x04
173 #define C6DOFIMU10_INS2_ACCEL_NEGATIVE_Z 0x02
174 #define C6DOFIMU10_INS2_ACCEL_POSITIVE_Z 0x01
175 
181 #define C6DOFIMU10_INS3_MAG_NEGATIVE_X 0x20
182 #define C6DOFIMU10_INS3_MAG_POSITIVE_X 0x10
183 #define C6DOFIMU10_INS3_MAG_NEGATIVE_Y 0x08
184 #define C6DOFIMU10_INS3_MAG_POSITIVE_Y 0x04
185 #define C6DOFIMU10_INS3_MAG_NEGATIVE_Z 0x02
186 #define C6DOFIMU10_INS3_MAG_POSITIVE_Z 0x01
187 
193 #define C6DOFIMU10_INC1_GP1_BUFF_FULL_INT_DISABLE 0x00
194 #define C6DOFIMU10_INC1_GP1_BUFF_FULL_INT_ENABLE 0x40
195 #define C6DOFIMU10_INC1_GP1_WM_INT_DISABLE 0x00
196 #define C6DOFIMU10_INC1_GP1_WM_INT_ENABLE 0x20
197 #define C6DOFIMU10_INC1_GP1_ACCEL_DRDY_DISABLE 0x00
198 #define C6DOFIMU10_INC1_GP1_ACCEL_DRDY_ENABLE 0x10
199 #define C6DOFIMU10_INC1_GP1_MAG_DRDY_DISABLE 0x00
200 #define C6DOFIMU10_INC1_GP1_MAG_DRDY_ENABLE 0x08
201 #define C6DOFIMU10_INC1_GP1_FREE_FALL_INT_DISABLE 0x00
202 #define C6DOFIMU10_INC1_GP1_FREE_FALL_INT_ENABLE 0x04
203 #define C6DOFIMU10_INC1_GP1_ACCEL_MOTION_DISABLE 0x00
204 #define C6DOFIMU10_INC1_GP1_ACCEL_MOTION_ENABLE 0x02
205 #define C6DOFIMU10_INC1_GP1_MAG_MOTION_DISABLE 0x00
206 #define C6DOFIMU10_INC1_GP1_MAG_MOTION_ENABLE 0x01
207 
213 #define C6DOFIMU10_INC2_GP2_BUFF_FULL_INT_DISABLE 0x00
214 #define C6DOFIMU10_INC2_GP2_BUFF_FULL_INT_ENABLE 0x40
215 #define C6DOFIMU10_INC2_GP2_WM_INT_DISABLE 0x00
216 #define C6DOFIMU10_INC2_GP2_WM_INT_ENABLE 0x20
217 #define C6DOFIMU10_INC2_GP2_ACCEL_DRDY_DISABLE 0x00
218 #define C6DOFIMU10_INC2_GP2_ACCEL_DRDY_ENABLE 0x10
219 #define C6DOFIMU10_INC2_GP2_MAG_DRDY_DISABLE 0x00
220 #define C6DOFIMU10_INC2_GP2_MAG_DRDY_ENABLE 0x08
221 #define C6DOFIMU10_INC2_GP2_FREE_FALL_INT_DISABLE 0x00
222 #define C6DOFIMU10_INC2_GP2_FREE_FALL_INT_ENABLE 0x04
223 #define C6DOFIMU10_INC2_GP2_ACCEL_MOTION_DISABLE 0x00
224 #define C6DOFIMU10_INC2_GP2_ACCEL_MOTION_ENABLE 0x02
225 #define C6DOFIMU10_INC2_GP2_MAG_MOTION_DISABLE 0x00
226 #define C6DOFIMU10_INC2_GP2_MAG_MOTION_ENABLE 0x01
227 
233 #define C6DOFIMU10_INC3_IED2_PUSH_PULL 0x00
234 #define C6DOFIMU10_INC3_IED2_OPEN_DRAIN 0x80
235 #define C6DOFIMU10_INC3_IEA2_ACTIVE_LOW 0x00
236 #define C6DOFIMU10_INC3_IEA2_ACTIVE_HIGH 0x40
237 #define C6DOFIMU10_INC3_IEL2_LATCHED 0x00
238 #define C6DOFIMU10_INC3_IEL2_PULSED 0x10
239 #define C6DOFIMU10_INC3_IEL2_TRIGGER 0x20
240 #define C6DOFIMU10_INC3_IED1_PUSH_PULL 0x00
241 #define C6DOFIMU10_INC3_IED1_OPEN_DRAIN 0x08
242 #define C6DOFIMU10_INC3_IEA1_ACTIVE_LOW 0x00
243 #define C6DOFIMU10_INC3_IEA1_ACTIVE_HIGH 0x04
244 #define C6DOFIMU10_INC3_IEL1_LATCHED 0x00
245 #define C6DOFIMU10_INC3_IEL1_PULSED 0x01
246 #define C6DOFIMU10_INC3_IEL1_TRIGGER 0x02
247 
253 #define C6DOFIMU10_INC4_ACCEL_NEGATIVE_X_ENABLE 0x20
254 #define C6DOFIMU10_INC4_ACCEL_POSITIVE_X_ENABLE 0x10
255 #define C6DOFIMU10_INC4_ACCEL_NEGATIVE_Y_ENABLE 0x08
256 #define C6DOFIMU10_INC4_ACCEL_POSITIVE_Y_ENABLE 0x04
257 #define C6DOFIMU10_INC4_ACCEL_NEGATIVE_Z_ENABLE 0x02
258 #define C6DOFIMU10_INC4_ACCEL_POSITIVE_Z_ENABLE 0x01
259 #define C6DOFIMU10_INC4_ACCEL_NEGATIVE_X_DISABLE 0x00
260 #define C6DOFIMU10_INC4_ACCEL_POSITIVE_X_DISABLE 0x00
261 #define C6DOFIMU10_INC4_ACCEL_NEGATIVE_Y_DISABLE 0x00
262 #define C6DOFIMU10_INC4_ACCEL_POSITIVE_Y_DISABLE 0x00
263 #define C6DOFIMU10_INC4_ACCEL_NEGATIVE_Z_DISABLE 0x00
264 #define C6DOFIMU10_INC4_ACCEL_POSITIVE_Z_DISABLE 0x00
265 
271 #define C6DOFIMU10_INC4_MAG_NEGATIVE_X_ENABLE 0x20
272 #define C6DOFIMU10_INC4_MAG_POSITIVE_X_ENABLE 0x10
273 #define C6DOFIMU10_INC4_MAG_NEGATIVE_Y_ENABLE 0x08
274 #define C6DOFIMU10_INC4_MAG_POSITIVE_Y_ENABLE 0x04
275 #define C6DOFIMU10_INC4_MAG_NEGATIVE_Z_ENABLE 0x02
276 #define C6DOFIMU10_INC4_MAG_POSITIVE_Z_ENABLE 0x01
277 #define C6DOFIMU10_INC4_MAG_NEGATIVE_X_DISABLE 0x00
278 #define C6DOFIMU10_INC4_MAG_POSITIVE_X_DISABLE 0x00
279 #define C6DOFIMU10_INC4_MAG_NEGATIVE_Y_DISABLE 0x00
280 #define C6DOFIMU10_INC4_MAG_POSITIVE_Y_DISABLE 0x00
281 #define C6DOFIMU10_INC4_MAG_NEGATIVE_Z_DISABLE 0x00
282 #define C6DOFIMU10_INC4_MAG_POSITIVE_Z_DISABLE 0x00
283 
289 #define C6DOFIMU10_AMICNTL3_ACCEL_MOTION_DISABLE 0x00
290 #define C6DOFIMU10_AMICNTL3_ACCEL_MOTION_ENABLE 0x80
291 #define C6DOFIMU10_AMICNTL3_ACCEL_MOTION_LATCHED 0x00
292 #define C6DOFIMU10_AMICNTL3_ACCEL_MOTION_UNLATCHED 0x40
293 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_0p781 0x00
294 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_1p563 0x01
295 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_3p125 0x02
296 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_6p25 0x03
297 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_12p5 0x04
298 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_25 0x05
299 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_50 0x06
300 #define C6DOFIMU10_AMICNTL3_ACCEL_ODR_100 0x07
301 
307 #define C6DOFIMU10_MMICNTL3_MAG_MOTION_DISABLE 0x00
308 #define C6DOFIMU10_MMICNTL3_MAG_MOTION_ENABLE 0x80
309 #define C6DOFIMU10_MMICNTL3_MAG_MOTION_LATCHED 0x00
310 #define C6DOFIMU10_MMICNTL3_MAG_MOTION_UNLATCHED 0x40
311 #define C6DOFIMU10_MMICNTL3_MAG_ODR_0p781 0x00
312 #define C6DOFIMU10_MMICNTL3_MAG_ODR_1p563 0x01
313 #define C6DOFIMU10_MMICNTL3_MAG_ODR_3p125 0x02
314 #define C6DOFIMU10_MMICNTL3_MAG_ODR_6p25 0x03
315 #define C6DOFIMU10_MMICNTL3_MAG_ODR_12p5 0x04
316 #define C6DOFIMU10_MMICNTL3_MAG_ODR_25 0x05
317 #define C6DOFIMU10_MMICNTL3_MAG_ODR_50 0x06
318 #define C6DOFIMU10_MMICNTL3_MAG_ODR_100 0x07
319 
325 #define C6DOFIMU10_FFICNTL3_FREE_FALL_DISABLE 0x00
326 #define C6DOFIMU10_FFICNTL3_FREE_FALL_ENABLE 0x80
327 #define C6DOFIMU10_FFICNTL3_FREE_FALL_LATCHED 0x00
328 #define C6DOFIMU10_FFICNTL3_FREE_FALL_UNLATCHED 0x40
329 #define C6DOFIMU10_FFICNTL3_FFI_DEBOUNCE_CNT_UP_DOWN 0x00
330 #define C6DOFIMU10_FFICNTL3_FFI_DEBOUNCE_CNT_UP_RESET 0x08
331 #define C6DOFIMU10_FFICNTL3_ODR_12p5 0x00
332 #define C6DOFIMU10_FFICNTL3_ODR_25 0x01
333 #define C6DOFIMU10_FFICNTL3_ODR_50 0x02
334 #define C6DOFIMU10_FFICNTL3_ODR_100 0x03
335 #define C6DOFIMU10_FFICNTL3_ODR_200 0x04
336 #define C6DOFIMU10_FFICNTL3_ODR_400 0x05
337 #define C6DOFIMU10_FFICNTL3_ODR_800 0x06
338 #define C6DOFIMU10_FFICNTL3_ODR_1600 0x07
339 
345 #define C6DOFIMU10_ODCNTL_MAG_ODR_12p5 0x00
346 #define C6DOFIMU10_ODCNTL_MAG_ODR_15 0x10
347 #define C6DOFIMU10_ODCNTL_MAG_ODR_50 0x20
348 #define C6DOFIMU10_ODCNTL_MAG_ODR_100 0x30
349 #define C6DOFIMU10_ODCNTL_MAG_ODR_200 0x40
350 #define C6DOFIMU10_ODCNTL_MAG_ODR_400 0x50
351 #define C6DOFIMU10_ODCNTL_MAG_ODR_800 0x60
352 #define C6DOFIMU10_ODCNTL_MAG_ODR_1600 0x70
353 #define C6DOFIMU10_ODCNTL_MAG_ODR_0p781 0x80
354 #define C6DOFIMU10_ODCNTL_MAG_ODR_1p563 0x90
355 #define C6DOFIMU10_ODCNTL_MAG_ODR_3p125 0xA0
356 #define C6DOFIMU10_ODCNTL_MAG_ODR_6p25 0xB0
357 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_12p5 0x00
358 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_15 0x01
359 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_50 0x02
360 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_100 0x03
361 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_200 0x04
362 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_400 0x05
363 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_800 0x06
364 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_1600 0x07
365 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_0p781 0x08
366 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_1p563 0x09
367 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_3p125 0x0A
368 #define C6DOFIMU10_ODCNTL_ACCEL_ODR_6p25 0x0B
369 
375 #define C6DOFIMU10_CNTL1_SW_RESET_NO_ACTION 0x00
376 #define C6DOFIMU10_CNTL1_SW_RESET_START_REBOOT 0x80
377 #define C6DOFIMU10_CNTL1_ST_MODE_DISABLE 0x00
378 #define C6DOFIMU10_CNTL1_ST_MODE_ENABLE 0x40
379 #define C6DOFIMU10_CNTL1_ST_POLARITY_POSITIVE 0x00
380 #define C6DOFIMU10_CNTL1_ST_POLARITY_NEGATIVE 0x20
381 #define C6DOFIMU10_CNTL1_COTC_NO_ACTION 0x00
382 #define C6DOFIMU10_CNTL1_COTC_SETS_COTR 0x08
383 
389 #define C6DOFIMU10_CNTL2_TEMP_STANDBY_MODE 0x00
390 #define C6DOFIMU10_CNTL2_TEMP_OPERATING_MODE 0x40
391 #define C6DOFIMU10_CNTL2_ACCEL_RANGE_2g 0x00
392 #define C6DOFIMU10_CNTL2_ACCEL_RANGE_4g 0x10
393 #define C6DOFIMU10_CNTL2_ACCEL_RANGE_8g 0x20
394 #define C6DOFIMU10_CNTL2_ACCEL_RANGE_16g 0x30
395 #define C6DOFIMU10_CNTL2_RES_SAMBLE_A4_M2 0x00
396 #define C6DOFIMU10_CNTL2_RES_SAMBLE_A32_M16 0x04
397 #define C6DOFIMU10_CNTL2_RES_SAMBLE_MAX_MAX 0x08
398 #define C6DOFIMU10_CNTL2_MAG_STANDBY_MODE 0x00
399 #define C6DOFIMU10_CNTL2_MAG_OPERATING_MODE 0x02
400 #define C6DOFIMU10_CNTL2_ACCEL_STANDBY_MODE 0x00
401 #define C6DOFIMU10_CNTL2_ACCEL_OPERATING_MODE 0x01
402 
408 #define C6DOFIMU10_DEVICE_OK 0
409 #define C6DOFIMU10_DEVICE_ERROR 1
410 
416 #define C6DOFIMU10_TEMP_FORMAT_FARENHAJT 2
417 #define C6DOFIMU10_TEMP_FORMAT_KELVIN 1
418 #define C6DOFIMU10_TEMP_FORMAT_CELSIUS 0
419 
425 #define C6DOFIMU10_GP1_INT_PIN 0
426 #define C6DOFIMU10_GP2_INT_PIN 1
427  // End group macro
430 // --------------------------------------------------------------- PUBLIC TYPES
443 typedef struct
444 {
445  int16_t x;
446  int16_t y;
447  int16_t z;
448 
450 
461 typedef struct
462 {
463  uint8_t neg_x;
464  uint8_t pos_x;
465  uint8_t neg_y;
466  uint8_t pos_y;
467  uint8_t neg_z;
468  uint8_t pos_z;
469 
471 
475 typedef struct
476 {
477  // Output pins
478 
479  digital_out_t gp2;
480 
481  // Input pins
482 
483  digital_in_t gp1;
484 
485  // Modules
486 
487  i2c_master_t i2c;
488 
489  // ctx variable
490 
491  uint8_t slave_address;
492 
495 
496 } c6dofimu10_t;
497 
501 typedef struct
502 {
503  // Communication gpio pins
504 
505  pin_name_t scl;
506  pin_name_t sda;
507 
508  // Additional gpio pins
509 
510  pin_name_t gp2;
511  pin_name_t gp1;
512 
513  // static variable
514 
515  uint32_t i2c_speed;
516  uint8_t i2c_address;
517 
518  uint8_t op_temp;
519  uint8_t op_accel;
520  uint8_t op_mag;
521  uint8_t accel_range;
522  uint8_t res_sample;
523 
525  // End types group
527 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
528 
534 #ifdef __cplusplus
535 extern "C"{
536 #endif
537 
547 
556 
565 
576 void c6dofimu10_generic_write ( c6dofimu10_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
577 
588 void c6dofimu10_generic_read ( c6dofimu10_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
589 
599 
616 
633 
649 float c6dofimu10_get_temperature ( c6dofimu10_t *ctx, uint8_t temp_format );
650 
665 
681 void c6dofimu10_get_motion ( c6dofimu10_t *ctx, uint8_t sensor_reg, c6dofimu10_motion_t *motion_obj );
682 
697 uint8_t c6dofimu10_get_interrupt ( c6dofimu10_t *ctx, uint8_t int_pin );
698 
699 #ifdef __cplusplus
700 }
701 #endif
702 #endif // _c6DOFIMU10_H_
703  // End public_function group
706 
707 // ------------------------------------------------------------------------- END
void c6dofimu10_get_accel_axis(c6dofimu10_t *ctx, c6dofimu10_axis_t *axis)
Accelerometer axis data.
uint8_t accel_range
Definition: c6dofimu10.h:521
Click ctx object definition.
Definition: c6dofimu10.h:475
uint32_t i2c_speed
Definition: c6dofimu10.h:515
void c6dofimu10_get_motion(c6dofimu10_t *ctx, uint8_t sensor_reg, c6dofimu10_motion_t *motion_obj)
Get motion interrupt status.
uint8_t op_mag
Definition: c6dofimu10.h:520
void c6dofimu10_default_cfg(c6dofimu10_t *ctx)
Click Default Configuration function.
#define c6DOFIMU10_RETVAL
Definition: c6dofimu10.h:64
uint8_t pos_x
Definition: c6dofimu10.h:464
uint8_t res_sample
Definition: c6dofimu10.h:522
uint8_t slave_address
Definition: c6dofimu10.h:491
void c6dofimu10_generic_read(c6dofimu10_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
uint8_t pos_y
Definition: c6dofimu10.h:466
Axis structure.
Definition: c6dofimu10.h:443
uint8_t op_accel
Definition: c6dofimu10.h:519
void c6dofimu10_cfg_setup(c6dofimu10_cfg_t *cfg)
Config Object Initialization function.
int16_t z
Definition: c6dofimu10.h:447
uint8_t i2c_address
Definition: c6dofimu10.h:516
uint8_t pos_z
Definition: c6dofimu10.h:468
uint8_t c6dofimu10_communication_test(c6dofimu10_t *ctx)
Communication test.
pin_name_t gp2
Definition: c6dofimu10.h:510
uint8_t op_temp
Definition: c6dofimu10.h:518
float c6dofimu10_get_temperature(c6dofimu10_t *ctx, uint8_t temp_format)
Temperature data.
uint8_t neg_y
Definition: c6dofimu10.h:465
int16_t x
Definition: c6dofimu10.h:445
void c6dofimu10_generic_write(c6dofimu10_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
void c6dofimu10_measurement_cfg(c6dofimu10_t *ctx, c6dofimu10_cfg_t *cfg)
Measurement config.
Motion interrupt structure.
Definition: c6dofimu10.h:461
Click configuration structure definition.
Definition: c6dofimu10.h:501
uint8_t neg_x
Definition: c6dofimu10.h:463
digital_out_t gp2
Definition: c6dofimu10.h:479
c6dofimu10_axis_t axis
Definition: c6dofimu10.h:493
uint8_t c6dofimu10_get_interrupt(c6dofimu10_t *ctx, uint8_t int_pin)
Get interrupt pin status.
pin_name_t sda
Definition: c6dofimu10.h:506
pin_name_t gp1
Definition: c6dofimu10.h:511
pin_name_t scl
Definition: c6dofimu10.h:505
c6dofimu10_motion_t motion
Definition: c6dofimu10.h:494
uint8_t neg_z
Definition: c6dofimu10.h:467
digital_in_t gp1
Definition: c6dofimu10.h:483
c6DOFIMU10_RETVAL c6dofimu10_init(c6dofimu10_t *ctx, c6dofimu10_cfg_t *cfg)
Initialization function.
void c6dofimu10_get_mag_axis(c6dofimu10_t *ctx, c6dofimu10_axis_t *axis)
Magnetometer axis data.
int16_t y
Definition: c6dofimu10.h:446
i2c_master_t i2c
Definition: c6dofimu10.h:487