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 
35 #include "mikrosdk_version.h"
36 
37 #ifdef __GNUC__
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
40 #else
41 #include "delays.h"
42 #endif
43 #endif
44 
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_i2c_master.h"
48 #include "drv_spi_master.h"
49 #include "spi_specifics.h"
50 
71 #define C6DOFIMU22_REG0_MCLK_RDY 0x00
72 #define C6DOFIMU22_REG0_DEVICE_CONFIG 0x01
73 #define C6DOFIMU22_REG0_SIGNAL_PATH_RESET 0x02
74 #define C6DOFIMU22_REG0_DRIVE_CONFIG1 0x03
75 #define C6DOFIMU22_REG0_DRIVE_CONFIG2 0x04
76 #define C6DOFIMU22_REG0_DRIVE_CONFIG3 0x05
77 #define C6DOFIMU22_REG0_INT_CONFIG 0x06
78 #define C6DOFIMU22_REG0_TEMP_DATA1 0x09
79 #define C6DOFIMU22_REG0_TEMP_DATA0 0x0A
80 #define C6DOFIMU22_REG0_ACCEL_DATA_X1 0x0B
81 #define C6DOFIMU22_REG0_ACCEL_DATA_X0 0x0C
82 #define C6DOFIMU22_REG0_ACCEL_DATA_Y1 0x0D
83 #define C6DOFIMU22_REG0_ACCEL_DATA_Y0 0x0E
84 #define C6DOFIMU22_REG0_ACCEL_DATA_Z1 0x0F
85 #define C6DOFIMU22_REG0_ACCEL_DATA_Z0 0x10
86 #define C6DOFIMU22_REG0_GYRO_DATA_X1 0x11
87 #define C6DOFIMU22_REG0_GYRO_DATA_X0 0x12
88 #define C6DOFIMU22_REG0_GYRO_DATA_Y1 0x13
89 #define C6DOFIMU22_REG0_GYRO_DATA_Y0 0x14
90 #define C6DOFIMU22_REG0_GYRO_DATA_Z1 0x15
91 #define C6DOFIMU22_REG0_GYRO_DATA_Z0 0x16
92 #define C6DOFIMU22_REG0_TMST_FSYNCH 0x17
93 #define C6DOFIMU22_REG0_TMST_FSYNCL 0x18
94 #define C6DOFIMU22_REG0_APEX_DATA4 0x1D
95 #define C6DOFIMU22_REG0_APEX_DATA5 0x1E
96 #define C6DOFIMU22_REG0_PWR_MGMT0 0x1F
97 #define C6DOFIMU22_REG0_GYRO_CONFIG0 0x20
98 #define C6DOFIMU22_REG0_ACCEL_CONFIG0 0x21
99 #define C6DOFIMU22_REG0_TEMP_CONFIG0 0x22
100 #define C6DOFIMU22_REG0_GYRO_CONFIG1 0x23
101 #define C6DOFIMU22_REG0_ACCEL_CONFIG1 0x24
102 #define C6DOFIMU22_REG0_APEX_CONFIG0 0x25
103 #define C6DOFIMU22_REG0_APEX_CONFIG1 0x26
104 #define C6DOFIMU22_REG0_WOM_CONFIG 0x27
105 #define C6DOFIMU22_REG0_FIFO_CONFIG1 0x28
106 #define C6DOFIMU22_REG0_FIFO_CONFIG2 0x29
107 #define C6DOFIMU22_REG0_FIFO_CONFIG3 0x2A
108 #define C6DOFIMU22_REG0_INT_SOURCE0 0x2B
109 #define C6DOFIMU22_REG0_INT_SOURCE1 0x2C
110 #define C6DOFIMU22_REG0_INT_SOURCE3 0x2D
111 #define C6DOFIMU22_REG0_INT_SOURCE4 0x2E
112 #define C6DOFIMU22_REG0_FIFO_LOST_PKT0 0x2F
113 #define C6DOFIMU22_REG0_FIFO_LOST_PKT1 0x30
114 #define C6DOFIMU22_REG0_APEX_DATA0 0x31
115 #define C6DOFIMU22_REG0_APEX_DATA1 0x32
116 #define C6DOFIMU22_REG0_APEX_DATA2 0x33
117 #define C6DOFIMU22_REG0_APEX_DATA3 0x34
118 #define C6DOFIMU22_REG0_INTF_CONFIG0 0x35
119 #define C6DOFIMU22_REG0_INTF_CONFIG1 0x36
120 #define C6DOFIMU22_REG0_INT_STATUS_DRDY 0x39
121 #define C6DOFIMU22_REG0_INT_STATUS 0x3A
122 #define C6DOFIMU22_REG0_INT_STATUS2 0x3B
123 #define C6DOFIMU22_REG0_INT_STATUS3 0x3C
124 #define C6DOFIMU22_REG0_FIFO_COUNTH 0x3D
125 #define C6DOFIMU22_REG0_FIFO_COUNTL 0x3E
126 #define C6DOFIMU22_REG0_FIFO_DATA 0x3F
127 #define C6DOFIMU22_REG0_WHO_AM_I 0x75
128 #define C6DOFIMU22_REG0_BLK_SEL_W 0x79
129 #define C6DOFIMU22_REG0_MADDR_W 0x7A
130 #define C6DOFIMU22_REG0_M_W 0x7B
131 #define C6DOFIMU22_REG0_BLK_SEL_R 0x7C
132 #define C6DOFIMU22_REG0_MADDR_R 0x7D
133 #define C6DOFIMU22_REG0_M_R 0x7E
134 
139 #define C6DOFIMU22_MREG1_TMST_CONFIG1 0x0000
140 #define C6DOFIMU22_MREG1_FIFO_CONFIG5 0x0001
141 #define C6DOFIMU22_MREG1_FIFO_CONFIG6 0x0002
142 #define C6DOFIMU22_MREG1_FSYNC_CONFIG 0x0003
143 #define C6DOFIMU22_MREG1_INT_CONFIG0 0x0004
144 #define C6DOFIMU22_MREG1_INT_CONFIG1 0x0005
145 #define C6DOFIMU22_MREG1_SENSOR_CONFIG3 0x0006
146 #define C6DOFIMU22_MREG1_ST_CONFIG 0x0013
147 #define C6DOFIMU22_MREG1_SELFTEST 0x0014
148 #define C6DOFIMU22_MREG1_INTF_CONFIG6 0x0023
149 #define C6DOFIMU22_MREG1_INTF_CONFIG10 0x0025
150 #define C6DOFIMU22_MREG1_INTF_CONFIG7 0x0028
151 #define C6DOFIMU22_MREG1_OTP_CONFIG 0x002B
152 #define C6DOFIMU22_MREG1_INT_SOURCE6 0x002F
153 #define C6DOFIMU22_MREG1_INT_SOURCE7 0x0030
154 #define C6DOFIMU22_MREG1_INT_SOURCE8 0x0031
155 #define C6DOFIMU22_MREG1_INT_SOURCE9 0x0032
156 #define C6DOFIMU22_MREG1_INT_SOURCE10 0x0033
157 #define C6DOFIMU22_MREG1_APEX_CONFIG2 0x0044
158 #define C6DOFIMU22_MREG1_APEX_CONFIG3 0x0045
159 #define C6DOFIMU22_MREG1_APEX_CONFIG4 0x0046
160 #define C6DOFIMU22_MREG1_APEX_CONFIG5 0x0047
161 #define C6DOFIMU22_MREG1_APEX_CONFIG9 0x0048
162 #define C6DOFIMU22_MREG1_APEX_CONFIG10 0x0049
163 #define C6DOFIMU22_MREG1_APEX_CONFIG11 0x004A
164 #define C6DOFIMU22_MREG1_ACCEL_WOM_X_THR 0x004B
165 #define C6DOFIMU22_MREG1_ACCEL_WOM_Y_THR 0x004C
166 #define C6DOFIMU22_MREG1_ACCEL_WOM_Z_THR 0x004D
167 #define C6DOFIMU22_MREG1_OFFSET_USER0 0x004E
168 #define C6DOFIMU22_MREG1_OFFSET_USER1 0x004F
169 #define C6DOFIMU22_MREG1_OFFSET_USER2 0x0050
170 #define C6DOFIMU22_MREG1_OFFSET_USER3 0x0051
171 #define C6DOFIMU22_MREG1_OFFSET_USER4 0x0052
172 #define C6DOFIMU22_MREG1_OFFSET_USER5 0x0053
173 #define C6DOFIMU22_MREG1_OFFSET_USER6 0x0054
174 #define C6DOFIMU22_MREG1_OFFSET_USER7 0x0055
175 #define C6DOFIMU22_MREG1_OFFSET_USER8 0x0056
176 #define C6DOFIMU22_MREG1_ST_STATUS1 0x0063
177 #define C6DOFIMU22_MREG1_ST_STATUS2 0x0064
178 #define C6DOFIMU22_MREG1_FDR_CONFIG 0x0066
179 #define C6DOFIMU22_MREG1_APEX_CONFIG12 0x0067
180 
185 #define C6DOFIMU22_MREG2_OTP_CTRL7 0x2806
186 
191 #define C6DOFIMU22_MREG3_XA_ST_DATA 0x5000
192 #define C6DOFIMU22_MREG3_YA_ST_DATA 0x5001
193 #define C6DOFIMU22_MREG3_ZA_ST_DATA 0x5002
194 #define C6DOFIMU22_MREG3_XG_ST_DATA 0x5003
195 #define C6DOFIMU22_MREG3_YG_ST_DATA 0x5004
196 #define C6DOFIMU22_MREG3_ZG_ST_DATA 0x5005
197  // c6dofimu22_reg
199 
214 #define C6DOFIMU22_MCLK_RDY 0x08
215 
220 #define C6DOFIMU22_SIGNAL_PATH_RESET 0x10
221 
226 #define C6DOFIMU22_INT_CONFIG_INT2_MODE_PULSE 0x00
227 #define C6DOFIMU22_INT_CONFIG_INT2_MODE_LATCH 0x20
228 #define C6DOFIMU22_INT_CONFIG_INT2_MODE_MASK 0x20
229 #define C6DOFIMU22_INT_CONFIG_INT2_DRV_OD 0x00
230 #define C6DOFIMU22_INT_CONFIG_INT2_DRV_PP 0x10
231 #define C6DOFIMU22_INT_CONFIG_INT2_DRV_MASK 0x10
232 #define C6DOFIMU22_INT_CONFIG_INT2_POL_LOW 0x00
233 #define C6DOFIMU22_INT_CONFIG_INT2_POL_HIGH 0x08
234 #define C6DOFIMU22_INT_CONFIG_INT2_POL_MASK 0x08
235 #define C6DOFIMU22_INT_CONFIG_INT1_MODE_PULSE 0x00
236 #define C6DOFIMU22_INT_CONFIG_INT1_MODE_LATCH 0x04
237 #define C6DOFIMU22_INT_CONFIG_INT1_MODE_MASK 0x04
238 #define C6DOFIMU22_INT_CONFIG_INT1_DRV_OD 0x00
239 #define C6DOFIMU22_INT_CONFIG_INT1_DRV_PP 0x02
240 #define C6DOFIMU22_INT_CONFIG_INT1_DRV_MASK 0x02
241 #define C6DOFIMU22_INT_CONFIG_INT1_POL_LOW 0x00
242 #define C6DOFIMU22_INT_CONFIG_INT1_POL_HIGH 0x01
243 #define C6DOFIMU22_INT_CONFIG_INT1_POL_MASK 0x01
244 
249 #define C6DOFIMU22_INT_CONFIG1_TPULSE_100US 0x00
250 #define C6DOFIMU22_INT_CONFIG1_TPULSE_8US 0x40
251 #define C6DOFIMU22_INT_CONFIG1_TPULSE_MASK 0x40
252 #define C6DOFIMU22_INT_CONFIG1_ASYNC_RESET_DIS 0x00
253 #define C6DOFIMU22_INT_CONFIG1_ASYNC_RESET_EN 0x10
254 #define C6DOFIMU22_INT_CONFIG1_ASYNC_RESET_MASK 0x10
255 
260 #define C6DOFIMU22_PWR_MGMT0_ACCEL_LP_CLK_SEL 0x80
261 #define C6DOFIMU22_PWR_MGMT0_IDLE 0x10
262 #define C6DOFIMU22_PWR_MGMT0_GYRO_MODE_OFF 0x00
263 #define C6DOFIMU22_PWR_MGMT0_GYRO_MODE_STBY 0x04
264 #define C6DOFIMU22_PWR_MGMT0_GYRO_MODE_LN 0x0C
265 #define C6DOFIMU22_PWR_MGMT0_GYRO_MODE_MASK 0x0C
266 #define C6DOFIMU22_PWR_MGMT0_ACCEL_MODE_OFF 0x00
267 #define C6DOFIMU22_PWR_MGMT0_ACCEL_MODE_LP 0x02
268 #define C6DOFIMU22_PWR_MGMT0_ACCEL_MODE_LN 0x03
269 #define C6DOFIMU22_PWR_MGMT0_ACCEL_MODE_MASK 0x03
270 
275 #define C6DOFIMU22_GYRO_CONFIG0_FS_SEL_2000DPS 0x00
276 #define C6DOFIMU22_GYRO_CONFIG0_FS_SEL_1000DPS 0x20
277 #define C6DOFIMU22_GYRO_CONFIG0_FS_SEL_500DPS 0x40
278 #define C6DOFIMU22_GYRO_CONFIG0_FS_SEL_250DPS 0x60
279 #define C6DOFIMU22_GYRO_CONFIG0_FS_SEL_MASK 0x60
280 #define C6DOFIMU22_GYRO_CONFIG0_ODR_1600HZ 0x05
281 #define C6DOFIMU22_GYRO_CONFIG0_ODR_800HZ 0x06
282 #define C6DOFIMU22_GYRO_CONFIG0_ODR_400HZ 0x07
283 #define C6DOFIMU22_GYRO_CONFIG0_ODR_200HZ 0x08
284 #define C6DOFIMU22_GYRO_CONFIG0_ODR_100HZ 0x09
285 #define C6DOFIMU22_GYRO_CONFIG0_ODR_50HZ 0x0A
286 #define C6DOFIMU22_GYRO_CONFIG0_ODR_25HZ 0x0B
287 #define C6DOFIMU22_GYRO_CONFIG0_ODR_12_5HZ 0x0C
288 #define C6DOFIMU22_GYRO_CONFIG0_ODR_MASK 0x0F
289 
294 #define C6DOFIMU22_ACCEL_CONFIG0_FS_SEL_16G 0x00
295 #define C6DOFIMU22_ACCEL_CONFIG0_FS_SEL_8G 0x20
296 #define C6DOFIMU22_ACCEL_CONFIG0_FS_SEL_4G 0x40
297 #define C6DOFIMU22_ACCEL_CONFIG0_FS_SEL_2G 0x60
298 #define C6DOFIMU22_ACCEL_CONFIG0_FS_SEL_MASK 0x60
299 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_1600HZ 0x05
300 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_800HZ 0x06
301 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_400HZ 0x07
302 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_200HZ 0x08
303 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_100HZ 0x09
304 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_50HZ 0x0A
305 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_25HZ 0x0B
306 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_12_5HZ 0x0C
307 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_6_25HZ 0x0D
308 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_3_125HZ 0x0E
309 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_1_5625HZ 0x0F
310 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_MASK 0x0F
311 
316 #define C6DOFIMU22_INT_SOURCE0_ST_INT1_EN 0x80
317 #define C6DOFIMU22_INT_SOURCE0_FSYNC_INT1_EN 0x40
318 #define C6DOFIMU22_INT_SOURCE0_PLL_RDY_INT1_EN 0x20
319 #define C6DOFIMU22_INT_SOURCE0_RESET_DONE_INT1_EN 0x10
320 #define C6DOFIMU22_INT_SOURCE0_DRDY_INT1_EN 0x08
321 #define C6DOFIMU22_INT_SOURCE0_FIFO_THS_INT1_EN 0x04
322 #define C6DOFIMU22_INT_SOURCE0_FIFO_FULL_INT1_EN 0x02
323 #define C6DOFIMU22_INT_SOURCE0_AGC_RDY_INT1_EN 0x01
324 
329 #define C6DOFIMU22_INT_STATUS_DATA_RDY 0x01
330 
335 #define C6DOFIMU22_INT_STATUS_ST 0x80
336 #define C6DOFIMU22_INT_STATUS_FSYNC 0x40
337 #define C6DOFIMU22_INT_STATUS_PLL_RDY 0x20
338 #define C6DOFIMU22_INT_STATUS_RESET_DONE 0x10
339 #define C6DOFIMU22_INT_STATUS_FIFO_THS 0x04
340 #define C6DOFIMU22_INT_STATUS_FIFO_FULL 0x02
341 #define C6DOFIMU22_INT_STATUS_AGC_RDY 0x01
342 
347 #define C6DOFIMU22_WHO_AM_I 0x67
348 
354 #define C6DOFIMU22_DEVICE_ADDRESS_0 0x68
355 #define C6DOFIMU22_DEVICE_ADDRESS_1 0x69
356 
361 #define C6DOFIMU22_GYRO_FS_SEL_250DPS 0x00
362 #define C6DOFIMU22_GYRO_FS_SEL_500DPS 0x01
363 #define C6DOFIMU22_GYRO_FS_SEL_1000DPS 0x02
364 #define C6DOFIMU22_GYRO_FS_SEL_2000DPS 0x03
365 #define C6DOFIMU22_GYRO_ODR_12_5HZ 0x00
366 #define C6DOFIMU22_GYRO_ODR_25HZ 0x01
367 #define C6DOFIMU22_GYRO_ODR_50HZ 0x02
368 #define C6DOFIMU22_GYRO_ODR_100HZ 0x03
369 #define C6DOFIMU22_GYRO_ODR_200HZ 0x04
370 #define C6DOFIMU22_GYRO_ODR_400HZ 0x05
371 #define C6DOFIMU22_GYRO_ODR_800HZ 0x06
372 #define C6DOFIMU22_GYRO_ODR_1600HZ 0x07
373 #define C6DOFIMU22_GYRO_DATA_RES 0x7FFF
374 #define C6DOFIMU22_GYRO_MIN_DPS 250
375 
380 #define C6DOFIMU22_ACCEL_FS_SEL_2G 0x00
381 #define C6DOFIMU22_ACCEL_FS_SEL_4G 0x01
382 #define C6DOFIMU22_ACCEL_FS_SEL_8G 0x02
383 #define C6DOFIMU22_ACCEL_FS_SEL_16G 0x03
384 #define C6DOFIMU22_ACCEL_ODR_1_5625HZ 0x00
385 #define C6DOFIMU22_ACCEL_ODR_3_125HZ 0x01
386 #define C6DOFIMU22_ACCEL_ODR_6_25HZ 0x02
387 #define C6DOFIMU22_ACCEL_ODR_12_5HZ 0x03
388 #define C6DOFIMU22_ACCEL_ODR_25HZ 0x04
389 #define C6DOFIMU22_ACCEL_ODR_50HZ 0x05
390 #define C6DOFIMU22_ACCEL_ODR_100HZ 0x06
391 #define C6DOFIMU22_ACCEL_ODR_200HZ 0x07
392 #define C6DOFIMU22_ACCEL_ODR_400HZ 0x08
393 #define C6DOFIMU22_ACCEL_ODR_800HZ 0x09
394 #define C6DOFIMU22_ACCEL_ODR_1600HZ 0x0A
395 #define C6DOFIMU22_ACCEL_DATA_RES 0x7FFF
396 #define C6DOFIMU22_ACCEL_MIN_G 2
397 
402 #define C6DOFIMU22_TEMP_RES 128
403 #define C6DOFIMU22_TEMP_OFFSET 25
404 
413 #define C6DOFIMU22_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
414 #define C6DOFIMU22_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
415  // c6dofimu22_set
417 
432 #define C6DOFIMU22_MAP_MIKROBUS( cfg, mikrobus ) \
433  cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
434  cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
435  cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
436  cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
437  cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
438  cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
439  cfg.int2 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
440  cfg.fsync = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
441  cfg.int1 = MIKROBUS( mikrobus, MIKROBUS_INT )
442  // c6dofimu22_map // c6dofimu22
445 
450 typedef enum
451 {
456 
461 struct c6dofimu22_s;
462 typedef err_t ( *c6dofimu22_master_io_t )( struct c6dofimu22_s*, uint8_t, uint8_t*, uint8_t );
468 typedef struct c6dofimu22_s
469 {
470  digital_out_t fsync;
472  digital_in_t int2;
473  digital_in_t int1;
475  i2c_master_t i2c;
476  spi_master_t spi;
478  uint8_t slave_address;
479  pin_name_t chip_select;
485  float gyro_sens;
486  float accel_sens;
489 
494 typedef struct
495 {
496  pin_name_t scl;
497  pin_name_t sda;
498  pin_name_t miso;
499  pin_name_t mosi;
500  pin_name_t sck;
501  pin_name_t cs;
502  pin_name_t int2;
503  pin_name_t fsync;
504  pin_name_t int1;
506  uint32_t i2c_speed;
507  uint8_t i2c_address;
509  uint32_t spi_speed;
510  spi_master_mode_t spi_mode;
511  spi_master_chip_select_polarity_t cs_polarity;
516 
521 typedef struct
522 {
523  float x;
524  float y;
525  float z;
528 
533 typedef struct
534 {
537  float temperature;
540 
545 typedef enum
546 {
548  C6DOFIMU22_ERROR = -1
549 
551 
568 
584 
599 
613 
628 err_t c6dofimu22_generic_write ( c6dofimu22_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len );
629 
644 err_t c6dofimu22_generic_read ( c6dofimu22_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len );
645 
658 err_t c6dofimu22_write_reg ( c6dofimu22_t *ctx, uint8_t reg, uint8_t data_in );
659 
672 err_t c6dofimu22_read_reg ( c6dofimu22_t *ctx, uint8_t reg, uint8_t *data_out );
673 
687 err_t c6dofimu22_write_mreg ( c6dofimu22_t *ctx, uint16_t mreg, uint8_t data_in );
688 
702 err_t c6dofimu22_read_mreg ( c6dofimu22_t *ctx, uint16_t mreg, uint8_t *data_out );
703 
713 void c6dofimu22_set_fsync_pin ( c6dofimu22_t *ctx, uint8_t state );
714 
724 
734 
746 
758 
770 
783 err_t c6dofimu22_set_gyro_fs_odr ( c6dofimu22_t *ctx, uint8_t fs_sel, uint8_t odr );
784 
797 err_t c6dofimu22_set_accel_fs_odr ( c6dofimu22_t *ctx, uint8_t fs_sel, uint8_t odr );
798 
812 
826 
838 err_t c6dofimu22_read_temperature ( c6dofimu22_t *ctx, float *temperature );
839 
853 
854 #ifdef __cplusplus
855 }
856 #endif
857 #endif // C6DOFIMU22_H
858  // c6dofimu22
860 
861 // ------------------------------------------------------------------------ END
c6dofimu22_cfg_t::fsync
pin_name_t fsync
Definition: c6dofimu22.h:503
c6dofimu22_s::read_f
c6dofimu22_master_io_t read_f
Definition: c6dofimu22.h:483
c6dofimu22_return_value_t
c6dofimu22_return_value_t
6DOF IMU 22 Click return value data.
Definition: c6dofimu22.h:546
c6dofimu22_master_io_t
err_t(* c6dofimu22_master_io_t)(struct c6dofimu22_s *, uint8_t, uint8_t *, uint8_t)
Definition: c6dofimu22.h:462
c6dofimu22_s::gyro_sens
float gyro_sens
Definition: c6dofimu22.h:485
c6dofimu22_s::spi
spi_master_t spi
Definition: c6dofimu22.h:476
c6dofimu22_drv_t
c6dofimu22_drv_t
6DOF IMU 22 Click driver selector.
Definition: c6dofimu22.h:451
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:513
c6dofimu22_axes_t::z
float z
Definition: c6dofimu22.h:525
c6dofimu22_cfg_t::int1
pin_name_t int1
Definition: c6dofimu22.h:504
c6dofimu22_s::fsync
digital_out_t fsync
Definition: c6dofimu22.h:470
c6dofimu22_s::drv_sel
c6dofimu22_drv_t drv_sel
Definition: c6dofimu22.h:480
c6dofimu22_data_t::accel
c6dofimu22_axes_t accel
Definition: c6dofimu22.h:536
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:473
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:522
c6dofimu22_cfg_t
6DOF IMU 22 Click configuration object.
Definition: c6dofimu22.h:495
c6dofimu22_data_t::temperature
float temperature
Definition: c6dofimu22.h:537
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:548
c6dofimu22_axes_t::x
float x
Definition: c6dofimu22.h:523
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:469
c6dofimu22_s::slave_address
uint8_t slave_address
Definition: c6dofimu22.h:478
c6dofimu22_s::accel_sens
float accel_sens
Definition: c6dofimu22.h:486
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:534
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:535
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:452
c6dofimu22_cfg_t::miso
pin_name_t miso
Definition: c6dofimu22.h:498
c6dofimu22_cfg_t::mosi
pin_name_t mosi
Definition: c6dofimu22.h:499
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:482
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:506
c6dofimu22_s::chip_select
pin_name_t chip_select
Definition: c6dofimu22.h:479
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:509
C6DOFIMU22_OK
@ C6DOFIMU22_OK
Definition: c6dofimu22.h:547
c6dofimu22_s::int2
digital_in_t int2
Definition: c6dofimu22.h:472
c6dofimu22_cfg_t::cs
pin_name_t cs
Definition: c6dofimu22.h:501
c6dofimu22_cfg_t::cs_polarity
spi_master_chip_select_polarity_t cs_polarity
Definition: c6dofimu22.h:511
c6dofimu22_cfg_t::sda
pin_name_t sda
Definition: c6dofimu22.h:497
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:510
C6DOFIMU22_DRV_SEL_I2C
@ C6DOFIMU22_DRV_SEL_I2C
Definition: c6dofimu22.h:453
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:475
c6dofimu22_axes_t::y
float y
Definition: c6dofimu22.h:524
c6dofimu22_cfg_t::i2c_address
uint8_t i2c_address
Definition: c6dofimu22.h:507
c6dofimu22_cfg_t::sck
pin_name_t sck
Definition: c6dofimu22.h:500
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:502
c6dofimu22_cfg_t::scl
pin_name_t scl
Definition: c6dofimu22.h:496
c6dofimu22_write_mreg
err_t c6dofimu22_write_mreg(c6dofimu22_t *ctx, uint16_t mreg, uint8_t data_in)
6DOF IMU 22 write mreg function.