6dofimu24 2.2.1
Loading...
Searching...
No Matches
c6dofimu24.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
27
28#ifndef C6DOFIMU24_H
29#define C6DOFIMU24_H
30
31#ifdef __cplusplus
32extern "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
60
65
70
75#define C6DOFIMU24_REG0_DEVICE_CONFIG 0x11
76#define C6DOFIMU24_REG0_DRIVE_CONFIG 0x13
77#define C6DOFIMU24_REG0_INT_CONFIG 0x14
78#define C6DOFIMU24_REG0_FIFO_CONFIG 0x16
79#define C6DOFIMU24_REG0_TEMP_DATA1 0x1D
80#define C6DOFIMU24_REG0_TEMP_DATA0 0x1E
81#define C6DOFIMU24_REG0_ACCEL_DATA_X1 0x1F
82#define C6DOFIMU24_REG0_ACCEL_DATA_X0 0x20
83#define C6DOFIMU24_REG0_ACCEL_DATA_Y1 0x21
84#define C6DOFIMU24_REG0_ACCEL_DATA_Y0 0x22
85#define C6DOFIMU24_REG0_ACCEL_DATA_Z1 0x23
86#define C6DOFIMU24_REG0_ACCEL_DATA_Z0 0x24
87#define C6DOFIMU24_REG0_GYRO_DATA_X1 0x25
88#define C6DOFIMU24_REG0_GYRO_DATA_X0 0x26
89#define C6DOFIMU24_REG0_GYRO_DATA_Y1 0x27
90#define C6DOFIMU24_REG0_GYRO_DATA_Y0 0x28
91#define C6DOFIMU24_REG0_GYRO_DATA_Z1 0x29
92#define C6DOFIMU24_REG0_GYRO_DATA_Z0 0x2A
93#define C6DOFIMU24_REG0_TMST_FSYNCH 0x2B
94#define C6DOFIMU24_REG0_TMST_FSYNCL 0x2C
95#define C6DOFIMU24_REG0_INT_STATUS 0x2D
96#define C6DOFIMU24_REG0_FIFO_COUNTH 0x2E
97#define C6DOFIMU24_REG0_FIFO_COUNTL 0x2F
98#define C6DOFIMU24_REG0_FIFO_DATA 0x30
99#define C6DOFIMU24_REG0_INT_STATUS2 0x37
100#define C6DOFIMU24_REG0_SIGNAL_PATH_RESET 0x4B
101#define C6DOFIMU24_REG0_INTF_CONFIG0 0x4C
102#define C6DOFIMU24_REG0_INTF_CONFIG1 0x4D
103#define C6DOFIMU24_REG0_PWR_MGMT0 0x4E
104#define C6DOFIMU24_REG0_GYRO_CONFIG0 0x4F
105#define C6DOFIMU24_REG0_ACCEL_CONFIG0 0x50
106#define C6DOFIMU24_REG0_GYRO_CONFIG1 0x51
107#define C6DOFIMU24_REG0_GYRO_ACCEL_CONFIG0 0x52
108#define C6DOFIMU24_REG0_ACCEL_CONFIG1 0x53
109#define C6DOFIMU24_REG0_TMST_CONFIG 0x54
110#define C6DOFIMU24_REG0_WOM_CONFIG 0x57
111#define C6DOFIMU24_REG0_FIFO_CONFIG1 0x5F
112#define C6DOFIMU24_REG0_FIFO_CONFIG2 0x60
113#define C6DOFIMU24_REG0_FIFO_CONFIG3 0x61
114#define C6DOFIMU24_REG0_FSYNC_CONFIG 0x62
115#define C6DOFIMU24_REG0_INT_CONFIG0 0x63
116#define C6DOFIMU24_REG0_INT_CONFIG1 0x64
117#define C6DOFIMU24_REG0_INT_SOURCE0 0x65
118#define C6DOFIMU24_REG0_INT_SOURCE1 0x66
119#define C6DOFIMU24_REG0_INT_SOURCE3 0x68
120#define C6DOFIMU24_REG0_INT_SOURCE4 0x69
121#define C6DOFIMU24_REG0_FIFO_LOST_PKT0 0x6C
122#define C6DOFIMU24_REG0_FIFO_LOST_PKT1 0x6D
123#define C6DOFIMU24_REG0_SELF_TEST_CONFIG 0x70
124#define C6DOFIMU24_REG0_WHO_AM_I 0x75
125#define C6DOFIMU24_REG0_REG_BANK_SEL 0x76
126
131#define C6DOFIMU24_REG1_SENSOR_CONFIG 0x03
132#define C6DOFIMU24_REG1_GYRO_CONFIG_STATIC2 0x0B
133#define C6DOFIMU24_REG1_GYRO_CONFIG_STATIC3 0x0C
134#define C6DOFIMU24_REG1_GYRO_CONFIG_STATIC4 0x0D
135#define C6DOFIMU24_REG1_GYRO_CONFIG_STATIC5 0x0E
136#define C6DOFIMU24_REG1_GYRO_CONFIG_STATIC6 0x0F
137#define C6DOFIMU24_REG1_GYRO_CONFIG_STATIC7 0x10
138#define C6DOFIMU24_REG1_GYRO_CONFIG_STATIC8 0x11
139#define C6DOFIMU24_REG1_GYRO_CONFIG_STATIC9 0x12
140#define C6DOFIMU24_REG1_GYRO_CONFIG_STATIC10 0x13
141#define C6DOFIMU24_REG1_XG_ST_DATA 0x5F
142#define C6DOFIMU24_REG1_YG_ST_DATA 0x60
143#define C6DOFIMU24_REG1_ZG_ST_DATA 0x61
144#define C6DOFIMU24_REG1_TMSTVAL0 0x62
145#define C6DOFIMU24_REG1_TMSTVAL1 0x63
146#define C6DOFIMU24_REG1_TMSTVAL2 0x64
147#define C6DOFIMU24_REG1_INTF_CONFIG4 0x7A
148#define C6DOFIMU24_REG1_INTF_CONFIG5 0x7B
149
154#define C6DOFIMU24_REG2_ACCEL_CONFIG_STATIC2 0x03
155#define C6DOFIMU24_REG2_ACCEL_CONFIG_STATIC3 0x04
156#define C6DOFIMU24_REG2_ACCEL_CONFIG_STATIC4 0x05
157#define C6DOFIMU24_REG2_XA_ST_DATA 0x3B
158#define C6DOFIMU24_REG2_YA_ST_DATA 0x3C
159#define C6DOFIMU24_REG2_ZA_ST_DATA 0x3D
160
165#define C6DOFIMU24_REG4_ACCEL_WOM_X_THR 0x4A
166#define C6DOFIMU24_REG4_ACCEL_WOM_Y_THR 0x4B
167#define C6DOFIMU24_REG4_ACCEL_WOM_Z_THR 0x4C
168#define C6DOFIMU24_REG4_OFFSET_USER_0 0x77
169#define C6DOFIMU24_REG4_OFFSET_USER_1 0x78
170#define C6DOFIMU24_REG4_OFFSET_USER_2 0x79
171#define C6DOFIMU24_REG4_OFFSET_USER_3 0x7A
172#define C6DOFIMU24_REG4_OFFSET_USER_4 0x7B
173#define C6DOFIMU24_REG4_OFFSET_USER_5 0x7C
174#define C6DOFIMU24_REG4_OFFSET_USER_6 0x7D
175#define C6DOFIMU24_REG4_OFFSET_USER_7 0x7E
176#define C6DOFIMU24_REG4_OFFSET_USER_8 0x7F
177 // c6dofimu24_reg
179
184
189
194#define C6DOFIMU24_USER_BANK_0 0x00
195#define C6DOFIMU24_USER_BANK_1 0x01
196#define C6DOFIMU24_USER_BANK_2 0x02
197#define C6DOFIMU24_USER_BANK_4 0x04
198
203#define C6DOFIMU24_DEVICE_CONFIG_SPI_MODE_0_3 0x00
204#define C6DOFIMU24_DEVICE_CONFIG_SPI_MODE_1_2 0x10
205#define C6DOFIMU24_DEVICE_CONFIG_SPI_MODE_MASK 0x10
206#define C6DOFIMU24_DEVICE_CONFIG_SOFT_RESET 0x01
207
212#define C6DOFIMU24_INT_CONFIG_INT2_MODE_PULSE 0x00
213#define C6DOFIMU24_INT_CONFIG_INT2_MODE_LATCH 0x20
214#define C6DOFIMU24_INT_CONFIG_INT2_MODE_MASK 0x20
215#define C6DOFIMU24_INT_CONFIG_INT2_DRV_OD 0x00
216#define C6DOFIMU24_INT_CONFIG_INT2_DRV_PP 0x10
217#define C6DOFIMU24_INT_CONFIG_INT2_DRV_MASK 0x10
218#define C6DOFIMU24_INT_CONFIG_INT2_POL_LOW 0x00
219#define C6DOFIMU24_INT_CONFIG_INT2_POL_HIGH 0x08
220#define C6DOFIMU24_INT_CONFIG_INT2_POL_MASK 0x08
221#define C6DOFIMU24_INT_CONFIG_INT1_MODE_PULSE 0x00
222#define C6DOFIMU24_INT_CONFIG_INT1_MODE_LATCH 0x04
223#define C6DOFIMU24_INT_CONFIG_INT1_MODE_MASK 0x04
224#define C6DOFIMU24_INT_CONFIG_INT1_DRV_OD 0x00
225#define C6DOFIMU24_INT_CONFIG_INT1_DRV_PP 0x02
226#define C6DOFIMU24_INT_CONFIG_INT1_DRV_MASK 0x02
227#define C6DOFIMU24_INT_CONFIG_INT1_POL_LOW 0x00
228#define C6DOFIMU24_INT_CONFIG_INT1_POL_HIGH 0x01
229#define C6DOFIMU24_INT_CONFIG_INT1_POL_MASK 0x01
230
235#define C6DOFIMU24_INT_CONFIG1_TPULSE_100US 0x00
236#define C6DOFIMU24_INT_CONFIG1_TPULSE_8US 0x40
237#define C6DOFIMU24_INT_CONFIG1_TPULSE_MASK 0x40
238#define C6DOFIMU24_INT_CONFIG1_TDEASSERT_100US 0x00
239#define C6DOFIMU24_INT_CONFIG1_TDEASSERT_DIS 0x20
240#define C6DOFIMU24_INT_CONFIG1_TDEASSERT_MASK 0x20
241#define C6DOFIMU24_INT_CONFIG1_ASYNC_RESET_DIS 0x00
242#define C6DOFIMU24_INT_CONFIG1_ASYNC_RESET_EN 0x10
243#define C6DOFIMU24_INT_CONFIG1_ASYNC_RESET_MASK 0x10
244
249#define C6DOFIMU24_PWR_MGMT0_TEMP_EN 0x00
250#define C6DOFIMU24_PWR_MGMT0_TEMP_DIS 0x20
251#define C6DOFIMU24_PWR_MGMT0_TEMP_MASK 0x20
252#define C6DOFIMU24_PWR_MGMT0_IDLE 0x10
253#define C6DOFIMU24_PWR_MGMT0_GYRO_MODE_OFF 0x00
254#define C6DOFIMU24_PWR_MGMT0_GYRO_MODE_STBY 0x04
255#define C6DOFIMU24_PWR_MGMT0_GYRO_MODE_LN 0x0C
256#define C6DOFIMU24_PWR_MGMT0_GYRO_MODE_MASK 0x0C
257#define C6DOFIMU24_PWR_MGMT0_ACCEL_MODE_OFF 0x00
258#define C6DOFIMU24_PWR_MGMT0_ACCEL_MODE_LP 0x02
259#define C6DOFIMU24_PWR_MGMT0_ACCEL_MODE_LN 0x03
260#define C6DOFIMU24_PWR_MGMT0_ACCEL_MODE_MASK 0x03
261
266#define C6DOFIMU24_GYRO_CONFIG0_FS_SEL_2000DPS 0x00
267#define C6DOFIMU24_GYRO_CONFIG0_FS_SEL_1000DPS 0x20
268#define C6DOFIMU24_GYRO_CONFIG0_FS_SEL_500DPS 0x40
269#define C6DOFIMU24_GYRO_CONFIG0_FS_SEL_250DPS 0x60
270#define C6DOFIMU24_GYRO_CONFIG0_FS_SEL_125DPS 0x80
271#define C6DOFIMU24_GYRO_CONFIG0_FS_SEL_62_5DPS 0xA0
272#define C6DOFIMU24_GYRO_CONFIG0_FS_SEL_31_25DPS 0xC0
273#define C6DOFIMU24_GYRO_CONFIG0_FS_SEL_15_625DPS 0xE0
274#define C6DOFIMU24_GYRO_CONFIG0_FS_SEL_MASK 0xE0
275#define C6DOFIMU24_GYRO_CONFIG0_ODR_32000HZ 0x01
276#define C6DOFIMU24_GYRO_CONFIG0_ODR_16000HZ 0x02
277#define C6DOFIMU24_GYRO_CONFIG0_ODR_8000HZ 0x03
278#define C6DOFIMU24_GYRO_CONFIG0_ODR_4000HZ 0x04
279#define C6DOFIMU24_GYRO_CONFIG0_ODR_2000HZ 0x05
280#define C6DOFIMU24_GYRO_CONFIG0_ODR_1000HZ 0x06
281#define C6DOFIMU24_GYRO_CONFIG0_ODR_200HZ 0x07
282#define C6DOFIMU24_GYRO_CONFIG0_ODR_100HZ 0x08
283#define C6DOFIMU24_GYRO_CONFIG0_ODR_50HZ 0x09
284#define C6DOFIMU24_GYRO_CONFIG0_ODR_25HZ 0x0A
285#define C6DOFIMU24_GYRO_CONFIG0_ODR_12_5HZ 0x0B
286#define C6DOFIMU24_GYRO_CONFIG0_ODR_500HZ 0x0F
287#define C6DOFIMU24_GYRO_CONFIG0_ODR_MASK 0x0F
288
293#define C6DOFIMU24_ACCEL_CONFIG0_FS_SEL_32G 0x00
294#define C6DOFIMU24_ACCEL_CONFIG0_FS_SEL_16G 0x20
295#define C6DOFIMU24_ACCEL_CONFIG0_FS_SEL_8G 0x40
296#define C6DOFIMU24_ACCEL_CONFIG0_FS_SEL_4G 0x60
297#define C6DOFIMU24_ACCEL_CONFIG0_FS_SEL_MASK 0xE0
298#define C6DOFIMU24_ACCEL_CONFIG0_ODR_32000HZ 0x01
299#define C6DOFIMU24_ACCEL_CONFIG0_ODR_16000HZ 0x02
300#define C6DOFIMU24_ACCEL_CONFIG0_ODR_8000HZ 0x03
301#define C6DOFIMU24_ACCEL_CONFIG0_ODR_4000HZ 0x04
302#define C6DOFIMU24_ACCEL_CONFIG0_ODR_2000HZ 0x05
303#define C6DOFIMU24_ACCEL_CONFIG0_ODR_1000HZ 0x06
304#define C6DOFIMU24_ACCEL_CONFIG0_ODR_200HZ 0x07
305#define C6DOFIMU24_ACCEL_CONFIG0_ODR_100HZ 0x08
306#define C6DOFIMU24_ACCEL_CONFIG0_ODR_50HZ 0x09
307#define C6DOFIMU24_ACCEL_CONFIG0_ODR_25HZ 0x0A
308#define C6DOFIMU24_ACCEL_CONFIG0_ODR_12_5HZ 0x0B
309#define C6DOFIMU24_ACCEL_CONFIG0_ODR_6_25HZ 0x0C
310#define C6DOFIMU24_ACCEL_CONFIG0_ODR_3_125HZ 0x0D
311#define C6DOFIMU24_ACCEL_CONFIG0_ODR_1_5625HZ 0x0E
312#define C6DOFIMU24_ACCEL_CONFIG0_ODR_500HZ 0x0F
313#define C6DOFIMU24_ACCEL_CONFIG0_ODR_MASK 0x0F
314
319#define C6DOFIMU24_INT_SOURCE0_UI_FSYNC_INT1_EN 0x40
320#define C6DOFIMU24_INT_SOURCE0_PLL_RDY_INT1_EN 0x20
321#define C6DOFIMU24_INT_SOURCE0_RESET_DONE_INT1_EN 0x10
322#define C6DOFIMU24_INT_SOURCE0_UI_DRDY_INT1_EN 0x08
323#define C6DOFIMU24_INT_SOURCE0_FIFO_THS_INT1_EN 0x04
324#define C6DOFIMU24_INT_SOURCE0_FIFO_FULL_INT1_EN 0x02
325#define C6DOFIMU24_INT_SOURCE0_AGC_RDY_INT1_EN 0x01
326
331#define C6DOFIMU24_INT_STATUS_UI_FSYNC 0x40
332#define C6DOFIMU24_INT_STATUS_PLL_RDY 0x20
333#define C6DOFIMU24_INT_STATUS_RESET_DONE 0x10
334#define C6DOFIMU24_INT_STATUS_DATA_RDY 0x08
335#define C6DOFIMU24_INT_STATUS_FIFO_THS 0x04
336#define C6DOFIMU24_INT_STATUS_FIFO_FULL 0x02
337#define C6DOFIMU24_INT_STATUS_AGC_RDY 0x01
338
343#define C6DOFIMU24_WHO_AM_I 0x3B
344
349#define C6DOFIMU24_GYRO_FS_SEL_15_625DPS 0x00
350#define C6DOFIMU24_GYRO_FS_SEL_31_25DPS 0x01
351#define C6DOFIMU24_GYRO_FS_SEL_62_5DPS 0x02
352#define C6DOFIMU24_GYRO_FS_SEL_125DPS 0x03
353#define C6DOFIMU24_GYRO_FS_SEL_250DPS 0x04
354#define C6DOFIMU24_GYRO_FS_SEL_500DPS 0x05
355#define C6DOFIMU24_GYRO_FS_SEL_1000DPS 0x06
356#define C6DOFIMU24_GYRO_FS_SEL_2000DPS 0x07
357#define C6DOFIMU24_GYRO_ODR_12_5HZ 0x00
358#define C6DOFIMU24_GYRO_ODR_25HZ 0x01
359#define C6DOFIMU24_GYRO_ODR_50HZ 0x02
360#define C6DOFIMU24_GYRO_ODR_100HZ 0x03
361#define C6DOFIMU24_GYRO_ODR_200HZ 0x04
362#define C6DOFIMU24_GYRO_ODR_500HZ 0x05
363#define C6DOFIMU24_GYRO_ODR_1000HZ 0x06
364#define C6DOFIMU24_GYRO_ODR_2000HZ 0x07
365#define C6DOFIMU24_GYRO_ODR_4000HZ 0x08
366#define C6DOFIMU24_GYRO_ODR_8000HZ 0x09
367#define C6DOFIMU24_GYRO_ODR_16000HZ 0x0A
368#define C6DOFIMU24_GYRO_ODR_32000HZ 0x0B
369#define C6DOFIMU24_GYRO_DATA_RES 0x7FFF
370#define C6DOFIMU24_GYRO_MIN_DPS 15.625f
371
376#define C6DOFIMU24_ACCEL_FS_SEL_4G 0x00
377#define C6DOFIMU24_ACCEL_FS_SEL_8G 0x01
378#define C6DOFIMU24_ACCEL_FS_SEL_16G 0x02
379#define C6DOFIMU24_ACCEL_FS_SEL_32G 0x03
380#define C6DOFIMU24_ACCEL_ODR_1_5625HZ 0x00
381#define C6DOFIMU24_ACCEL_ODR_3_125HZ 0x01
382#define C6DOFIMU24_ACCEL_ODR_6_25HZ 0x02
383#define C6DOFIMU24_ACCEL_ODR_12_5HZ 0x03
384#define C6DOFIMU24_ACCEL_ODR_25HZ 0x04
385#define C6DOFIMU24_ACCEL_ODR_50HZ 0x05
386#define C6DOFIMU24_ACCEL_ODR_100HZ 0x06
387#define C6DOFIMU24_ACCEL_ODR_200HZ 0x07
388#define C6DOFIMU24_ACCEL_ODR_500HZ 0x08
389#define C6DOFIMU24_ACCEL_ODR_1000HZ 0x09
390#define C6DOFIMU24_ACCEL_ODR_2000HZ 0x0A
391#define C6DOFIMU24_ACCEL_ODR_4000HZ 0x0B
392#define C6DOFIMU24_ACCEL_ODR_8000HZ 0x0C
393#define C6DOFIMU24_ACCEL_ODR_16000HZ 0x0D
394#define C6DOFIMU24_ACCEL_ODR_32000HZ 0x0E
395#define C6DOFIMU24_ACCEL_DATA_RES 0x7FFF
396#define C6DOFIMU24_ACCEL_MIN_G 4
397
402#define C6DOFIMU24_TEMP_RES 132.48f
403#define C6DOFIMU24_TEMP_OFFSET 25
404
410#define C6DOFIMU24_DEVICE_ADDRESS_0 0x68
411#define C6DOFIMU24_DEVICE_ADDRESS_1 0x69
412
421#define C6DOFIMU24_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
422#define C6DOFIMU24_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
423 // c6dofimu24_set
425
430
435
440#define C6DOFIMU24_MAP_MIKROBUS( cfg, mikrobus ) \
441 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
442 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
443 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
444 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
445 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
446 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
447 cfg.int2 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
448 cfg.int1 = MIKROBUS( mikrobus, MIKROBUS_INT )
449 // c6dofimu24_map // c6dofimu24
452
463
468struct c6dofimu24_s;
469typedef err_t ( *c6dofimu24_master_io_t )( struct c6dofimu24_s*, uint8_t, uint8_t*, uint8_t );
470
475typedef struct c6dofimu24_s
476{
477 digital_in_t int2;
478 digital_in_t int1;
479
480 i2c_master_t i2c;
481 spi_master_t spi;
482
484 pin_name_t chip_select;
486
489
490 float gyro_sens;
492
494
499typedef struct
500{
501 pin_name_t scl;
502 pin_name_t sda;
503 pin_name_t miso;
504 pin_name_t mosi;
505 pin_name_t sck;
506 pin_name_t cs;
507 pin_name_t int2;
508 pin_name_t int1;
509
510 uint32_t i2c_speed;
511 uint8_t i2c_address;
512
513 uint32_t spi_speed;
514 spi_master_mode_t spi_mode;
515 spi_master_chip_select_polarity_t cs_polarity;
516
518
520
525typedef struct
526{
527 float x;
528 float y;
529 float z;
530
532
544
555
561
572
588
603
617
632err_t c6dofimu24_write_regs ( c6dofimu24_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len );
633
648err_t c6dofimu24_read_regs ( c6dofimu24_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len );
649
662err_t c6dofimu24_write_reg ( c6dofimu24_t *ctx, uint8_t reg, uint8_t data_in );
663
676err_t c6dofimu24_read_reg ( c6dofimu24_t *ctx, uint8_t reg, uint8_t *data_out );
677
689err_t c6dofimu24_select_reg_bank ( c6dofimu24_t *ctx, uint8_t bank_num );
690
700
710
722
734
746
759err_t c6dofimu24_set_gyro_fs_odr ( c6dofimu24_t *ctx, uint8_t fs_sel, uint8_t odr );
760
773err_t c6dofimu24_set_accel_fs_odr ( c6dofimu24_t *ctx, uint8_t fs_sel, uint8_t odr );
774
788
802
814err_t c6dofimu24_read_temperature ( c6dofimu24_t *ctx, float *temperature );
815
829
830#ifdef __cplusplus
831}
832#endif
833#endif // C6DOFIMU24_H
834 // c6dofimu24
836
837// ------------------------------------------------------------------------ END
err_t(* c6dofimu24_master_io_t)(struct c6dofimu24_s *, uint8_t, uint8_t *, uint8_t)
Definition c6dofimu24.h:469
struct c6dofimu24_s c6dofimu24_t
6DOF IMU 24 Click context object.
c6dofimu24_drv_t
6DOF IMU 24 Click driver selector.
Definition c6dofimu24.h:458
@ C6DOFIMU24_DRV_SEL_SPI
Definition c6dofimu24.h:459
@ C6DOFIMU24_DRV_SEL_I2C
Definition c6dofimu24.h:460
c6dofimu24_return_value_t
6DOF IMU 24 Click return value data.
Definition c6dofimu24.h:550
@ C6DOFIMU24_OK
Definition c6dofimu24.h:551
@ C6DOFIMU24_ERROR
Definition c6dofimu24.h:552
err_t c6dofimu24_default_cfg(c6dofimu24_t *ctx)
6DOF IMU 24 default configuration function.
err_t c6dofimu24_set_accel_fs_odr(c6dofimu24_t *ctx, uint8_t fs_sel, uint8_t odr)
6DOF IMU 24 set accel fs odr function.
err_t c6dofimu24_write_regs(c6dofimu24_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
6DOF IMU 24 write registers function.
err_t c6dofimu24_read_regs(c6dofimu24_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
6DOF IMU 24 read registers function.
err_t c6dofimu24_read_accel(c6dofimu24_t *ctx, c6dofimu24_axes_t *accel)
6DOF IMU 24 read accel function.
err_t c6dofimu24_read_temperature(c6dofimu24_t *ctx, float *temperature)
6DOF IMU 24 read temperature function.
err_t c6dofimu24_read_reg(c6dofimu24_t *ctx, uint8_t reg, uint8_t *data_out)
6DOF IMU 24 read register function.
err_t c6dofimu24_read_gyro(c6dofimu24_t *ctx, c6dofimu24_axes_t *gyro)
6DOF IMU 24 read gyro function.
err_t c6dofimu24_init(c6dofimu24_t *ctx, c6dofimu24_cfg_t *cfg)
6DOF IMU 24 initialization function.
void c6dofimu24_cfg_setup(c6dofimu24_cfg_t *cfg)
6DOF IMU 24 configuration object setup function.
err_t c6dofimu24_write_reg(c6dofimu24_t *ctx, uint8_t reg, uint8_t data_in)
6DOF IMU 24 write register function.
err_t c6dofimu24_reset_device(c6dofimu24_t *ctx)
6DOF IMU 24 reset device function.
err_t c6dofimu24_check_communication(c6dofimu24_t *ctx)
6DOF IMU 24 check communication function.
err_t c6dofimu24_clear_data_ready(c6dofimu24_t *ctx)
6DOF IMU 24 clear data ready function.
err_t c6dofimu24_set_gyro_fs_odr(c6dofimu24_t *ctx, uint8_t fs_sel, uint8_t odr)
6DOF IMU 24 set gyro fs odr function.
void c6dofimu24_drv_interface_sel(c6dofimu24_cfg_t *cfg, c6dofimu24_drv_t drv_sel)
6DOF IMU 24 driver interface setup function.
err_t c6dofimu24_read_data(c6dofimu24_t *ctx, c6dofimu24_data_t *data_out)
6DOF IMU 24 read data function.
err_t c6dofimu24_select_reg_bank(c6dofimu24_t *ctx, uint8_t bank_num)
6DOF IMU 24 select reg bank function.
uint8_t c6dofimu24_get_int2_pin(c6dofimu24_t *ctx)
6DOF IMU 24 get int2 pin function.
uint8_t c6dofimu24_get_int1_pin(c6dofimu24_t *ctx)
6DOF IMU 24 get int1 pin function.
This file contains SPI specific macros, functions, etc.
6DOF IMU 24 Click axes data structure.
Definition c6dofimu24.h:526
float y
Definition c6dofimu24.h:528
float x
Definition c6dofimu24.h:527
float z
Definition c6dofimu24.h:529
6DOF IMU 24 Click configuration object.
Definition c6dofimu24.h:500
pin_name_t int1
Definition c6dofimu24.h:508
pin_name_t int2
Definition c6dofimu24.h:507
uint32_t i2c_speed
Definition c6dofimu24.h:510
c6dofimu24_drv_t drv_sel
Definition c6dofimu24.h:517
spi_master_chip_select_polarity_t cs_polarity
Definition c6dofimu24.h:515
pin_name_t sck
Definition c6dofimu24.h:505
spi_master_mode_t spi_mode
Definition c6dofimu24.h:514
pin_name_t mosi
Definition c6dofimu24.h:504
uint32_t spi_speed
Definition c6dofimu24.h:513
pin_name_t scl
Definition c6dofimu24.h:501
pin_name_t miso
Definition c6dofimu24.h:503
pin_name_t sda
Definition c6dofimu24.h:502
pin_name_t cs
Definition c6dofimu24.h:506
uint8_t i2c_address
Definition c6dofimu24.h:511
6DOF IMU 24 Click data structure.
Definition c6dofimu24.h:538
c6dofimu24_axes_t accel
Definition c6dofimu24.h:540
c6dofimu24_axes_t gyro
Definition c6dofimu24.h:539
float temperature
Definition c6dofimu24.h:541
6DOF IMU 24 Click context object.
Definition c6dofimu24.h:476
digital_in_t int2
Definition c6dofimu24.h:477
spi_master_t spi
Definition c6dofimu24.h:481
c6dofimu24_master_io_t write_f
Definition c6dofimu24.h:487
c6dofimu24_master_io_t read_f
Definition c6dofimu24.h:488
c6dofimu24_drv_t drv_sel
Definition c6dofimu24.h:485
digital_in_t int1
Definition c6dofimu24.h:478
float gyro_sens
Definition c6dofimu24.h:490
i2c_master_t i2c
Definition c6dofimu24.h:480
float accel_sens
Definition c6dofimu24.h:491
uint8_t slave_address
Definition c6dofimu24.h:483
pin_name_t chip_select
Definition c6dofimu24.h:484