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 "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_i2c_master.h"
38 #include "drv_spi_master.h"
39 #include "spi_specifics.h"
40 
61 #define C6DOFIMU22_REG0_MCLK_RDY 0x00
62 #define C6DOFIMU22_REG0_DEVICE_CONFIG 0x01
63 #define C6DOFIMU22_REG0_SIGNAL_PATH_RESET 0x02
64 #define C6DOFIMU22_REG0_DRIVE_CONFIG1 0x03
65 #define C6DOFIMU22_REG0_DRIVE_CONFIG2 0x04
66 #define C6DOFIMU22_REG0_DRIVE_CONFIG3 0x05
67 #define C6DOFIMU22_REG0_INT_CONFIG 0x06
68 #define C6DOFIMU22_REG0_TEMP_DATA1 0x09
69 #define C6DOFIMU22_REG0_TEMP_DATA0 0x0A
70 #define C6DOFIMU22_REG0_ACCEL_DATA_X1 0x0B
71 #define C6DOFIMU22_REG0_ACCEL_DATA_X0 0x0C
72 #define C6DOFIMU22_REG0_ACCEL_DATA_Y1 0x0D
73 #define C6DOFIMU22_REG0_ACCEL_DATA_Y0 0x0E
74 #define C6DOFIMU22_REG0_ACCEL_DATA_Z1 0x0F
75 #define C6DOFIMU22_REG0_ACCEL_DATA_Z0 0x10
76 #define C6DOFIMU22_REG0_GYRO_DATA_X1 0x11
77 #define C6DOFIMU22_REG0_GYRO_DATA_X0 0x12
78 #define C6DOFIMU22_REG0_GYRO_DATA_Y1 0x13
79 #define C6DOFIMU22_REG0_GYRO_DATA_Y0 0x14
80 #define C6DOFIMU22_REG0_GYRO_DATA_Z1 0x15
81 #define C6DOFIMU22_REG0_GYRO_DATA_Z0 0x16
82 #define C6DOFIMU22_REG0_TMST_FSYNCH 0x17
83 #define C6DOFIMU22_REG0_TMST_FSYNCL 0x18
84 #define C6DOFIMU22_REG0_APEX_DATA4 0x1D
85 #define C6DOFIMU22_REG0_APEX_DATA5 0x1E
86 #define C6DOFIMU22_REG0_PWR_MGMT0 0x1F
87 #define C6DOFIMU22_REG0_GYRO_CONFIG0 0x20
88 #define C6DOFIMU22_REG0_ACCEL_CONFIG0 0x21
89 #define C6DOFIMU22_REG0_TEMP_CONFIG0 0x22
90 #define C6DOFIMU22_REG0_GYRO_CONFIG1 0x23
91 #define C6DOFIMU22_REG0_ACCEL_CONFIG1 0x24
92 #define C6DOFIMU22_REG0_APEX_CONFIG0 0x25
93 #define C6DOFIMU22_REG0_APEX_CONFIG1 0x26
94 #define C6DOFIMU22_REG0_WOM_CONFIG 0x27
95 #define C6DOFIMU22_REG0_FIFO_CONFIG1 0x28
96 #define C6DOFIMU22_REG0_FIFO_CONFIG2 0x29
97 #define C6DOFIMU22_REG0_FIFO_CONFIG3 0x2A
98 #define C6DOFIMU22_REG0_INT_SOURCE0 0x2B
99 #define C6DOFIMU22_REG0_INT_SOURCE1 0x2C
100 #define C6DOFIMU22_REG0_INT_SOURCE3 0x2D
101 #define C6DOFIMU22_REG0_INT_SOURCE4 0x2E
102 #define C6DOFIMU22_REG0_FIFO_LOST_PKT0 0x2F
103 #define C6DOFIMU22_REG0_FIFO_LOST_PKT1 0x30
104 #define C6DOFIMU22_REG0_APEX_DATA0 0x31
105 #define C6DOFIMU22_REG0_APEX_DATA1 0x32
106 #define C6DOFIMU22_REG0_APEX_DATA2 0x33
107 #define C6DOFIMU22_REG0_APEX_DATA3 0x34
108 #define C6DOFIMU22_REG0_INTF_CONFIG0 0x35
109 #define C6DOFIMU22_REG0_INTF_CONFIG1 0x36
110 #define C6DOFIMU22_REG0_INT_STATUS_DRDY 0x39
111 #define C6DOFIMU22_REG0_INT_STATUS 0x3A
112 #define C6DOFIMU22_REG0_INT_STATUS2 0x3B
113 #define C6DOFIMU22_REG0_INT_STATUS3 0x3C
114 #define C6DOFIMU22_REG0_FIFO_COUNTH 0x3D
115 #define C6DOFIMU22_REG0_FIFO_COUNTL 0x3E
116 #define C6DOFIMU22_REG0_FIFO_DATA 0x3F
117 #define C6DOFIMU22_REG0_WHO_AM_I 0x75
118 #define C6DOFIMU22_REG0_BLK_SEL_W 0x79
119 #define C6DOFIMU22_REG0_MADDR_W 0x7A
120 #define C6DOFIMU22_REG0_M_W 0x7B
121 #define C6DOFIMU22_REG0_BLK_SEL_R 0x7C
122 #define C6DOFIMU22_REG0_MADDR_R 0x7D
123 #define C6DOFIMU22_REG0_M_R 0x7E
124 
129 #define C6DOFIMU22_MREG1_TMST_CONFIG1 0x0000
130 #define C6DOFIMU22_MREG1_FIFO_CONFIG5 0x0001
131 #define C6DOFIMU22_MREG1_FIFO_CONFIG6 0x0002
132 #define C6DOFIMU22_MREG1_FSYNC_CONFIG 0x0003
133 #define C6DOFIMU22_MREG1_INT_CONFIG0 0x0004
134 #define C6DOFIMU22_MREG1_INT_CONFIG1 0x0005
135 #define C6DOFIMU22_MREG1_SENSOR_CONFIG3 0x0006
136 #define C6DOFIMU22_MREG1_ST_CONFIG 0x0013
137 #define C6DOFIMU22_MREG1_SELFTEST 0x0014
138 #define C6DOFIMU22_MREG1_INTF_CONFIG6 0x0023
139 #define C6DOFIMU22_MREG1_INTF_CONFIG10 0x0025
140 #define C6DOFIMU22_MREG1_INTF_CONFIG7 0x0028
141 #define C6DOFIMU22_MREG1_OTP_CONFIG 0x002B
142 #define C6DOFIMU22_MREG1_INT_SOURCE6 0x002F
143 #define C6DOFIMU22_MREG1_INT_SOURCE7 0x0030
144 #define C6DOFIMU22_MREG1_INT_SOURCE8 0x0031
145 #define C6DOFIMU22_MREG1_INT_SOURCE9 0x0032
146 #define C6DOFIMU22_MREG1_INT_SOURCE10 0x0033
147 #define C6DOFIMU22_MREG1_APEX_CONFIG2 0x0044
148 #define C6DOFIMU22_MREG1_APEX_CONFIG3 0x0045
149 #define C6DOFIMU22_MREG1_APEX_CONFIG4 0x0046
150 #define C6DOFIMU22_MREG1_APEX_CONFIG5 0x0047
151 #define C6DOFIMU22_MREG1_APEX_CONFIG9 0x0048
152 #define C6DOFIMU22_MREG1_APEX_CONFIG10 0x0049
153 #define C6DOFIMU22_MREG1_APEX_CONFIG11 0x004A
154 #define C6DOFIMU22_MREG1_ACCEL_WOM_X_THR 0x004B
155 #define C6DOFIMU22_MREG1_ACCEL_WOM_Y_THR 0x004C
156 #define C6DOFIMU22_MREG1_ACCEL_WOM_Z_THR 0x004D
157 #define C6DOFIMU22_MREG1_OFFSET_USER0 0x004E
158 #define C6DOFIMU22_MREG1_OFFSET_USER1 0x004F
159 #define C6DOFIMU22_MREG1_OFFSET_USER2 0x0050
160 #define C6DOFIMU22_MREG1_OFFSET_USER3 0x0051
161 #define C6DOFIMU22_MREG1_OFFSET_USER4 0x0052
162 #define C6DOFIMU22_MREG1_OFFSET_USER5 0x0053
163 #define C6DOFIMU22_MREG1_OFFSET_USER6 0x0054
164 #define C6DOFIMU22_MREG1_OFFSET_USER7 0x0055
165 #define C6DOFIMU22_MREG1_OFFSET_USER8 0x0056
166 #define C6DOFIMU22_MREG1_ST_STATUS1 0x0063
167 #define C6DOFIMU22_MREG1_ST_STATUS2 0x0064
168 #define C6DOFIMU22_MREG1_FDR_CONFIG 0x0066
169 #define C6DOFIMU22_MREG1_APEX_CONFIG12 0x0067
170 
175 #define C6DOFIMU22_MREG2_OTP_CTRL7 0x2806
176 
181 #define C6DOFIMU22_MREG3_XA_ST_DATA 0x5000
182 #define C6DOFIMU22_MREG3_YA_ST_DATA 0x5001
183 #define C6DOFIMU22_MREG3_ZA_ST_DATA 0x5002
184 #define C6DOFIMU22_MREG3_XG_ST_DATA 0x5003
185 #define C6DOFIMU22_MREG3_YG_ST_DATA 0x5004
186 #define C6DOFIMU22_MREG3_ZG_ST_DATA 0x5005
187  // c6dofimu22_reg
189 
204 #define C6DOFIMU22_MCLK_RDY 0x08
205 
210 #define C6DOFIMU22_SIGNAL_PATH_RESET 0x10
211 
216 #define C6DOFIMU22_INT_CONFIG_INT2_MODE_PULSE 0x00
217 #define C6DOFIMU22_INT_CONFIG_INT2_MODE_LATCH 0x20
218 #define C6DOFIMU22_INT_CONFIG_INT2_MODE_MASK 0x20
219 #define C6DOFIMU22_INT_CONFIG_INT2_DRV_OD 0x00
220 #define C6DOFIMU22_INT_CONFIG_INT2_DRV_PP 0x10
221 #define C6DOFIMU22_INT_CONFIG_INT2_DRV_MASK 0x10
222 #define C6DOFIMU22_INT_CONFIG_INT2_POL_LOW 0x00
223 #define C6DOFIMU22_INT_CONFIG_INT2_POL_HIGH 0x08
224 #define C6DOFIMU22_INT_CONFIG_INT2_POL_MASK 0x08
225 #define C6DOFIMU22_INT_CONFIG_INT1_MODE_PULSE 0x00
226 #define C6DOFIMU22_INT_CONFIG_INT1_MODE_LATCH 0x04
227 #define C6DOFIMU22_INT_CONFIG_INT1_MODE_MASK 0x04
228 #define C6DOFIMU22_INT_CONFIG_INT1_DRV_OD 0x00
229 #define C6DOFIMU22_INT_CONFIG_INT1_DRV_PP 0x02
230 #define C6DOFIMU22_INT_CONFIG_INT1_DRV_MASK 0x02
231 #define C6DOFIMU22_INT_CONFIG_INT1_POL_LOW 0x00
232 #define C6DOFIMU22_INT_CONFIG_INT1_POL_HIGH 0x01
233 #define C6DOFIMU22_INT_CONFIG_INT1_POL_MASK 0x01
234 
239 #define C6DOFIMU22_INT_CONFIG1_TPULSE_100US 0x00
240 #define C6DOFIMU22_INT_CONFIG1_TPULSE_8US 0x40
241 #define C6DOFIMU22_INT_CONFIG1_TPULSE_MASK 0x40
242 #define C6DOFIMU22_INT_CONFIG1_ASYNC_RESET_DIS 0x00
243 #define C6DOFIMU22_INT_CONFIG1_ASYNC_RESET_EN 0x10
244 #define C6DOFIMU22_INT_CONFIG1_ASYNC_RESET_MASK 0x10
245 
250 #define C6DOFIMU22_PWR_MGMT0_ACCEL_LP_CLK_SEL 0x80
251 #define C6DOFIMU22_PWR_MGMT0_IDLE 0x10
252 #define C6DOFIMU22_PWR_MGMT0_GYRO_MODE_OFF 0x00
253 #define C6DOFIMU22_PWR_MGMT0_GYRO_MODE_STBY 0x04
254 #define C6DOFIMU22_PWR_MGMT0_GYRO_MODE_LN 0x0C
255 #define C6DOFIMU22_PWR_MGMT0_GYRO_MODE_MASK 0x0C
256 #define C6DOFIMU22_PWR_MGMT0_ACCEL_MODE_OFF 0x00
257 #define C6DOFIMU22_PWR_MGMT0_ACCEL_MODE_LP 0x02
258 #define C6DOFIMU22_PWR_MGMT0_ACCEL_MODE_LN 0x03
259 #define C6DOFIMU22_PWR_MGMT0_ACCEL_MODE_MASK 0x03
260 
265 #define C6DOFIMU22_GYRO_CONFIG0_FS_SEL_2000DPS 0x00
266 #define C6DOFIMU22_GYRO_CONFIG0_FS_SEL_1000DPS 0x20
267 #define C6DOFIMU22_GYRO_CONFIG0_FS_SEL_500DPS 0x40
268 #define C6DOFIMU22_GYRO_CONFIG0_FS_SEL_250DPS 0x60
269 #define C6DOFIMU22_GYRO_CONFIG0_FS_SEL_MASK 0x60
270 #define C6DOFIMU22_GYRO_CONFIG0_ODR_1600HZ 0x05
271 #define C6DOFIMU22_GYRO_CONFIG0_ODR_800HZ 0x06
272 #define C6DOFIMU22_GYRO_CONFIG0_ODR_400HZ 0x07
273 #define C6DOFIMU22_GYRO_CONFIG0_ODR_200HZ 0x08
274 #define C6DOFIMU22_GYRO_CONFIG0_ODR_100HZ 0x09
275 #define C6DOFIMU22_GYRO_CONFIG0_ODR_50HZ 0x0A
276 #define C6DOFIMU22_GYRO_CONFIG0_ODR_25HZ 0x0B
277 #define C6DOFIMU22_GYRO_CONFIG0_ODR_12_5HZ 0x0C
278 #define C6DOFIMU22_GYRO_CONFIG0_ODR_MASK 0x0F
279 
284 #define C6DOFIMU22_ACCEL_CONFIG0_FS_SEL_16G 0x00
285 #define C6DOFIMU22_ACCEL_CONFIG0_FS_SEL_8G 0x20
286 #define C6DOFIMU22_ACCEL_CONFIG0_FS_SEL_4G 0x40
287 #define C6DOFIMU22_ACCEL_CONFIG0_FS_SEL_2G 0x60
288 #define C6DOFIMU22_ACCEL_CONFIG0_FS_SEL_MASK 0x60
289 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_1600HZ 0x05
290 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_800HZ 0x06
291 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_400HZ 0x07
292 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_200HZ 0x08
293 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_100HZ 0x09
294 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_50HZ 0x0A
295 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_25HZ 0x0B
296 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_12_5HZ 0x0C
297 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_6_25HZ 0x0D
298 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_3_125HZ 0x0E
299 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_1_5625HZ 0x0F
300 #define C6DOFIMU22_ACCEL_CONFIG0_ODR_MASK 0x0F
301 
306 #define C6DOFIMU22_INT_SOURCE0_ST_INT1_EN 0x80
307 #define C6DOFIMU22_INT_SOURCE0_FSYNC_INT1_EN 0x40
308 #define C6DOFIMU22_INT_SOURCE0_PLL_RDY_INT1_EN 0x20
309 #define C6DOFIMU22_INT_SOURCE0_RESET_DONE_INT1_EN 0x10
310 #define C6DOFIMU22_INT_SOURCE0_DRDY_INT1_EN 0x08
311 #define C6DOFIMU22_INT_SOURCE0_FIFO_THS_INT1_EN 0x04
312 #define C6DOFIMU22_INT_SOURCE0_FIFO_FULL_INT1_EN 0x02
313 #define C6DOFIMU22_INT_SOURCE0_AGC_RDY_INT1_EN 0x01
314 
319 #define C6DOFIMU22_INT_STATUS_DATA_RDY 0x01
320 
325 #define C6DOFIMU22_INT_STATUS_ST 0x80
326 #define C6DOFIMU22_INT_STATUS_FSYNC 0x40
327 #define C6DOFIMU22_INT_STATUS_PLL_RDY 0x20
328 #define C6DOFIMU22_INT_STATUS_RESET_DONE 0x10
329 #define C6DOFIMU22_INT_STATUS_FIFO_THS 0x04
330 #define C6DOFIMU22_INT_STATUS_FIFO_FULL 0x02
331 #define C6DOFIMU22_INT_STATUS_AGC_RDY 0x01
332 
337 #define C6DOFIMU22_WHO_AM_I 0x67
338 
344 #define C6DOFIMU22_DEVICE_ADDRESS_0 0x68
345 #define C6DOFIMU22_DEVICE_ADDRESS_1 0x69
346 
351 #define C6DOFIMU22_GYRO_FS_SEL_250DPS 0x00
352 #define C6DOFIMU22_GYRO_FS_SEL_500DPS 0x01
353 #define C6DOFIMU22_GYRO_FS_SEL_1000DPS 0x02
354 #define C6DOFIMU22_GYRO_FS_SEL_2000DPS 0x03
355 #define C6DOFIMU22_GYRO_ODR_12_5HZ 0x00
356 #define C6DOFIMU22_GYRO_ODR_25HZ 0x01
357 #define C6DOFIMU22_GYRO_ODR_50HZ 0x02
358 #define C6DOFIMU22_GYRO_ODR_100HZ 0x03
359 #define C6DOFIMU22_GYRO_ODR_200HZ 0x04
360 #define C6DOFIMU22_GYRO_ODR_400HZ 0x05
361 #define C6DOFIMU22_GYRO_ODR_800HZ 0x06
362 #define C6DOFIMU22_GYRO_ODR_1600HZ 0x07
363 #define C6DOFIMU22_GYRO_DATA_RES 0x7FFF
364 #define C6DOFIMU22_GYRO_MIN_DPS 250
365 
370 #define C6DOFIMU22_ACCEL_FS_SEL_2G 0x00
371 #define C6DOFIMU22_ACCEL_FS_SEL_4G 0x01
372 #define C6DOFIMU22_ACCEL_FS_SEL_8G 0x02
373 #define C6DOFIMU22_ACCEL_FS_SEL_16G 0x03
374 #define C6DOFIMU22_ACCEL_ODR_1_5625HZ 0x00
375 #define C6DOFIMU22_ACCEL_ODR_3_125HZ 0x01
376 #define C6DOFIMU22_ACCEL_ODR_6_25HZ 0x02
377 #define C6DOFIMU22_ACCEL_ODR_12_5HZ 0x03
378 #define C6DOFIMU22_ACCEL_ODR_25HZ 0x04
379 #define C6DOFIMU22_ACCEL_ODR_50HZ 0x05
380 #define C6DOFIMU22_ACCEL_ODR_100HZ 0x06
381 #define C6DOFIMU22_ACCEL_ODR_200HZ 0x07
382 #define C6DOFIMU22_ACCEL_ODR_400HZ 0x08
383 #define C6DOFIMU22_ACCEL_ODR_800HZ 0x09
384 #define C6DOFIMU22_ACCEL_ODR_1600HZ 0x0A
385 #define C6DOFIMU22_ACCEL_DATA_RES 0x7FFF
386 #define C6DOFIMU22_ACCEL_MIN_G 2
387 
392 #define C6DOFIMU22_TEMP_RES 128
393 #define C6DOFIMU22_TEMP_OFFSET 25
394 
403 #define C6DOFIMU22_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
404 #define C6DOFIMU22_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
405  // c6dofimu22_set
407 
422 #define C6DOFIMU22_MAP_MIKROBUS( cfg, mikrobus ) \
423  cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
424  cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
425  cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
426  cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
427  cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
428  cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
429  cfg.int2 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
430  cfg.fsync = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
431  cfg.int1 = MIKROBUS( mikrobus, MIKROBUS_INT )
432  // c6dofimu22_map // c6dofimu22
435 
440 typedef enum
441 {
446 
451 struct c6dofimu22_s;
452 typedef err_t ( *c6dofimu22_master_io_t )( struct c6dofimu22_s*, uint8_t, uint8_t*, uint8_t );
458 typedef struct c6dofimu22_s
459 {
460  digital_out_t fsync;
462  digital_in_t int2;
463  digital_in_t int1;
465  i2c_master_t i2c;
466  spi_master_t spi;
468  uint8_t slave_address;
469  pin_name_t chip_select;
475  float gyro_sens;
476  float accel_sens;
479 
484 typedef struct
485 {
486  pin_name_t scl;
487  pin_name_t sda;
488  pin_name_t miso;
489  pin_name_t mosi;
490  pin_name_t sck;
491  pin_name_t cs;
492  pin_name_t int2;
493  pin_name_t fsync;
494  pin_name_t int1;
496  uint32_t i2c_speed;
497  uint8_t i2c_address;
499  uint32_t spi_speed;
500  spi_master_mode_t spi_mode;
501  spi_master_chip_select_polarity_t cs_polarity;
506 
511 typedef struct
512 {
513  float x;
514  float y;
515  float z;
518 
523 typedef struct
524 {
527  float temperature;
530 
535 typedef enum
536 {
538  C6DOFIMU22_ERROR = -1
539 
541 
558 
574 
589 
603 
618 err_t c6dofimu22_generic_write ( c6dofimu22_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len );
619 
634 err_t c6dofimu22_generic_read ( c6dofimu22_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len );
635 
648 err_t c6dofimu22_write_reg ( c6dofimu22_t *ctx, uint8_t reg, uint8_t data_in );
649 
662 err_t c6dofimu22_read_reg ( c6dofimu22_t *ctx, uint8_t reg, uint8_t *data_out );
663 
677 err_t c6dofimu22_write_mreg ( c6dofimu22_t *ctx, uint16_t mreg, uint8_t data_in );
678 
692 err_t c6dofimu22_read_mreg ( c6dofimu22_t *ctx, uint16_t mreg, uint8_t *data_out );
693 
703 void c6dofimu22_set_fsync_pin ( c6dofimu22_t *ctx, uint8_t state );
704 
714 
724 
736 
748 
760 
773 err_t c6dofimu22_set_gyro_fs_odr ( c6dofimu22_t *ctx, uint8_t fs_sel, uint8_t odr );
774 
787 err_t c6dofimu22_set_accel_fs_odr ( c6dofimu22_t *ctx, uint8_t fs_sel, uint8_t odr );
788 
802 
816 
828 err_t c6dofimu22_read_temperature ( c6dofimu22_t *ctx, float *temperature );
829 
843 
844 #ifdef __cplusplus
845 }
846 #endif
847 #endif // C6DOFIMU22_H
848  // c6dofimu22
850 
851 // ------------------------------------------------------------------------ END
c6dofimu22_cfg_t::fsync
pin_name_t fsync
Definition: c6dofimu22.h:493
c6dofimu22_s::read_f
c6dofimu22_master_io_t read_f
Definition: c6dofimu22.h:473
c6dofimu22_return_value_t
c6dofimu22_return_value_t
6DOF IMU 22 Click return value data.
Definition: c6dofimu22.h:536
c6dofimu22_master_io_t
err_t(* c6dofimu22_master_io_t)(struct c6dofimu22_s *, uint8_t, uint8_t *, uint8_t)
Definition: c6dofimu22.h:452
c6dofimu22_s::gyro_sens
float gyro_sens
Definition: c6dofimu22.h:475
c6dofimu22_s::spi
spi_master_t spi
Definition: c6dofimu22.h:466
c6dofimu22_drv_t
c6dofimu22_drv_t
6DOF IMU 22 Click driver selector.
Definition: c6dofimu22.h:441
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:503
c6dofimu22_axes_t::z
float z
Definition: c6dofimu22.h:515
c6dofimu22_cfg_t::int1
pin_name_t int1
Definition: c6dofimu22.h:494
c6dofimu22_s::fsync
digital_out_t fsync
Definition: c6dofimu22.h:460
c6dofimu22_s::drv_sel
c6dofimu22_drv_t drv_sel
Definition: c6dofimu22.h:470
c6dofimu22_data_t::accel
c6dofimu22_axes_t accel
Definition: c6dofimu22.h:526
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:463
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:512
c6dofimu22_cfg_t
6DOF IMU 22 Click configuration object.
Definition: c6dofimu22.h:485
c6dofimu22_data_t::temperature
float temperature
Definition: c6dofimu22.h:527
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:538
c6dofimu22_axes_t::x
float x
Definition: c6dofimu22.h:513
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:459
c6dofimu22_s::slave_address
uint8_t slave_address
Definition: c6dofimu22.h:468
c6dofimu22_s::accel_sens
float accel_sens
Definition: c6dofimu22.h:476
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:524
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:525
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:442
c6dofimu22_cfg_t::miso
pin_name_t miso
Definition: c6dofimu22.h:488
c6dofimu22_cfg_t::mosi
pin_name_t mosi
Definition: c6dofimu22.h:489
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:472
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:496
c6dofimu22_s::chip_select
pin_name_t chip_select
Definition: c6dofimu22.h:469
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:499
C6DOFIMU22_OK
@ C6DOFIMU22_OK
Definition: c6dofimu22.h:537
c6dofimu22_s::int2
digital_in_t int2
Definition: c6dofimu22.h:462
c6dofimu22_cfg_t::cs
pin_name_t cs
Definition: c6dofimu22.h:491
c6dofimu22_cfg_t::cs_polarity
spi_master_chip_select_polarity_t cs_polarity
Definition: c6dofimu22.h:501
c6dofimu22_cfg_t::sda
pin_name_t sda
Definition: c6dofimu22.h:487
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:500
C6DOFIMU22_DRV_SEL_I2C
@ C6DOFIMU22_DRV_SEL_I2C
Definition: c6dofimu22.h:443
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:465
c6dofimu22_axes_t::y
float y
Definition: c6dofimu22.h:514
c6dofimu22_cfg_t::i2c_address
uint8_t i2c_address
Definition: c6dofimu22.h:497
c6dofimu22_cfg_t::sck
pin_name_t sck
Definition: c6dofimu22.h:490
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:492
c6dofimu22_cfg_t::scl
pin_name_t scl
Definition: c6dofimu22.h:486
c6dofimu22_write_mreg
err_t c6dofimu22_write_mreg(c6dofimu22_t *ctx, uint16_t mreg, uint8_t data_in)
6DOF IMU 22 write mreg function.