c6dofimu11 2.0.0.0
c6dofimu11.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 C6DOFIMU11_H
36#define C6DOFIMU11_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// -------------------------------------------------------------- PUBLIC MACROS
66#define C6DOFIMU11_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
69 cfg.gp1 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
70 cfg.gp2 = MIKROBUS( mikrobus, MIKROBUS_INT )
77#define C6DOFIMU11_RETVAL uint8_t
78
79#define C6DOFIMU11_OK 0x00
80#define C6DOFIMU11_INIT_ERROR 0xFF
87#define C6DOFIMU11_I2C_SLAVE_ADDRESS_GND 0x0E
88#define C6DOFIMU11_I2C_SLAVE_ADDRESS_VCC 0x0F
89
96#define C6DOFIMU11_WHO_AM_I 0x00
97#define C6DOFIMU11_INS1 0x01
98#define C6DOFIMU11_INS2 0x02
99#define C6DOFIMU11_INS3 0x03
100#define C6DOFIMU11_INL 0x05
101#define C6DOFIMU11_ACCEL_XOUT_L 0x0A
102#define C6DOFIMU11_ACCEL_XOUT_H 0x0B
103#define C6DOFIMU11_ACCEL_YOUT_L 0x0C
104#define C6DOFIMU11_ACCEL_YOUT_H 0x0D
105#define C6DOFIMU11_ACCEL_ZOUT_L 0x0E
106#define C6DOFIMU11_ACCEL_ZOUT_H 0x0F
107#define C6DOFIMU11_MAG_XOUT_L 0x10
108#define C6DOFIMU11_MAG_XOUT_H 0x11
109#define C6DOFIMU11_MAG_YOUT_L 0x12
110#define C6DOFIMU11_MAG_YOUT_H 0x13
111#define C6DOFIMU11_MAG_ZOUT_L 0x14
112#define C6DOFIMU11_MAG_ZOUT_H 0x15
113#define C6DOFIMU11_TEMP_OUT_L 0x16
114#define C6DOFIMU11_TEMP_OUT_H 0x17
115#define C6DOFIMU11_INC1 0x2A
116#define C6DOFIMU11_INC2 0x2B
117#define C6DOFIMU11_INC3 0x2C
118#define C6DOFIMU11_INC4 0x2D
119#define C6DOFIMU11_INC5 0x2E
120#define C6DOFIMU11_AMI_CNTL1 0x2F
121#define C6DOFIMU11_AMI_CNTL2 0x30
122#define C6DOFIMU11_AMI_CNTL3 0x31
123#define C6DOFIMU11_MMI_CNTL1 0x32
124#define C6DOFIMU11_MMI_CNTL2 0x33
125#define C6DOFIMU11_MMI_CNTL3 0x34
126#define C6DOFIMU11_FFI_CNTL1 0x35
127#define C6DOFIMU11_FFI_CNTL2 0x36
128#define C6DOFIMU11_FFI_CNTL3 0x37
129#define C6DOFIMU11_ODCNTL 0x38
130#define C6DOFIMU11_CNTL1 0x39
131#define C6DOFIMU11_CNTL2 0x3A
132#define C6DOFIMU11_COTR 0x3C
133#define C6DOFIMU11_BUF_CTRL_1 0x77
134#define C6DOFIMU11_BUF_CTRL_2 0x78
135#define C6DOFIMU11_BUF_CTRL_3 0x79
136#define C6DOFIMU11_BUF_CLEAR 0x7A
137#define C6DOFIMU11_BUF_STATUS_1 0x7B
138#define C6DOFIMU11_BUF_STATUS_2 0x7C
139#define C6DOFIMU11_BUF_STATUS_3 0x7D
140#define C6DOFIMU11_BUF_READ 0x7E
141
148#define C6DOFIMU11_WHO_AM_I_WIA_ID 0x2D
149#define C6DOFIMU11_INS1_INT_NO_INT 0x00
150#define C6DOFIMU11_INS1_INT_INT 0x80
151#define C6DOFIMU11_INS1_BFI_BUFF_NOT_FULL 0x00
152#define C6DOFIMU11_INS1_BFI_BUFF_FULL 0x40
153#define C6DOFIMU11_INS1_WMI_MARK_NOT_REACHED 0x00
154#define C6DOFIMU11_INS1_WMI_MARK_REACHED 0x20
155#define C6DOFIMU11_INS1_DRDY_A_NOT_AVAILABLE 0x00
156#define C6DOFIMU11_INS1_DRDY_A_AVAILABLE 0x10
157#define C6DOFIMU11_INS1_DRDY_M_NOT_AVAILABLE 0x00
158#define C6DOFIMU11_INS1_DRDY_M_AVAILABLE 0x08
159#define C6DOFIMU11_INS1_FFI_NO_FFI 0x00
160#define C6DOFIMU11_INS1_FFI_FFI 0x04
161#define C6DOFIMU11_INS1_AMI_NO_MOTION 0x00
162#define C6DOFIMU11_INS1_AMI_MOTION 0x02
163#define C6DOFIMU11_INS1_MMI_NO_MOTION 0x00
164#define C6DOFIMU11_INS1_MMI_MOTION 0x01
165#define C6DOFIMU11_INS2_AXNI 0x20
166#define C6DOFIMU11_INS2_AXPI 0x10
167#define C6DOFIMU11_INS2_AYNI 0x08
168#define C6DOFIMU11_INS2_AYPI 0x04
169#define C6DOFIMU11_INS2_AZNI 0x02
170#define C6DOFIMU11_INS2_AZPI 0x01
171#define C6DOFIMU11_INS3_MXNI 0x20
172#define C6DOFIMU11_INS3_MXPI 0x10
173#define C6DOFIMU11_INS3_MYNI 0x08
174#define C6DOFIMU11_INS3_MYPI 0x04
175#define C6DOFIMU11_INS3_MZNI 0x02
176#define C6DOFIMU11_INS3_MZPI 0x01
177#define C6DOFIMU11_INC1_BFI1 0x40
178#define C6DOFIMU11_INC1_WMI1 0x20
179#define C6DOFIMU11_INC1_DRDY_A1 0x10
180#define C6DOFIMU11_INC1_DRDY_M1 0x08
181#define C6DOFIMU11_INC1_FFI1 0x04
182#define C6DOFIMU11_INC1_AMI1 0x02
183#define C6DOFIMU11_INC1_MMI1 0x01
184#define C6DOFIMU11_INC2_BFI2 0x40
185#define C6DOFIMU11_INC2_WMI2 0x20
186#define C6DOFIMU11_INC2_DRDY_A2 0x10
187#define C6DOFIMU11_INC2_DRDY_M2 0x08
188#define C6DOFIMU11_INC2_FFI2 0x04
189#define C6DOFIMU11_INC2_AMI2 0x02
190#define C6DOFIMU11_INC2_MMI2 0x01
191#define C6DOFIMU11_INC3_IED2_PUSHPULL 0x00
192#define C6DOFIMU11_INC3_IED2_OPENDRAIN 0x80
193#define C6DOFIMU11_INC3_IEA2_LOW 0x00
194#define C6DOFIMU11_INC3_IEA2_HIGH 0x40
195#define C6DOFIMU11_INC3_IEL2_LATCHED 0x00
196#define C6DOFIMU11_INC3_IEL2_PULSED 0x10
197#define C6DOFIMU11_INC3_IEL2_FIFO_TRIG 0x20
198#define C6DOFIMU11_INC3_IEL2_FIFO_TRIG_2 0x30
199#define C6DOFIMU11_INC3_IED1_PUSHPULL 0x00
200#define C6DOFIMU11_INC3_IED1_OPENDRAIN 0x08
201#define C6DOFIMU11_INC3_IEA1_LOW 0x00
202#define C6DOFIMU11_INC3_IEA1_HIGH 0x04
203#define C6DOFIMU11_INC3_IEL1_LATCHED 0x00
204#define C6DOFIMU11_INC3_IEL1_PULSED 0x01
205#define C6DOFIMU11_INC3_IEL1_FIFO_TRIG 0x02
206#define C6DOFIMU11_INC3_IEL1_FIFO_TRIG_2 0x03
207#define C6DOFIMU11_INC4_AXNIE 0x20
208#define C6DOFIMU11_INC4_AXPIE 0x10
209#define C6DOFIMU11_INC4_AYNIE 0x08
210#define C6DOFIMU11_INC4_AYPIE 0x04
211#define C6DOFIMU11_INC4_AZNIE 0x02
212#define C6DOFIMU11_INC4_AZPIE 0x01
213#define C6DOFIMU11_INC5_MXNIE 0x20
214#define C6DOFIMU11_INC5_MXPIE 0x10
215#define C6DOFIMU11_INC5_MYNIE 0x08
216#define C6DOFIMU11_INC5_MYPIE 0x04
217#define C6DOFIMU11_INC5_MZNIE 0x02
218#define C6DOFIMU11_INC5_MZPIE 0x01
219#define C6DOFIMU11_AMI_CNTL3_AMI_EN_DISABLED 0x00
220#define C6DOFIMU11_AMI_CNTL3_AMI_EN_ENABLED 0x80
221#define C6DOFIMU11_AMI_CNTL3_AMIUL 0x40
222#define C6DOFIMU11_AMI_CNTL3_OAMI_0P781 0x00
223#define C6DOFIMU11_AMI_CNTL3_OAMI_1P563 0x01
224#define C6DOFIMU11_AMI_CNTL3_OAMI_3P125 0x02
225#define C6DOFIMU11_AMI_CNTL3_OAMI_6P25 0x03
226#define C6DOFIMU11_AMI_CNTL3_OAMI_12P5 0x04
227#define C6DOFIMU11_AMI_CNTL3_OAMI_25 0x05
228#define C6DOFIMU11_AMI_CNTL3_OAMI_50 0x06
229#define C6DOFIMU11_AMI_CNTL3_OAMI_100 0x07
230#define C6DOFIMU11_MMI_CNTL3_MMI_EN_DISABLED 0x00
231#define C6DOFIMU11_MMI_CNTL3_MMI_EN_ENABLED 0x80
232#define C6DOFIMU11_MMI_CNTL3_MMIUL 0x40
233#define C6DOFIMU11_MMI_CNTL3_OMMI_0P781 0x00
234#define C6DOFIMU11_MMI_CNTL3_OMMI_1P563 0x01
235#define C6DOFIMU11_MMI_CNTL3_OMMI_3P125 0x02
236#define C6DOFIMU11_MMI_CNTL3_OMMI_6P25 0x03
237#define C6DOFIMU11_MMI_CNTL3_OMMI_12P5 0x04
238#define C6DOFIMU11_MMI_CNTL3_OMMI_25 0x05
239#define C6DOFIMU11_MMI_CNTL3_OMMI_50 0x06
240#define C6DOFIMU11_MMI_CNTL3_OMMI_100 0x07
241#define C6DOFIMU11_FFI_CNTL3_FFI_EN_DISABLED 0x00
242#define C6DOFIMU11_FFI_CNTL3_FFI_EN_ENABLED 0x80
243#define C6DOFIMU11_FFI_CNTL3_FFIUL 0x40
244#define C6DOFIMU11_FFI_CNTL3_DCRM 0x08
245#define C6DOFIMU11_FFI_CNTL3_OFFI_12P5 0x00
246#define C6DOFIMU11_FFI_CNTL3_OFFI_25 0x01
247#define C6DOFIMU11_FFI_CNTL3_OFFI_50 0x02
248#define C6DOFIMU11_FFI_CNTL3_OFFI_100 0x03
249#define C6DOFIMU11_FFI_CNTL3_OFFI_200 0x04
250#define C6DOFIMU11_FFI_CNTL3_OFFI_400 0x05
251#define C6DOFIMU11_FFI_CNTL3_OFFI_800 0x06
252#define C6DOFIMU11_FFI_CNTL3_OFFI_1600 0x07
253#define C6DOFIMU11_ODCNTL_OSA_12P5 0x00
254#define C6DOFIMU11_ODCNTL_OSA_25 0x01
255#define C6DOFIMU11_ODCNTL_OSA_50 0x02
256#define C6DOFIMU11_ODCNTL_OSA_100 0x03
257#define C6DOFIMU11_ODCNTL_OSA_200 0x04
258#define C6DOFIMU11_ODCNTL_OSA_400 0x05
259#define C6DOFIMU11_ODCNTL_OSA_800 0x06
260#define C6DOFIMU11_ODCNTL_OSA_1600 0x07
261#define C6DOFIMU11_ODCNTL_OSA_0P781 0x08
262#define C6DOFIMU11_ODCNTL_OSA_1P563 0x09
263#define C6DOFIMU11_ODCNTL_OSA_3P125 0x0A
264#define C6DOFIMU11_ODCNTL_OSA_6P25 0x0B
265#define C6DOFIMU11_ODCNTL_OSA_25600ST0P8 0x0C
266#define C6DOFIMU11_ODCNTL_OSA_25600ST1P6 0x0D
267#define C6DOFIMU11_ODCNTL_OSA_25600ST3P2 0x0E
268#define C6DOFIMU11_ODCNTL_OSA_25600 0x0F
269#define C6DOFIMU11_ODCNTL_OSM_12P5 0x00
270#define C6DOFIMU11_ODCNTL_OSM_25 0x10
271#define C6DOFIMU11_ODCNTL_OSM_50 0x20
272#define C6DOFIMU11_ODCNTL_OSM_100 0x30
273#define C6DOFIMU11_ODCNTL_OSM_200 0x40
274#define C6DOFIMU11_ODCNTL_OSM_400 0x50
275#define C6DOFIMU11_ODCNTL_OSM_800 0x60
276#define C6DOFIMU11_ODCNTL_OSM_1600 0x70
277#define C6DOFIMU11_ODCNTL_OSM_0P781 0x80
278#define C6DOFIMU11_ODCNTL_OSM_1P563 0x90
279#define C6DOFIMU11_ODCNTL_OSM_3P125 0xA0
280#define C6DOFIMU11_ODCNTL_OSM_6P25 0xB0
281#define C6DOFIMU11_ODCNTL_OSM_12800A 0xC0
282#define C6DOFIMU11_ODCNTL_OSM_12800B 0xD0
283#define C6DOFIMU11_ODCNTL_OSM_12800C 0xE0
284#define C6DOFIMU11_ODCNTL_OSM_12800 0xF0
285#define C6DOFIMU11_CNTL1_SRST 0x80
286#define C6DOFIMU11_CNTL1_STEN_DISABLED 0x00
287#define C6DOFIMU11_CNTL1_STEN_ENABLED 0x40
288#define C6DOFIMU11_CNTL1_STPOL 0x20
289#define C6DOFIMU11_CNTL1_COTC 0x08
296#define C6DOFIMU11_CNTL2_TEMP_EN_STANDBY_MODE 0x00
297#define C6DOFIMU11_CNTL2_TEMPERATURE_DISABLE 0x00
298#define C6DOFIMU11_CNTL2_TEMPERATURE_ENABLE 0x01
299#define C6DOFIMU11_CNTL2_TEMP_EN_OPERATING_MODE 0x40
300#define C6DOFIMU11_CNTL2_GSEL_8G 0x00
301#define C6DOFIMU11_CNTL2_GSEL_16G 0x10
302#define C6DOFIMU11_CNTL2_GSEL_32G 0x20
303#define C6DOFIMU11_CNTL2_GSEL_64G 0x30
304#define C6DOFIMU11_CNTL2_RES_A4M2 0x00
305#define C6DOFIMU11_CNTL2_RES_A32M16 0x04
306#define C6DOFIMU11_CNTL2_RES_MAX1 0x08
307#define C6DOFIMU11_CNTL2_RES_MAX2 0x0C
308#define C6DOFIMU11_CNTL2_MAG_DISABLE 0x00
309#define C6DOFIMU11_CNTL2_MAG_ENABLE 0x01
310#define C6DOFIMU11_CNTL2_MAG_EN_STANDBY_MODE 0x00
311#define C6DOFIMU11_CNTL2_MAG_EN_OPERATING_MODE 0x02
312#define C6DOFIMU11_CNTL2_ACCEL_EN_STANDBY_MODE 0x00
313#define C6DOFIMU11_CNTL2_ACCEL_EN_OPERATING_MODE 0x01
314#define C6DOFIMU11_CNTL2_ACCEL_DISABLE 0x00
315#define C6DOFIMU11_CNTL2_ACCEL_ENABLE 0x01
316#define C6DOFIMU11_COTR_TEST_RESP_DEFAULT 0x55
317#define C6DOFIMU11_COTR_TEST_RESP_TEST 0xAA
318#define C6DOFIMU11_BUF_CTRL_2_BUF_M_FIFO 0x00
319#define C6DOFIMU11_BUF_CTRL_2_BUF_M_STREAM 0x02
320#define C6DOFIMU11_BUF_CTRL_2_BUF_M_TRIGGER 0x04
321#define C6DOFIMU11_BUF_CTRL_2_BUF_M_FILO 0x03
322#define C6DOFIMU11_BUF_CTRL_2_SMT_TH8 0x01
323#define C6DOFIMU11_BUF_CTRL_3_BFI_EN_DISABLED 0x00
324#define C6DOFIMU11_BUF_CTRL_3_BFI_EN_ENABLED 0x80
325#define C6DOFIMU11_BUF_CTRL_3_BUF_AX_DISABLED 0x00
326#define C6DOFIMU11_BUF_CTRL_3_BUF_AX_ENABLED 0x40
327#define C6DOFIMU11_BUF_CTRL_3_BUF_AY_DISABLED 0x00
328#define C6DOFIMU11_BUF_CTRL_3_BUF_AY_ENABLED 0x20
329#define C6DOFIMU11_BUF_CTRL_3_BUF_AZ_DISABLED 0x00
330#define C6DOFIMU11_BUF_CTRL_3_BUF_AZ_ENABLED 0x10
331#define C6DOFIMU11_BUF_CTRL_3_BUF_MX_DISABLED 0x00
332#define C6DOFIMU11_BUF_CTRL_3_BUF_MX_ENABLED 0x08
333#define C6DOFIMU11_BUF_CTRL_3_BUF_MY_DISABLED 0x00
334#define C6DOFIMU11_BUF_CTRL_3_BUF_MY_ENABLED 0x04
335#define C6DOFIMU11_BUF_CTRL_3_BUF_MZ_DISABLED 0x00
336#define C6DOFIMU11_BUF_CTRL_3_BUF_MZ_ENABLED 0x02
337#define C6DOFIMU11_BUF_CTRL_3_BUF_TEMP_DISABLED 0x00
338#define C6DOFIMU11_BUF_CTRL_3_BUF_TEMP_ENABLED 0x01
339#define C6DOFIMU11_BUF_STATUS_2_BUF_TRIG 0x02
340#define C6DOFIMU11_BUF_STATUS_2_SMP_LEV_H 0x01
341#define C6DOFIMU11_WHO_AM_I_WIA_MASK 0xFF
342#define C6DOFIMU11_INS1_INT_MASK 0x80
343#define C6DOFIMU11_INS1_BFI_MASK 0x40
344#define C6DOFIMU11_INS1_WMI_MASK 0x20
345#define C6DOFIMU11_INS1_DRDY_A_MASK 0x10
346#define C6DOFIMU11_INS1_DRDY_M_MASK 0x08
347#define C6DOFIMU11_INS1_FFI_MASK 0x04
348#define C6DOFIMU11_INS1_AMI_MASK 0x02
349
350#define C6DOFIMU11_INS1_MMI_MASK 0x01
351#define C6DOFIMU11_INC3_IED2_MASK 0x80
352#define C6DOFIMU11_INC3_IEA2_MASK 0x40
353#define C6DOFIMU11_INC3_IEL2_MASK 0x30
354#define C6DOFIMU11_INC3_IED1_MASK 0x08
355#define C6DOFIMU11_INC3_IEA1_MASK 0x04
356#define C6DOFIMU11_INC3_IEL1_MASK 0x03
357
358#define C6DOFIMU11_AMI_CNTL3_AMI_EN_MASK 0x80
359#define C6DOFIMU11_AMI_CNTL3_OAMI_MASK 0x07
360
361#define C6DOFIMU11_MMI_CNTL3_MMI_EN_MASK 0x80
362#define C6DOFIMU11_MMI_CNTL3_OMMI_MASK 0x07
363
364#define C6DOFIMU11_FFI_CNTL3_FFI_EN_MASK 0x80
365#define C6DOFIMU11_FFI_CNTL3_OFFI_MASK 0x07
366
367#define C6DOFIMU11_ODCNTL_OSA_MASK 0x0F
368
369#define C6DOFIMU11_ODCNTL_OSM_MASK 0xF0
370#define C6DOFIMU11_CNTL1_STEN_MASK 0x40
371#define C6DOFIMU11_CNTL2_TEMP_EN_MASK 0x40
372
373#define C6DOFIMU11_CNTL2_GSEL_MASK 0x30
374#define C6DOFIMU11_CNTL2_RES_MASK 0x0C
375#define C6DOFIMU11_CNTL2_MAG_EN_MASK 0x02
376#define C6DOFIMU11_CNTL2_ACCEL_EN_MASK 0x01
377#define C6DOFIMU11_COTR_TEST_RESP_MASK 0xFF
378#define C6DOFIMU11_BUF_CTRL_1_SMT_TH_MASK 0xFF
379#define C6DOFIMU11_BUF_CTRL_2_BUF_M_MASK 0x06
386#define C6DOFIMU11_BUF_CTRL_3_BFI_EN_MASK 0x80
387#define C6DOFIMU11_BUF_CTRL_3_BUF_AX_MASK 0x40
388#define C6DOFIMU11_BUF_CTRL_3_BUF_AY_MASK 0x20
389#define C6DOFIMU11_BUF_CTRL_3_BUF_AZ_MASK 0x10
390#define C6DOFIMU11_BUF_CTRL_3_BUF_MX_MASK 0x08
391#define C6DOFIMU11_BUF_CTRL_3_BUF_MY_MASK 0x04
392#define C6DOFIMU11_BUF_CTRL_3_BUF_MZ_MASK 0x02
393#define C6DOFIMU11_BUF_CTRL_3_BUF_TEMP_MASK 0x01
394#define C6DOFIMU11_BUF_STATUS_1_SMP_LEV_MASK 0xFF
395#define C6DOFIMU11_BUF_STATUS_2_SMP_PAST_MASK 0xFF
396#define C6DOFIMU11_BUF_STATUS_3_SMP_PAST_H_MASK 0xFF
397
398#define C6DOFIMU11_CHECK_ID_ERROR 0x00
399#define C6DOFIMU11_CHECK_ID_SUCCESS 0x01
400
401#define C6DOFIMU11_ACCEL_COEF_RES_8G 0.00183111052
402#define C6DOFIMU11_ACCEL_COEF_RES_16G 0.00732444210
403#define C6DOFIMU11_ACCEL_COEF_RES_32G 0.02929776840
404#define C6DOFIMU11_ACCEL_COEF_RES_64G 0.11255815032
405#define C6DOFIMU11_MAG_COEF 0.03662221137
408 // End group macro
409// --------------------------------------------------------------- PUBLIC TYPES
420typedef struct
421{
422 // Output pins
423
424 digital_out_t gp1;
425
426 // Input pins
427
428 digital_in_t gp2;
429
430 // Modules
431
432 i2c_master_t i2c;
433
434 // ctx variable
435
437
439
443typedef struct
444{
445 // Communication gpio pins
446
447 pin_name_t scl;
448 pin_name_t sda;
449
450 // Additional gpio pins
451
452 pin_name_t gp1;
453 pin_name_t gp2;
454
455 // static variable
456
457 uint32_t i2c_speed;
458 uint8_t i2c_address;
459
461
465typedef struct
466{
467 float x;
468 float y;
469 float z;
470}
472
476typedef struct
477{
478 float x;
479 float y;
480 float z;
481}
483
484// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
485
491#ifdef __cplusplus
492extern "C"{
493#endif
494
504
514
523
534void c6dofimu11_generic_write ( c6dofimu11_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
535
546void c6dofimu11_generic_read ( c6dofimu11_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
547
557void c6dofimu11_write_byte ( c6dofimu11_t *ctx, uint8_t reg_address, uint8_t write_data );
558
567uint8_t c6dofimu11_read_byte ( c6dofimu11_t *ctx, uint8_t reg_address );
568
579void c6dofimu11_write_multiple_bytes ( c6dofimu11_t *ctx, uint8_t reg_address, uint8_t *p_write_data, uint8_t n_bytes );
580
591void c6dofimu11_read_multiple_bytes ( c6dofimu11_t *ctx, uint8_t reg_address, uint8_t *p_read_data, uint8_t n_bytes );
592
601
610
621void c6dofimu11_enable_sensor ( c6dofimu11_t *ctx, uint8_t en_accel, uint8_t en_mag, uint8_t en_temp );
622
633void c6dofimu11_config_accel ( c6dofimu11_t *ctx, uint8_t data_rate, uint8_t data_range, uint8_t data_resolution );
634
635
645void c6dofimu11_config_mag ( c6dofimu11_t *ctx, uint8_t data_rate, uint8_t data_resolution );
646
655int16_t c6dofimu11_get_axis ( c6dofimu11_t *ctx, uint8_t reg_add_lsb );
656
667void c6dofimu11_get_accel_data ( c6dofimu11_t *ctx, int16_t *accel_x, int16_t *accel_y, int16_t *accel_z );
668
679void c6dofimu11_get_mag_data ( c6dofimu11_t *ctx, int16_t *mag_x, int16_t *mag_y, int16_t *mag_z );
680
690
691
701
710
719
728
729
730#ifdef __cplusplus
731}
732#endif
733#endif // _C6DOFIMU11_H_
734
735 // End public_function group
737
738// ------------------------------------------------------------------------- END
#define C6DOFIMU11_RETVAL
Definition c6dofimu11.h:77
uint8_t c6dofimu11_get_interrupt(c6dofimu11_t *ctx)
Get interrupt.
uint8_t c6dofimu11_read_byte(c6dofimu11_t *ctx, uint8_t reg_address)
This function read byte.
void c6dofimu11_read_multiple_bytes(c6dofimu11_t *ctx, uint8_t reg_address, uint8_t *p_read_data, uint8_t n_bytes)
This function read multiple bytes.
void c6dofimu11_disable_sensor(c6dofimu11_t *ctx)
Disable sensor.
void c6dofimu11_read_accel(c6dofimu11_t *ctx, c6dofimu11_accel_t *accel_data)
Read accel.
void c6dofimu11_write_multiple_bytes(c6dofimu11_t *ctx, uint8_t reg_address, uint8_t *p_write_data, uint8_t n_bytes)
This function write multiple bytes.
int16_t c6dofimu11_get_axis(c6dofimu11_t *ctx, uint8_t reg_add_lsb)
Get axis.
void c6dofimu11_cfg_setup(c6dofimu11_cfg_t *cfg)
Config Object Initialization function.
float c6dofimu11_get_temperature(c6dofimu11_t *ctx)
Get temperature.
void c6dofimu11_default_cfg(c6dofimu11_t *ctx)
Click Default Configuration function.
void c6dofimu11_generic_write(c6dofimu11_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
void c6dofimu11_write_byte(c6dofimu11_t *ctx, uint8_t reg_address, uint8_t write_data)
This function write byte.
void c6dofimu11_get_mag_data(c6dofimu11_t *ctx, int16_t *mag_x, int16_t *mag_y, int16_t *mag_z)
Get map data.
uint8_t c6dofimu11_check_id(c6dofimu11_t *ctx)
This function check id.
void c6dofimu11_config_accel(c6dofimu11_t *ctx, uint8_t data_rate, uint8_t data_range, uint8_t data_resolution)
Configuration accel.
void c6dofimu11_generic_read(c6dofimu11_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
void c6dofimu11_get_accel_data(c6dofimu11_t *ctx, int16_t *accel_x, int16_t *accel_y, int16_t *accel_z)
Get accel data.
void c6dofimu11_enable_sensor(c6dofimu11_t *ctx, uint8_t en_accel, uint8_t en_mag, uint8_t en_temp)
Enable sensor.
void c6dofimu11_enable_temperature_data(c6dofimu11_t *ctx)
Enable temperature data.
void c6dofimu11_config_mag(c6dofimu11_t *ctx, uint8_t data_rate, uint8_t data_resolution)
Configuration map.
void c6dofimu11_read_mag(c6dofimu11_t *ctx, c6dofimu11_mag_t *mag_data)
Read mag.
C6DOFIMU11_RETVAL c6dofimu11_init(c6dofimu11_t *ctx, c6dofimu11_cfg_t *cfg)
Initialization function.
Accel axis structure definition.
Definition c6dofimu11.h:466
float y
Definition c6dofimu11.h:468
float x
Definition c6dofimu11.h:467
float z
Definition c6dofimu11.h:469
Click configuration structure definition.
Definition c6dofimu11.h:444
pin_name_t gp2
Definition c6dofimu11.h:453
uint32_t i2c_speed
Definition c6dofimu11.h:457
pin_name_t scl
Definition c6dofimu11.h:447
pin_name_t gp1
Definition c6dofimu11.h:452
pin_name_t sda
Definition c6dofimu11.h:448
uint8_t i2c_address
Definition c6dofimu11.h:458
Mag axis structure definition.
Definition c6dofimu11.h:477
float y
Definition c6dofimu11.h:479
float x
Definition c6dofimu11.h:478
float z
Definition c6dofimu11.h:480
Click ctx object definition.
Definition c6dofimu11.h:421
digital_in_t gp2
Definition c6dofimu11.h:428
i2c_master_t i2c
Definition c6dofimu11.h:432
digital_out_t gp1
Definition c6dofimu11.h:424
uint8_t slave_address
Definition c6dofimu11.h:436