c6dofimu22  2.1.0.0
c6dofimu22.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2020 MikroElektronika d.o.o.
3 ** Contact: https://www.mikroe.com/contact
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining a copy
6 ** of this software and associated documentation files (the "Software"), to deal
7 ** in the Software without restriction, including without limitation the rights
8 ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 ** copies of the Software, and to permit persons to whom the Software is
10 ** furnished to do so, subject to the following conditions:
11 ** The above copyright notice and this permission notice shall be
12 ** included in all copies or substantial portions of the Software.
13 **
14 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16 ** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 ** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19 ** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 ** USE OR OTHER DEALINGS IN THE SOFTWARE.
21 ****************************************************************************/
22 
28 #ifndef C6DOFIMU22_H
29 #define C6DOFIMU22_H
30 
31 #ifdef __cplusplus
32 extern "C"{
33 #endif
34 
39 #ifdef PREINIT_SUPPORTED
40 #include "preinit.h"
41 #endif
42 
43 #ifdef MikroCCoreVersion
44  #if MikroCCoreVersion >= 1
45  #include "delays.h"
46  #endif
47 #endif
48 
49 #include "drv_digital_out.h"
50 #include "drv_digital_in.h"
51 #include "drv_i2c_master.h"
52 #include "drv_spi_master.h"
53 #include "spi_specifics.h"
54 
75 #define C6DOFIMU22_REG0_MCLK_RDY 0x00
76 #define C6DOFIMU22_REG0_DEVICE_CONFIG 0x01
77 #define C6DOFIMU22_REG0_SIGNAL_PATH_RESET 0x02
78 #define C6DOFIMU22_REG0_DRIVE_CONFIG1 0x03
79 #define C6DOFIMU22_REG0_DRIVE_CONFIG2 0x04
80 #define C6DOFIMU22_REG0_DRIVE_CONFIG3 0x05
81 #define C6DOFIMU22_REG0_INT_CONFIG 0x06
82 #define C6DOFIMU22_REG0_TEMP_DATA1 0x09
83 #define C6DOFIMU22_REG0_TEMP_DATA0 0x0A
84 #define C6DOFIMU22_REG0_ACCEL_DATA_X1 0x0B
85 #define C6DOFIMU22_REG0_ACCEL_DATA_X0 0x0C
86 #define C6DOFIMU22_REG0_ACCEL_DATA_Y1 0x0D
87 #define C6DOFIMU22_REG0_ACCEL_DATA_Y0 0x0E
88 #define C6DOFIMU22_REG0_ACCEL_DATA_Z1 0x0F
89 #define C6DOFIMU22_REG0_ACCEL_DATA_Z0 0x10
90 #define C6DOFIMU22_REG0_GYRO_DATA_X1 0x11
91 #define C6DOFIMU22_REG0_GYRO_DATA_X0 0x12
92 #define C6DOFIMU22_REG0_GYRO_DATA_Y1 0x13
93 #define C6DOFIMU22_REG0_GYRO_DATA_Y0 0x14
94 #define C6DOFIMU22_REG0_GYRO_DATA_Z1 0x15
95 #define C6DOFIMU22_REG0_GYRO_DATA_Z0 0x16
96 #define C6DOFIMU22_REG0_TMST_FSYNCH 0x17
97 #define C6DOFIMU22_REG0_TMST_FSYNCL 0x18
98 #define C6DOFIMU22_REG0_APEX_DATA4 0x1D
99 #define C6DOFIMU22_REG0_APEX_DATA5 0x1E
100 #define C6DOFIMU22_REG0_PWR_MGMT0 0x1F
101 #define C6DOFIMU22_REG0_GYRO_CONFIG0 0x20
102 #define C6DOFIMU22_REG0_ACCEL_CONFIG0 0x21
103 #define C6DOFIMU22_REG0_TEMP_CONFIG0 0x22
104 #define C6DOFIMU22_REG0_GYRO_CONFIG1 0x23
105 #define C6DOFIMU22_REG0_ACCEL_CONFIG1 0x24
106 #define C6DOFIMU22_REG0_APEX_CONFIG0 0x25
107 #define C6DOFIMU22_REG0_APEX_CONFIG1 0x26
108 #define C6DOFIMU22_REG0_WOM_CONFIG 0x27
109 #define C6DOFIMU22_REG0_FIFO_CONFIG1 0x28
110 #define C6DOFIMU22_REG0_FIFO_CONFIG2 0x29
111 #define C6DOFIMU22_REG0_FIFO_CONFIG3 0x2A
112 #define C6DOFIMU22_REG0_INT_SOURCE0 0x2B
113 #define C6DOFIMU22_REG0_INT_SOURCE1 0x2C
114 #define C6DOFIMU22_REG0_INT_SOURCE3 0x2D
115 #define C6DOFIMU22_REG0_INT_SOURCE4 0x2E
116 #define C6DOFIMU22_REG0_FIFO_LOST_PKT0 0x2F
117 #define C6DOFIMU22_REG0_FIFO_LOST_PKT1 0x30
118 #define C6DOFIMU22_REG0_APEX_DATA0 0x31
119 #define C6DOFIMU22_REG0_APEX_DATA1 0x32
120 #define C6DOFIMU22_REG0_APEX_DATA2 0x33
121 #define C6DOFIMU22_REG0_APEX_DATA3 0x34
122 #define C6DOFIMU22_REG0_INTF_CONFIG0 0x35
123 #define C6DOFIMU22_REG0_INTF_CONFIG1 0x36
124 #define C6DOFIMU22_REG0_INT_STATUS_DRDY 0x39
125 #define C6DOFIMU22_REG0_INT_STATUS 0x3A
126 #define C6DOFIMU22_REG0_INT_STATUS2 0x3B
127 #define C6DOFIMU22_REG0_INT_STATUS3 0x3C
128 #define C6DOFIMU22_REG0_FIFO_COUNTH 0x3D
129 #define C6DOFIMU22_REG0_FIFO_COUNTL 0x3E
130 #define C6DOFIMU22_REG0_FIFO_DATA 0x3F
131 #define C6DOFIMU22_REG0_WHO_AM_I 0x75
132 #define C6DOFIMU22_REG0_BLK_SEL_W 0x79
133 #define C6DOFIMU22_REG0_MADDR_W 0x7A
134 #define C6DOFIMU22_REG0_M_W 0x7B
135 #define C6DOFIMU22_REG0_BLK_SEL_R 0x7C
136 #define C6DOFIMU22_REG0_MADDR_R 0x7D
137 #define C6DOFIMU22_REG0_M_R 0x7E
138 
143 #define C6DOFIMU22_MREG1_TMST_CONFIG1 0x0000
144 #define C6DOFIMU22_MREG1_FIFO_CONFIG5 0x0001
145 #define C6DOFIMU22_MREG1_FIFO_CONFIG6 0x0002
146 #define C6DOFIMU22_MREG1_FSYNC_CONFIG 0x0003
147 #define C6DOFIMU22_MREG1_INT_CONFIG0 0x0004
148 #define C6DOFIMU22_MREG1_INT_CONFIG1 0x0005
149 #define C6DOFIMU22_MREG1_SENSOR_CONFIG3 0x0006
150 #define C6DOFIMU22_MREG1_ST_CONFIG 0x0013
151 #define C6DOFIMU22_MREG1_SELFTEST 0x0014
152 #define C6DOFIMU22_MREG1_INTF_CONFIG6 0x0023
153 #define C6DOFIMU22_MREG1_INTF_CONFIG10 0x0025
154 #define C6DOFIMU22_MREG1_INTF_CONFIG7 0x0028
155 #define C6DOFIMU22_MREG1_OTP_CONFIG 0x002B
156 #define C6DOFIMU22_MREG1_INT_SOURCE6 0x002F
157 #define C6DOFIMU22_MREG1_INT_SOURCE7 0x0030
158 #define C6DOFIMU22_MREG1_INT_SOURCE8 0x0031
159 #define C6DOFIMU22_MREG1_INT_SOURCE9 0x0032
160 #define C6DOFIMU22_MREG1_INT_SOURCE10 0x0033
161 #define C6DOFIMU22_MREG1_APEX_CONFIG2 0x0044
162 #define C6DOFIMU22_MREG1_APEX_CONFIG3 0x0045
163 #define C6DOFIMU22_MREG1_APEX_CONFIG4 0x0046
164 #define C6DOFIMU22_MREG1_APEX_CONFIG5 0x0047
165 #define C6DOFIMU22_MREG1_APEX_CONFIG9 0x0048
166 #define C6DOFIMU22_MREG1_APEX_CONFIG10 0x0049
167 #define C6DOFIMU22_MREG1_APEX_CONFIG11 0x004A
168 #define C6DOFIMU22_MREG1_ACCEL_WOM_X_THR 0x004B
169 #define C6DOFIMU22_MREG1_ACCEL_WOM_Y_THR 0x004C
170 #define C6DOFIMU22_MREG1_ACCEL_WOM_Z_THR 0x004D
171 #define C6DOFIMU22_MREG1_OFFSET_USER0 0x004E
172 #define C6DOFIMU22_MREG1_OFFSET_USER1 0x004F
173 #define C6DOFIMU22_MREG1_OFFSET_USER2 0x0050
174 #define C6DOFIMU22_MREG1_OFFSET_USER3 0x0051
175 #define C6DOFIMU22_MREG1_OFFSET_USER4 0x0052
176 #define C6DOFIMU22_MREG1_OFFSET_USER5 0x0053
177 #define C6DOFIMU22_MREG1_OFFSET_USER6 0x0054
178 #define C6DOFIMU22_MREG1_OFFSET_USER7 0x0055
179 #define C6DOFIMU22_MREG1_OFFSET_USER8 0x0056
180 #define C6DOFIMU22_MREG1_ST_STATUS1 0x0063
181 #define C6DOFIMU22_MREG1_ST_STATUS2 0x0064
182 #define C6DOFIMU22_MREG1_FDR_CONFIG 0x0066
183 #define C6DOFIMU22_MREG1_APEX_CONFIG12 0x0067
184 
189 #define C6DOFIMU22_MREG2_OTP_CTRL7 0x2806
190 
195 #define C6DOFIMU22_MREG3_XA_ST_DATA 0x5000
196 #define C6DOFIMU22_MREG3_YA_ST_DATA 0x5001
197 #define C6DOFIMU22_MREG3_ZA_ST_DATA 0x5002
198 #define C6DOFIMU22_MREG3_XG_ST_DATA 0x5003
199 #define C6DOFIMU22_MREG3_YG_ST_DATA 0x5004
200 #define C6DOFIMU22_MREG3_ZG_ST_DATA 0x5005
201  // c6dofimu22_reg
203 
218 #define C6DOFIMU22_MCLK_RDY 0x08
219 
224 #define C6DOFIMU22_SIGNAL_PATH_RESET 0x10
225 
230 #define C6DOFIMU22_INT_CONFIG_INT2_MODE_PULSE 0x00
231 #define C6DOFIMU22_INT_CONFIG_INT2_MODE_LATCH 0x20
232 #define C6DOFIMU22_INT_CONFIG_INT2_MODE_MASK 0x20
233 #define C6DOFIMU22_INT_CONFIG_INT2_DRV_OD 0x00
234 #define C6DOFIMU22_INT_CONFIG_INT2_DRV_PP 0x10
235 #define C6DOFIMU22_INT_CONFIG_INT2_DRV_MASK 0x10
236 #define C6DOFIMU22_INT_CONFIG_INT2_POL_LOW 0x00
237 #define C6DOFIMU22_INT_CONFIG_INT2_POL_HIGH 0x08
238 #define C6DOFIMU22_INT_CONFIG_INT2_POL_MASK 0x08
239 #define C6DOFIMU22_INT_CONFIG_INT1_MODE_PULSE 0x00
240 #define C6DOFIMU22_INT_CONFIG_INT1_MODE_LATCH 0x04
241 #define C6DOFIMU22_INT_CONFIG_INT1_MODE_MASK 0x04
242 #define C6DOFIMU22_INT_CONFIG_INT1_DRV_OD 0x00
243 #define C6DOFIMU22_INT_CONFIG_INT1_DRV_PP 0x02
244 #define C6DOFIMU22_INT_CONFIG_INT1_DRV_MASK 0x02
245 #define C6DOFIMU22_INT_CONFIG_INT1_POL_LOW 0x00
246 #define C6DOFIMU22_INT_CONFIG_INT1_POL_HIGH 0x01
247 #define C6DOFIMU22_INT_CONFIG_INT1_POL_MASK 0x01
248 
253 #define C6DOFIMU22_INT_CONFIG1_TPULSE_100US 0x00
254 #define C6DOFIMU22_INT_CONFIG1_TPULSE_8US 0x40
255 #define C6DOFIMU22_INT_CONFIG1_TPULSE_MASK 0x40
256 #define C6DOFIMU22_INT_CONFIG1_ASYNC_RESET_DIS 0x00
257 #define C6DOFIMU22_INT_CONFIG1_ASYNC_RESET_EN 0x10
258 #define C6DOFIMU22_INT_CONFIG1_ASYNC_RESET_MASK 0x10
259 
264 #define C6DOFIMU22_PWR_MGMT0_ACCEL_LP_CLK_SEL 0x80
265 #define C6DOFIMU22_PWR_MGMT0_IDLE 0x10
266 #define C6DOFIMU22_PWR_MGMT0_GYRO_MODE_OFF 0x00
267 #define C6DOFIMU22_PWR_MGMT0_GYRO_MODE_STBY 0x04
268 #define C6DOFIMU22_PWR_MGMT0_GYRO_MODE_LN 0x0C
269 #define C6DOFIMU22_PWR_MGMT0_GYRO_MODE_MASK 0x0C
270 #define C6DOFIMU22_PWR_MGMT0_ACCEL_MODE_OFF 0x00
271 #define C6DOFIMU22_PWR_MGMT0_ACCEL_MODE_LP 0x02
272 #define C6DOFIMU22_PWR_MGMT0_ACCEL_MODE_LN 0x03
273 #define C6DOFIMU22_PWR_MGMT0_ACCEL_MODE_MASK 0x03
274 
279 #define C6DOFIMU22_GYRO_CONFIG0_FS_SEL_2000DPS 0x00
280 #define C6DOFIMU22_GYRO_CONFIG0_FS_SEL_1000DPS 0x20
281 #define C6DOFIMU22_GYRO_CONFIG0_FS_SEL_500DPS 0x40
282 #define C6DOFIMU22_GYRO_CONFIG0_FS_SEL_250DPS 0x60
283 #define C6DOFIMU22_GYRO_CONFIG0_FS_SEL_MASK 0x60
284 #define C6DOFIMU22_GYRO_CONFIG0_ODR_1600HZ 0x05
285 #define C6DOFIMU22_GYRO_CONFIG0_ODR_800HZ 0x06
286 #define C6DOFIMU22_GYRO_CONFIG0_ODR_400HZ 0x07
287 #define C6DOFIMU22_GYRO_CONFIG0_ODR_200HZ 0x08
288 #define C6DOFIMU22_GYRO_CONFIG0_ODR_100HZ 0x09
289 #define C6DOFIMU22_GYRO_CONFIG0_ODR_50HZ 0x0A
290 #define C6DOFIMU22_GYRO_CONFIG0_ODR_25HZ 0x0B
291 #define C6DOFIMU22_GYRO_CONFIG0_ODR_12_5HZ 0x0C
292 #define C6DOFIMU22_GYRO_CONFIG0_ODR_MASK 0x0F
293 
298 #define C6DOFIMU22_ACCEL_CONFIG0_FS_SEL_16G 0x00
299 #define C6DOFIMU22_ACCEL_CONFIG0_FS_SEL_8G 0x20
300 #define C6DOFIMU22_ACCEL_CONFIG0_FS_SEL_4G 0x40
301 #define C6DOFIMU22_ACCEL_CONFIG0_FS_SEL_2G 0x60
302 #define C6DOFIMU22_ACCEL_CONFIG0_FS_SEL_MASK 0x60
303 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_1600HZ 0x05
304 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_800HZ 0x06
305 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_400HZ 0x07
306 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_200HZ 0x08
307 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_100HZ 0x09
308 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_50HZ 0x0A
309 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_25HZ 0x0B
310 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_12_5HZ 0x0C
311 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_6_25HZ 0x0D
312 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_3_125HZ 0x0E
313 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_1_5625HZ 0x0F
314 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_MASK 0x0F
315 
320 #define C6DOFIMU22_INT_SOURCE0_ST_INT1_EN 0x80
321 #define C6DOFIMU22_INT_SOURCE0_FSYNC_INT1_EN 0x40
322 #define C6DOFIMU22_INT_SOURCE0_PLL_RDY_INT1_EN 0x20
323 #define C6DOFIMU22_INT_SOURCE0_RESET_DONE_INT1_EN 0x10
324 #define C6DOFIMU22_INT_SOURCE0_DRDY_INT1_EN 0x08
325 #define C6DOFIMU22_INT_SOURCE0_FIFO_THS_INT1_EN 0x04
326 #define C6DOFIMU22_INT_SOURCE0_FIFO_FULL_INT1_EN 0x02
327 #define C6DOFIMU22_INT_SOURCE0_AGC_RDY_INT1_EN 0x01
328 
333 #define C6DOFIMU22_INT_STATUS_DATA_RDY 0x01
334 
339 #define C6DOFIMU22_INT_STATUS_ST 0x80
340 #define C6DOFIMU22_INT_STATUS_FSYNC 0x40
341 #define C6DOFIMU22_INT_STATUS_PLL_RDY 0x20
342 #define C6DOFIMU22_INT_STATUS_RESET_DONE 0x10
343 #define C6DOFIMU22_INT_STATUS_FIFO_THS 0x04
344 #define C6DOFIMU22_INT_STATUS_FIFO_FULL 0x02
345 #define C6DOFIMU22_INT_STATUS_AGC_RDY 0x01
346 
351 #define C6DOFIMU22_WHO_AM_I 0x67
352 
358 #define C6DOFIMU22_DEVICE_ADDRESS_0 0x68
359 #define C6DOFIMU22_DEVICE_ADDRESS_1 0x69
360 
365 #define C6DOFIMU22_GYRO_FS_SEL_250DPS 0x00
366 #define C6DOFIMU22_GYRO_FS_SEL_500DPS 0x01
367 #define C6DOFIMU22_GYRO_FS_SEL_1000DPS 0x02
368 #define C6DOFIMU22_GYRO_FS_SEL_2000DPS 0x03
369 #define C6DOFIMU22_GYRO_ODR_12_5HZ 0x00
370 #define C6DOFIMU22_GYRO_ODR_25HZ 0x01
371 #define C6DOFIMU22_GYRO_ODR_50HZ 0x02
372 #define C6DOFIMU22_GYRO_ODR_100HZ 0x03
373 #define C6DOFIMU22_GYRO_ODR_200HZ 0x04
374 #define C6DOFIMU22_GYRO_ODR_400HZ 0x05
375 #define C6DOFIMU22_GYRO_ODR_800HZ 0x06
376 #define C6DOFIMU22_GYRO_ODR_1600HZ 0x07
377 #define C6DOFIMU22_GYRO_DATA_RES 0x7FFF
378 #define C6DOFIMU22_GYRO_MIN_DPS 250
379 
384 #define C6DOFIMU22_ACCEL_FS_SEL_2G 0x00
385 #define C6DOFIMU22_ACCEL_FS_SEL_4G 0x01
386 #define C6DOFIMU22_ACCEL_FS_SEL_8G 0x02
387 #define C6DOFIMU22_ACCEL_FS_SEL_16G 0x03
388 #define C6DOFIMU22_ACCEL_ODR_1_5625HZ 0x00
389 #define C6DOFIMU22_ACCEL_ODR_3_125HZ 0x01
390 #define C6DOFIMU22_ACCEL_ODR_6_25HZ 0x02
391 #define C6DOFIMU22_ACCEL_ODR_12_5HZ 0x03
392 #define C6DOFIMU22_ACCEL_ODR_25HZ 0x04
393 #define C6DOFIMU22_ACCEL_ODR_50HZ 0x05
394 #define C6DOFIMU22_ACCEL_ODR_100HZ 0x06
395 #define C6DOFIMU22_ACCEL_ODR_200HZ 0x07
396 #define C6DOFIMU22_ACCEL_ODR_400HZ 0x08
397 #define C6DOFIMU22_ACCEL_ODR_800HZ 0x09
398 #define C6DOFIMU22_ACCEL_ODR_1600HZ 0x0A
399 #define C6DOFIMU22_ACCEL_DATA_RES 0x7FFF
400 #define C6DOFIMU22_ACCEL_MIN_G 2
401 
406 #define C6DOFIMU22_TEMP_RES 128
407 #define C6DOFIMU22_TEMP_OFFSET 25
408 
417 #define C6DOFIMU22_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
418 #define C6DOFIMU22_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
419  // c6dofimu22_set
421 
436 #define C6DOFIMU22_MAP_MIKROBUS( cfg, mikrobus ) \
437  cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
438  cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
439  cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
440  cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
441  cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
442  cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
443  cfg.int2 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
444  cfg.fsync = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
445  cfg.int1 = MIKROBUS( mikrobus, MIKROBUS_INT )
446  // c6dofimu22_map // c6dofimu22
449 
454 typedef enum
455 {
460 
465 struct c6dofimu22_s;
466 typedef err_t ( *c6dofimu22_master_io_t )( struct c6dofimu22_s*, uint8_t, uint8_t*, uint8_t );
472 typedef struct c6dofimu22_s
473 {
474  digital_out_t fsync;
476  digital_in_t int2;
477  digital_in_t int1;
479  i2c_master_t i2c;
480  spi_master_t spi;
482  uint8_t slave_address;
483  pin_name_t chip_select;
489  float gyro_sens;
490  float accel_sens;
493 
498 typedef struct
499 {
500  pin_name_t scl;
501  pin_name_t sda;
502  pin_name_t miso;
503  pin_name_t mosi;
504  pin_name_t sck;
505  pin_name_t cs;
506  pin_name_t int2;
507  pin_name_t fsync;
508  pin_name_t int1;
510  uint32_t i2c_speed;
511  uint8_t i2c_address;
513  uint32_t spi_speed;
514  spi_master_mode_t spi_mode;
515  spi_master_chip_select_polarity_t cs_polarity;
520 
525 typedef struct
526 {
527  float x;
528  float y;
529  float z;
532 
537 typedef struct
538 {
541  float temperature;
544 
549 typedef enum
550 {
552  C6DOFIMU22_ERROR = -1
553 
555 
572 
588 
603 
617 
632 err_t c6dofimu22_generic_write ( c6dofimu22_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len );
633 
648 err_t c6dofimu22_generic_read ( c6dofimu22_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len );
649 
662 err_t c6dofimu22_write_reg ( c6dofimu22_t *ctx, uint8_t reg, uint8_t data_in );
663 
676 err_t c6dofimu22_read_reg ( c6dofimu22_t *ctx, uint8_t reg, uint8_t *data_out );
677 
691 err_t c6dofimu22_write_mreg ( c6dofimu22_t *ctx, uint16_t mreg, uint8_t data_in );
692 
706 err_t c6dofimu22_read_mreg ( c6dofimu22_t *ctx, uint16_t mreg, uint8_t *data_out );
707 
717 void c6dofimu22_set_fsync_pin ( c6dofimu22_t *ctx, uint8_t state );
718 
728 
738 
750 
762 
774 
787 err_t c6dofimu22_set_gyro_fs_odr ( c6dofimu22_t *ctx, uint8_t fs_sel, uint8_t odr );
788 
801 err_t c6dofimu22_set_accel_fs_odr ( c6dofimu22_t *ctx, uint8_t fs_sel, uint8_t odr );
802 
816 
830 
842 err_t c6dofimu22_read_temperature ( c6dofimu22_t *ctx, float *temperature );
843 
857 
858 #ifdef __cplusplus
859 }
860 #endif
861 #endif // C6DOFIMU22_H
862  // c6dofimu22
864 
865 // ------------------------------------------------------------------------ END
c6dofimu22_cfg_t::fsync
pin_name_t fsync
Definition: c6dofimu22.h:507
c6dofimu22_s::read_f
c6dofimu22_master_io_t read_f
Definition: c6dofimu22.h:487
c6dofimu22_return_value_t
c6dofimu22_return_value_t
6DOF IMU 22 Click return value data.
Definition: c6dofimu22.h:550
c6dofimu22_master_io_t
err_t(* c6dofimu22_master_io_t)(struct c6dofimu22_s *, uint8_t, uint8_t *, uint8_t)
Definition: c6dofimu22.h:466
c6dofimu22_s::gyro_sens
float gyro_sens
Definition: c6dofimu22.h:489
c6dofimu22_s::spi
spi_master_t spi
Definition: c6dofimu22.h:480
c6dofimu22_drv_t
c6dofimu22_drv_t
6DOF IMU 22 Click driver selector.
Definition: c6dofimu22.h:455
c6dofimu22_reset_device
err_t c6dofimu22_reset_device(c6dofimu22_t *ctx)
6DOF IMU 22 reset device function.
c6dofimu22_read_mreg
err_t c6dofimu22_read_mreg(c6dofimu22_t *ctx, uint16_t mreg, uint8_t *data_out)
6DOF IMU 22 read mreg function.
c6dofimu22_cfg_t::drv_sel
c6dofimu22_drv_t drv_sel
Definition: c6dofimu22.h:517
c6dofimu22_axes_t::z
float z
Definition: c6dofimu22.h:529
c6dofimu22_cfg_t::int1
pin_name_t int1
Definition: c6dofimu22.h:508
c6dofimu22_s::fsync
digital_out_t fsync
Definition: c6dofimu22.h:474
c6dofimu22_s::drv_sel
c6dofimu22_drv_t drv_sel
Definition: c6dofimu22.h:484
c6dofimu22_data_t::accel
c6dofimu22_axes_t accel
Definition: c6dofimu22.h:540
c6dofimu22_read_gyro
err_t c6dofimu22_read_gyro(c6dofimu22_t *ctx, c6dofimu22_axes_t *gyro)
6DOF IMU 22 read gyro function.
c6dofimu22_read_temperature
err_t c6dofimu22_read_temperature(c6dofimu22_t *ctx, float *temperature)
6DOF IMU 22 read temperature function.
c6dofimu22_read_data
err_t c6dofimu22_read_data(c6dofimu22_t *ctx, c6dofimu22_data_t *data_out)
6DOF IMU 22 read data function.
spi_specifics.h
This file contains SPI specific macros, functions, etc.
c6dofimu22_s::int1
digital_in_t int1
Definition: c6dofimu22.h:477
c6dofimu22_set_fsync_pin
void c6dofimu22_set_fsync_pin(c6dofimu22_t *ctx, uint8_t state)
6DOF IMU 22 set fsync pin function.
c6dofimu22_axes_t
6DOF IMU 22 Click axes data structure.
Definition: c6dofimu22.h:526
c6dofimu22_cfg_t
6DOF IMU 22 Click configuration object.
Definition: c6dofimu22.h:499
c6dofimu22_data_t::temperature
float temperature
Definition: c6dofimu22.h:541
c6dofimu22_clear_data_ready
err_t c6dofimu22_clear_data_ready(c6dofimu22_t *ctx)
6DOF IMU 22 clear data ready function.
C6DOFIMU22_ERROR
@ C6DOFIMU22_ERROR
Definition: c6dofimu22.h:552
c6dofimu22_axes_t::x
float x
Definition: c6dofimu22.h:527
c6dofimu22_read_accel
err_t c6dofimu22_read_accel(c6dofimu22_t *ctx, c6dofimu22_axes_t *accel)
6DOF IMU 22 read accel function.
c6dofimu22_get_int1_pin
uint8_t c6dofimu22_get_int1_pin(c6dofimu22_t *ctx)
6DOF IMU 22 get int1 pin function.
c6dofimu22_set_accel_fs_odr
err_t c6dofimu22_set_accel_fs_odr(c6dofimu22_t *ctx, uint8_t fs_sel, uint8_t odr)
6DOF IMU 22 set accel fs odr function.
c6dofimu22_default_cfg
err_t c6dofimu22_default_cfg(c6dofimu22_t *ctx)
6DOF IMU 22 default configuration function.
c6dofimu22_s
6DOF IMU 22 Click context object.
Definition: c6dofimu22.h:473
c6dofimu22_s::slave_address
uint8_t slave_address
Definition: c6dofimu22.h:482
c6dofimu22_s::accel_sens
float accel_sens
Definition: c6dofimu22.h:490
c6dofimu22_generic_write
err_t c6dofimu22_generic_write(c6dofimu22_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
6DOF IMU 22 data writing function.
c6dofimu22_data_t
6DOF IMU 22 Click data structure.
Definition: c6dofimu22.h:538
c6dofimu22_drv_interface_sel
void c6dofimu22_drv_interface_sel(c6dofimu22_cfg_t *cfg, c6dofimu22_drv_t drv_sel)
6DOF IMU 22 driver interface setup function.
c6dofimu22_data_t::gyro
c6dofimu22_axes_t gyro
Definition: c6dofimu22.h:539
c6dofimu22_generic_read
err_t c6dofimu22_generic_read(c6dofimu22_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
6DOF IMU 22 data reading function.
C6DOFIMU22_DRV_SEL_SPI
@ C6DOFIMU22_DRV_SEL_SPI
Definition: c6dofimu22.h:456
c6dofimu22_cfg_t::miso
pin_name_t miso
Definition: c6dofimu22.h:502
c6dofimu22_cfg_t::mosi
pin_name_t mosi
Definition: c6dofimu22.h:503
c6dofimu22_check_communication
err_t c6dofimu22_check_communication(c6dofimu22_t *ctx)
6DOF IMU 22 check communication function.
c6dofimu22_s::write_f
c6dofimu22_master_io_t write_f
Definition: c6dofimu22.h:486
c6dofimu22_cfg_setup
void c6dofimu22_cfg_setup(c6dofimu22_cfg_t *cfg)
6DOF IMU 22 configuration object setup function.
c6dofimu22_cfg_t::i2c_speed
uint32_t i2c_speed
Definition: c6dofimu22.h:510
c6dofimu22_s::chip_select
pin_name_t chip_select
Definition: c6dofimu22.h:483
c6dofimu22_write_reg
err_t c6dofimu22_write_reg(c6dofimu22_t *ctx, uint8_t reg, uint8_t data_in)
6DOF IMU 22 write register function.
c6dofimu22_cfg_t::spi_speed
uint32_t spi_speed
Definition: c6dofimu22.h:513
C6DOFIMU22_OK
@ C6DOFIMU22_OK
Definition: c6dofimu22.h:551
c6dofimu22_s::int2
digital_in_t int2
Definition: c6dofimu22.h:476
c6dofimu22_cfg_t::cs
pin_name_t cs
Definition: c6dofimu22.h:505
c6dofimu22_cfg_t::cs_polarity
spi_master_chip_select_polarity_t cs_polarity
Definition: c6dofimu22.h:515
c6dofimu22_cfg_t::sda
pin_name_t sda
Definition: c6dofimu22.h:501
c6dofimu22_t
struct c6dofimu22_s c6dofimu22_t
6DOF IMU 22 Click context object.
c6dofimu22_cfg_t::spi_mode
spi_master_mode_t spi_mode
Definition: c6dofimu22.h:514
C6DOFIMU22_DRV_SEL_I2C
@ C6DOFIMU22_DRV_SEL_I2C
Definition: c6dofimu22.h:457
c6dofimu22_get_int2_pin
uint8_t c6dofimu22_get_int2_pin(c6dofimu22_t *ctx)
6DOF IMU 22 get int2 pin function.
c6dofimu22_set_gyro_fs_odr
err_t c6dofimu22_set_gyro_fs_odr(c6dofimu22_t *ctx, uint8_t fs_sel, uint8_t odr)
6DOF IMU 22 set gyro fs odr function.
c6dofimu22_s::i2c
i2c_master_t i2c
Definition: c6dofimu22.h:479
c6dofimu22_axes_t::y
float y
Definition: c6dofimu22.h:528
c6dofimu22_cfg_t::i2c_address
uint8_t i2c_address
Definition: c6dofimu22.h:511
c6dofimu22_cfg_t::sck
pin_name_t sck
Definition: c6dofimu22.h:504
c6dofimu22_read_reg
err_t c6dofimu22_read_reg(c6dofimu22_t *ctx, uint8_t reg, uint8_t *data_out)
6DOF IMU 22 read register function.
c6dofimu22_init
err_t c6dofimu22_init(c6dofimu22_t *ctx, c6dofimu22_cfg_t *cfg)
6DOF IMU 22 initialization function.
c6dofimu22_cfg_t::int2
pin_name_t int2
Definition: c6dofimu22.h:506
c6dofimu22_cfg_t::scl
pin_name_t scl
Definition: c6dofimu22.h:500
c6dofimu22_write_mreg
err_t c6dofimu22_write_mreg(c6dofimu22_t *ctx, uint16_t mreg, uint8_t data_in)
6DOF IMU 22 write mreg function.