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
38#include "drv_digital_out.h"
39#include "drv_digital_in.h"
40#include "drv_i2c_master.h"
41
42// -------------------------------------------------------------- PUBLIC MACROS
52#define C6DOFIMU11_MAP_MIKROBUS( cfg, mikrobus ) \
53 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
54 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
55 cfg.gp1 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
56 cfg.gp2 = MIKROBUS( mikrobus, MIKROBUS_INT )
63#define C6DOFIMU11_RETVAL uint8_t
64
65#define C6DOFIMU11_OK 0x00
66#define C6DOFIMU11_INIT_ERROR 0xFF
73#define C6DOFIMU11_I2C_SLAVE_ADDRESS_GND 0x0E
74#define C6DOFIMU11_I2C_SLAVE_ADDRESS_VCC 0x0F
75
82#define C6DOFIMU11_WHO_AM_I 0x00
83#define C6DOFIMU11_INS1 0x01
84#define C6DOFIMU11_INS2 0x02
85#define C6DOFIMU11_INS3 0x03
86#define C6DOFIMU11_INL 0x05
87#define C6DOFIMU11_ACCEL_XOUT_L 0x0A
88#define C6DOFIMU11_ACCEL_XOUT_H 0x0B
89#define C6DOFIMU11_ACCEL_YOUT_L 0x0C
90#define C6DOFIMU11_ACCEL_YOUT_H 0x0D
91#define C6DOFIMU11_ACCEL_ZOUT_L 0x0E
92#define C6DOFIMU11_ACCEL_ZOUT_H 0x0F
93#define C6DOFIMU11_MAG_XOUT_L 0x10
94#define C6DOFIMU11_MAG_XOUT_H 0x11
95#define C6DOFIMU11_MAG_YOUT_L 0x12
96#define C6DOFIMU11_MAG_YOUT_H 0x13
97#define C6DOFIMU11_MAG_ZOUT_L 0x14
98#define C6DOFIMU11_MAG_ZOUT_H 0x15
99#define C6DOFIMU11_TEMP_OUT_L 0x16
100#define C6DOFIMU11_TEMP_OUT_H 0x17
101#define C6DOFIMU11_INC1 0x2A
102#define C6DOFIMU11_INC2 0x2B
103#define C6DOFIMU11_INC3 0x2C
104#define C6DOFIMU11_INC4 0x2D
105#define C6DOFIMU11_INC5 0x2E
106#define C6DOFIMU11_AMI_CNTL1 0x2F
107#define C6DOFIMU11_AMI_CNTL2 0x30
108#define C6DOFIMU11_AMI_CNTL3 0x31
109#define C6DOFIMU11_MMI_CNTL1 0x32
110#define C6DOFIMU11_MMI_CNTL2 0x33
111#define C6DOFIMU11_MMI_CNTL3 0x34
112#define C6DOFIMU11_FFI_CNTL1 0x35
113#define C6DOFIMU11_FFI_CNTL2 0x36
114#define C6DOFIMU11_FFI_CNTL3 0x37
115#define C6DOFIMU11_ODCNTL 0x38
116#define C6DOFIMU11_CNTL1 0x39
117#define C6DOFIMU11_CNTL2 0x3A
118#define C6DOFIMU11_COTR 0x3C
119#define C6DOFIMU11_BUF_CTRL_1 0x77
120#define C6DOFIMU11_BUF_CTRL_2 0x78
121#define C6DOFIMU11_BUF_CTRL_3 0x79
122#define C6DOFIMU11_BUF_CLEAR 0x7A
123#define C6DOFIMU11_BUF_STATUS_1 0x7B
124#define C6DOFIMU11_BUF_STATUS_2 0x7C
125#define C6DOFIMU11_BUF_STATUS_3 0x7D
126#define C6DOFIMU11_BUF_READ 0x7E
127
134#define C6DOFIMU11_WHO_AM_I_WIA_ID 0x2D
135#define C6DOFIMU11_INS1_INT_NO_INT 0x00
136#define C6DOFIMU11_INS1_INT_INT 0x80
137#define C6DOFIMU11_INS1_BFI_BUFF_NOT_FULL 0x00
138#define C6DOFIMU11_INS1_BFI_BUFF_FULL 0x40
139#define C6DOFIMU11_INS1_WMI_MARK_NOT_REACHED 0x00
140#define C6DOFIMU11_INS1_WMI_MARK_REACHED 0x20
141#define C6DOFIMU11_INS1_DRDY_A_NOT_AVAILABLE 0x00
142#define C6DOFIMU11_INS1_DRDY_A_AVAILABLE 0x10
143#define C6DOFIMU11_INS1_DRDY_M_NOT_AVAILABLE 0x00
144#define C6DOFIMU11_INS1_DRDY_M_AVAILABLE 0x08
145#define C6DOFIMU11_INS1_FFI_NO_FFI 0x00
146#define C6DOFIMU11_INS1_FFI_FFI 0x04
147#define C6DOFIMU11_INS1_AMI_NO_MOTION 0x00
148#define C6DOFIMU11_INS1_AMI_MOTION 0x02
149#define C6DOFIMU11_INS1_MMI_NO_MOTION 0x00
150#define C6DOFIMU11_INS1_MMI_MOTION 0x01
151#define C6DOFIMU11_INS2_AXNI 0x20
152#define C6DOFIMU11_INS2_AXPI 0x10
153#define C6DOFIMU11_INS2_AYNI 0x08
154#define C6DOFIMU11_INS2_AYPI 0x04
155#define C6DOFIMU11_INS2_AZNI 0x02
156#define C6DOFIMU11_INS2_AZPI 0x01
157#define C6DOFIMU11_INS3_MXNI 0x20
158#define C6DOFIMU11_INS3_MXPI 0x10
159#define C6DOFIMU11_INS3_MYNI 0x08
160#define C6DOFIMU11_INS3_MYPI 0x04
161#define C6DOFIMU11_INS3_MZNI 0x02
162#define C6DOFIMU11_INS3_MZPI 0x01
163#define C6DOFIMU11_INC1_BFI1 0x40
164#define C6DOFIMU11_INC1_WMI1 0x20
165#define C6DOFIMU11_INC1_DRDY_A1 0x10
166#define C6DOFIMU11_INC1_DRDY_M1 0x08
167#define C6DOFIMU11_INC1_FFI1 0x04
168#define C6DOFIMU11_INC1_AMI1 0x02
169#define C6DOFIMU11_INC1_MMI1 0x01
170#define C6DOFIMU11_INC2_BFI2 0x40
171#define C6DOFIMU11_INC2_WMI2 0x20
172#define C6DOFIMU11_INC2_DRDY_A2 0x10
173#define C6DOFIMU11_INC2_DRDY_M2 0x08
174#define C6DOFIMU11_INC2_FFI2 0x04
175#define C6DOFIMU11_INC2_AMI2 0x02
176#define C6DOFIMU11_INC2_MMI2 0x01
177#define C6DOFIMU11_INC3_IED2_PUSHPULL 0x00
178#define C6DOFIMU11_INC3_IED2_OPENDRAIN 0x80
179#define C6DOFIMU11_INC3_IEA2_LOW 0x00
180#define C6DOFIMU11_INC3_IEA2_HIGH 0x40
181#define C6DOFIMU11_INC3_IEL2_LATCHED 0x00
182#define C6DOFIMU11_INC3_IEL2_PULSED 0x10
183#define C6DOFIMU11_INC3_IEL2_FIFO_TRIG 0x20
184#define C6DOFIMU11_INC3_IEL2_FIFO_TRIG_2 0x30
185#define C6DOFIMU11_INC3_IED1_PUSHPULL 0x00
186#define C6DOFIMU11_INC3_IED1_OPENDRAIN 0x08
187#define C6DOFIMU11_INC3_IEA1_LOW 0x00
188#define C6DOFIMU11_INC3_IEA1_HIGH 0x04
189#define C6DOFIMU11_INC3_IEL1_LATCHED 0x00
190#define C6DOFIMU11_INC3_IEL1_PULSED 0x01
191#define C6DOFIMU11_INC3_IEL1_FIFO_TRIG 0x02
192#define C6DOFIMU11_INC3_IEL1_FIFO_TRIG_2 0x03
193#define C6DOFIMU11_INC4_AXNIE 0x20
194#define C6DOFIMU11_INC4_AXPIE 0x10
195#define C6DOFIMU11_INC4_AYNIE 0x08
196#define C6DOFIMU11_INC4_AYPIE 0x04
197#define C6DOFIMU11_INC4_AZNIE 0x02
198#define C6DOFIMU11_INC4_AZPIE 0x01
199#define C6DOFIMU11_INC5_MXNIE 0x20
200#define C6DOFIMU11_INC5_MXPIE 0x10
201#define C6DOFIMU11_INC5_MYNIE 0x08
202#define C6DOFIMU11_INC5_MYPIE 0x04
203#define C6DOFIMU11_INC5_MZNIE 0x02
204#define C6DOFIMU11_INC5_MZPIE 0x01
205#define C6DOFIMU11_AMI_CNTL3_AMI_EN_DISABLED 0x00
206#define C6DOFIMU11_AMI_CNTL3_AMI_EN_ENABLED 0x80
207#define C6DOFIMU11_AMI_CNTL3_AMIUL 0x40
208#define C6DOFIMU11_AMI_CNTL3_OAMI_0P781 0x00
209#define C6DOFIMU11_AMI_CNTL3_OAMI_1P563 0x01
210#define C6DOFIMU11_AMI_CNTL3_OAMI_3P125 0x02
211#define C6DOFIMU11_AMI_CNTL3_OAMI_6P25 0x03
212#define C6DOFIMU11_AMI_CNTL3_OAMI_12P5 0x04
213#define C6DOFIMU11_AMI_CNTL3_OAMI_25 0x05
214#define C6DOFIMU11_AMI_CNTL3_OAMI_50 0x06
215#define C6DOFIMU11_AMI_CNTL3_OAMI_100 0x07
216#define C6DOFIMU11_MMI_CNTL3_MMI_EN_DISABLED 0x00
217#define C6DOFIMU11_MMI_CNTL3_MMI_EN_ENABLED 0x80
218#define C6DOFIMU11_MMI_CNTL3_MMIUL 0x40
219#define C6DOFIMU11_MMI_CNTL3_OMMI_0P781 0x00
220#define C6DOFIMU11_MMI_CNTL3_OMMI_1P563 0x01
221#define C6DOFIMU11_MMI_CNTL3_OMMI_3P125 0x02
222#define C6DOFIMU11_MMI_CNTL3_OMMI_6P25 0x03
223#define C6DOFIMU11_MMI_CNTL3_OMMI_12P5 0x04
224#define C6DOFIMU11_MMI_CNTL3_OMMI_25 0x05
225#define C6DOFIMU11_MMI_CNTL3_OMMI_50 0x06
226#define C6DOFIMU11_MMI_CNTL3_OMMI_100 0x07
227#define C6DOFIMU11_FFI_CNTL3_FFI_EN_DISABLED 0x00
228#define C6DOFIMU11_FFI_CNTL3_FFI_EN_ENABLED 0x80
229#define C6DOFIMU11_FFI_CNTL3_FFIUL 0x40
230#define C6DOFIMU11_FFI_CNTL3_DCRM 0x08
231#define C6DOFIMU11_FFI_CNTL3_OFFI_12P5 0x00
232#define C6DOFIMU11_FFI_CNTL3_OFFI_25 0x01
233#define C6DOFIMU11_FFI_CNTL3_OFFI_50 0x02
234#define C6DOFIMU11_FFI_CNTL3_OFFI_100 0x03
235#define C6DOFIMU11_FFI_CNTL3_OFFI_200 0x04
236#define C6DOFIMU11_FFI_CNTL3_OFFI_400 0x05
237#define C6DOFIMU11_FFI_CNTL3_OFFI_800 0x06
238#define C6DOFIMU11_FFI_CNTL3_OFFI_1600 0x07
239#define C6DOFIMU11_ODCNTL_OSA_12P5 0x00
240#define C6DOFIMU11_ODCNTL_OSA_25 0x01
241#define C6DOFIMU11_ODCNTL_OSA_50 0x02
242#define C6DOFIMU11_ODCNTL_OSA_100 0x03
243#define C6DOFIMU11_ODCNTL_OSA_200 0x04
244#define C6DOFIMU11_ODCNTL_OSA_400 0x05
245#define C6DOFIMU11_ODCNTL_OSA_800 0x06
246#define C6DOFIMU11_ODCNTL_OSA_1600 0x07
247#define C6DOFIMU11_ODCNTL_OSA_0P781 0x08
248#define C6DOFIMU11_ODCNTL_OSA_1P563 0x09
249#define C6DOFIMU11_ODCNTL_OSA_3P125 0x0A
250#define C6DOFIMU11_ODCNTL_OSA_6P25 0x0B
251#define C6DOFIMU11_ODCNTL_OSA_25600ST0P8 0x0C
252#define C6DOFIMU11_ODCNTL_OSA_25600ST1P6 0x0D
253#define C6DOFIMU11_ODCNTL_OSA_25600ST3P2 0x0E
254#define C6DOFIMU11_ODCNTL_OSA_25600 0x0F
255#define C6DOFIMU11_ODCNTL_OSM_12P5 0x00
256#define C6DOFIMU11_ODCNTL_OSM_25 0x10
257#define C6DOFIMU11_ODCNTL_OSM_50 0x20
258#define C6DOFIMU11_ODCNTL_OSM_100 0x30
259#define C6DOFIMU11_ODCNTL_OSM_200 0x40
260#define C6DOFIMU11_ODCNTL_OSM_400 0x50
261#define C6DOFIMU11_ODCNTL_OSM_800 0x60
262#define C6DOFIMU11_ODCNTL_OSM_1600 0x70
263#define C6DOFIMU11_ODCNTL_OSM_0P781 0x80
264#define C6DOFIMU11_ODCNTL_OSM_1P563 0x90
265#define C6DOFIMU11_ODCNTL_OSM_3P125 0xA0
266#define C6DOFIMU11_ODCNTL_OSM_6P25 0xB0
267#define C6DOFIMU11_ODCNTL_OSM_12800A 0xC0
268#define C6DOFIMU11_ODCNTL_OSM_12800B 0xD0
269#define C6DOFIMU11_ODCNTL_OSM_12800C 0xE0
270#define C6DOFIMU11_ODCNTL_OSM_12800 0xF0
271#define C6DOFIMU11_CNTL1_SRST 0x80
272#define C6DOFIMU11_CNTL1_STEN_DISABLED 0x00
273#define C6DOFIMU11_CNTL1_STEN_ENABLED 0x40
274#define C6DOFIMU11_CNTL1_STPOL 0x20
275#define C6DOFIMU11_CNTL1_COTC 0x08
282#define C6DOFIMU11_CNTL2_TEMP_EN_STANDBY_MODE 0x00
283#define C6DOFIMU11_CNTL2_TEMPERATURE_DISABLE 0x00
284#define C6DOFIMU11_CNTL2_TEMPERATURE_ENABLE 0x01
285#define C6DOFIMU11_CNTL2_TEMP_EN_OPERATING_MODE 0x40
286#define C6DOFIMU11_CNTL2_GSEL_8G 0x00
287#define C6DOFIMU11_CNTL2_GSEL_16G 0x10
288#define C6DOFIMU11_CNTL2_GSEL_32G 0x20
289#define C6DOFIMU11_CNTL2_GSEL_64G 0x30
290#define C6DOFIMU11_CNTL2_RES_A4M2 0x00
291#define C6DOFIMU11_CNTL2_RES_A32M16 0x04
292#define C6DOFIMU11_CNTL2_RES_MAX1 0x08
293#define C6DOFIMU11_CNTL2_RES_MAX2 0x0C
294#define C6DOFIMU11_CNTL2_MAG_DISABLE 0x00
295#define C6DOFIMU11_CNTL2_MAG_ENABLE 0x01
296#define C6DOFIMU11_CNTL2_MAG_EN_STANDBY_MODE 0x00
297#define C6DOFIMU11_CNTL2_MAG_EN_OPERATING_MODE 0x02
298#define C6DOFIMU11_CNTL2_ACCEL_EN_STANDBY_MODE 0x00
299#define C6DOFIMU11_CNTL2_ACCEL_EN_OPERATING_MODE 0x01
300#define C6DOFIMU11_CNTL2_ACCEL_DISABLE 0x00
301#define C6DOFIMU11_CNTL2_ACCEL_ENABLE 0x01
302#define C6DOFIMU11_COTR_TEST_RESP_DEFAULT 0x55
303#define C6DOFIMU11_COTR_TEST_RESP_TEST 0xAA
304#define C6DOFIMU11_BUF_CTRL_2_BUF_M_FIFO 0x00
305#define C6DOFIMU11_BUF_CTRL_2_BUF_M_STREAM 0x02
306#define C6DOFIMU11_BUF_CTRL_2_BUF_M_TRIGGER 0x04
307#define C6DOFIMU11_BUF_CTRL_2_BUF_M_FILO 0x03
308#define C6DOFIMU11_BUF_CTRL_2_SMT_TH8 0x01
309#define C6DOFIMU11_BUF_CTRL_3_BFI_EN_DISABLED 0x00
310#define C6DOFIMU11_BUF_CTRL_3_BFI_EN_ENABLED 0x80
311#define C6DOFIMU11_BUF_CTRL_3_BUF_AX_DISABLED 0x00
312#define C6DOFIMU11_BUF_CTRL_3_BUF_AX_ENABLED 0x40
313#define C6DOFIMU11_BUF_CTRL_3_BUF_AY_DISABLED 0x00
314#define C6DOFIMU11_BUF_CTRL_3_BUF_AY_ENABLED 0x20
315#define C6DOFIMU11_BUF_CTRL_3_BUF_AZ_DISABLED 0x00
316#define C6DOFIMU11_BUF_CTRL_3_BUF_AZ_ENABLED 0x10
317#define C6DOFIMU11_BUF_CTRL_3_BUF_MX_DISABLED 0x00
318#define C6DOFIMU11_BUF_CTRL_3_BUF_MX_ENABLED 0x08
319#define C6DOFIMU11_BUF_CTRL_3_BUF_MY_DISABLED 0x00
320#define C6DOFIMU11_BUF_CTRL_3_BUF_MY_ENABLED 0x04
321#define C6DOFIMU11_BUF_CTRL_3_BUF_MZ_DISABLED 0x00
322#define C6DOFIMU11_BUF_CTRL_3_BUF_MZ_ENABLED 0x02
323#define C6DOFIMU11_BUF_CTRL_3_BUF_TEMP_DISABLED 0x00
324#define C6DOFIMU11_BUF_CTRL_3_BUF_TEMP_ENABLED 0x01
325#define C6DOFIMU11_BUF_STATUS_2_BUF_TRIG 0x02
326#define C6DOFIMU11_BUF_STATUS_2_SMP_LEV_H 0x01
327#define C6DOFIMU11_WHO_AM_I_WIA_MASK 0xFF
328#define C6DOFIMU11_INS1_INT_MASK 0x80
329#define C6DOFIMU11_INS1_BFI_MASK 0x40
330#define C6DOFIMU11_INS1_WMI_MASK 0x20
331#define C6DOFIMU11_INS1_DRDY_A_MASK 0x10
332#define C6DOFIMU11_INS1_DRDY_M_MASK 0x08
333#define C6DOFIMU11_INS1_FFI_MASK 0x04
334#define C6DOFIMU11_INS1_AMI_MASK 0x02
335
336#define C6DOFIMU11_INS1_MMI_MASK 0x01
337#define C6DOFIMU11_INC3_IED2_MASK 0x80
338#define C6DOFIMU11_INC3_IEA2_MASK 0x40
339#define C6DOFIMU11_INC3_IEL2_MASK 0x30
340#define C6DOFIMU11_INC3_IED1_MASK 0x08
341#define C6DOFIMU11_INC3_IEA1_MASK 0x04
342#define C6DOFIMU11_INC3_IEL1_MASK 0x03
343
344#define C6DOFIMU11_AMI_CNTL3_AMI_EN_MASK 0x80
345#define C6DOFIMU11_AMI_CNTL3_OAMI_MASK 0x07
346
347#define C6DOFIMU11_MMI_CNTL3_MMI_EN_MASK 0x80
348#define C6DOFIMU11_MMI_CNTL3_OMMI_MASK 0x07
349
350#define C6DOFIMU11_FFI_CNTL3_FFI_EN_MASK 0x80
351#define C6DOFIMU11_FFI_CNTL3_OFFI_MASK 0x07
352
353#define C6DOFIMU11_ODCNTL_OSA_MASK 0x0F
354
355#define C6DOFIMU11_ODCNTL_OSM_MASK 0xF0
356#define C6DOFIMU11_CNTL1_STEN_MASK 0x40
357#define C6DOFIMU11_CNTL2_TEMP_EN_MASK 0x40
358
359#define C6DOFIMU11_CNTL2_GSEL_MASK 0x30
360#define C6DOFIMU11_CNTL2_RES_MASK 0x0C
361#define C6DOFIMU11_CNTL2_MAG_EN_MASK 0x02
362#define C6DOFIMU11_CNTL2_ACCEL_EN_MASK 0x01
363#define C6DOFIMU11_COTR_TEST_RESP_MASK 0xFF
364#define C6DOFIMU11_BUF_CTRL_1_SMT_TH_MASK 0xFF
365#define C6DOFIMU11_BUF_CTRL_2_BUF_M_MASK 0x06
372#define C6DOFIMU11_BUF_CTRL_3_BFI_EN_MASK 0x80
373#define C6DOFIMU11_BUF_CTRL_3_BUF_AX_MASK 0x40
374#define C6DOFIMU11_BUF_CTRL_3_BUF_AY_MASK 0x20
375#define C6DOFIMU11_BUF_CTRL_3_BUF_AZ_MASK 0x10
376#define C6DOFIMU11_BUF_CTRL_3_BUF_MX_MASK 0x08
377#define C6DOFIMU11_BUF_CTRL_3_BUF_MY_MASK 0x04
378#define C6DOFIMU11_BUF_CTRL_3_BUF_MZ_MASK 0x02
379#define C6DOFIMU11_BUF_CTRL_3_BUF_TEMP_MASK 0x01
380#define C6DOFIMU11_BUF_STATUS_1_SMP_LEV_MASK 0xFF
381#define C6DOFIMU11_BUF_STATUS_2_SMP_PAST_MASK 0xFF
382#define C6DOFIMU11_BUF_STATUS_3_SMP_PAST_H_MASK 0xFF
383
384#define C6DOFIMU11_CHECK_ID_ERROR 0x00
385#define C6DOFIMU11_CHECK_ID_SUCCESS 0x01
386
387#define C6DOFIMU11_ACCEL_COEF_RES_8G 0.00183111052
388#define C6DOFIMU11_ACCEL_COEF_RES_16G 0.00732444210
389#define C6DOFIMU11_ACCEL_COEF_RES_32G 0.02929776840
390#define C6DOFIMU11_ACCEL_COEF_RES_64G 0.11255815032
391#define C6DOFIMU11_MAG_COEF 0.03662221137 // End group macro
395// --------------------------------------------------------------- PUBLIC TYPES
406typedef struct
407{
408 // Output pins
409
410 digital_out_t gp1;
411
412 // Input pins
413
414 digital_in_t gp2;
415
416 // Modules
417
418 i2c_master_t i2c;
419
420 // ctx variable
421
423
425
429typedef struct
430{
431 // Communication gpio pins
432
433 pin_name_t scl;
434 pin_name_t sda;
435
436 // Additional gpio pins
437
438 pin_name_t gp1;
439 pin_name_t gp2;
440
441 // static variable
442
443 uint32_t i2c_speed;
444 uint8_t i2c_address;
445
447
451typedef struct
452{
453 float x;
454 float y;
455 float z;
456}
458
462typedef struct
463{
464 float x;
465 float y;
466 float z;
467}
469
470// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
471
477#ifdef __cplusplus
478extern "C"{
479#endif
480
490
500
509
520void c6dofimu11_generic_write ( c6dofimu11_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
521
532void c6dofimu11_generic_read ( c6dofimu11_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
533
543void c6dofimu11_write_byte ( c6dofimu11_t *ctx, uint8_t reg_address, uint8_t write_data );
544
553uint8_t c6dofimu11_read_byte ( c6dofimu11_t *ctx, uint8_t reg_address );
554
565void c6dofimu11_write_multiple_bytes ( c6dofimu11_t *ctx, uint8_t reg_address, uint8_t *p_write_data, uint8_t n_bytes );
566
577void c6dofimu11_read_multiple_bytes ( c6dofimu11_t *ctx, uint8_t reg_address, uint8_t *p_read_data, uint8_t n_bytes );
578
587
596
607void c6dofimu11_enable_sensor ( c6dofimu11_t *ctx, uint8_t en_accel, uint8_t en_mag, uint8_t en_temp );
608
619void c6dofimu11_config_accel ( c6dofimu11_t *ctx, uint8_t data_rate, uint8_t data_range, uint8_t data_resolution );
620
621
631void c6dofimu11_config_mag ( c6dofimu11_t *ctx, uint8_t data_rate, uint8_t data_resolution );
632
641int16_t c6dofimu11_get_axis ( c6dofimu11_t *ctx, uint8_t reg_add_lsb );
642
653void c6dofimu11_get_accel_data ( c6dofimu11_t *ctx, int16_t *accel_x, int16_t *accel_y, int16_t *accel_z );
654
665void c6dofimu11_get_mag_data ( c6dofimu11_t *ctx, int16_t *mag_x, int16_t *mag_y, int16_t *mag_z );
666
676
677
687
696
705
714
715
716#ifdef __cplusplus
717}
718#endif
719#endif // _C6DOFIMU11_H_
720 // End public_function group
723
724// ------------------------------------------------------------------------- END
#define C6DOFIMU11_RETVAL
Definition: c6dofimu11.h:63
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:452
float y
Definition: c6dofimu11.h:454
float x
Definition: c6dofimu11.h:453
float z
Definition: c6dofimu11.h:455
Click configuration structure definition.
Definition: c6dofimu11.h:430
pin_name_t gp2
Definition: c6dofimu11.h:439
uint32_t i2c_speed
Definition: c6dofimu11.h:443
pin_name_t scl
Definition: c6dofimu11.h:433
pin_name_t gp1
Definition: c6dofimu11.h:438
pin_name_t sda
Definition: c6dofimu11.h:434
uint8_t i2c_address
Definition: c6dofimu11.h:444
Mag axis structure definition.
Definition: c6dofimu11.h:463
float y
Definition: c6dofimu11.h:465
float x
Definition: c6dofimu11.h:464
float z
Definition: c6dofimu11.h:466
Click ctx object definition.
Definition: c6dofimu11.h:407
digital_in_t gp2
Definition: c6dofimu11.h:414
i2c_master_t i2c
Definition: c6dofimu11.h:418
digital_out_t gp1
Definition: c6dofimu11.h:410
uint8_t slave_address
Definition: c6dofimu11.h:422