39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
52#include "drv_spi_master.h"
75#define C6DOFIMU16_REG_ACCEL_DATA_X1_UI 0x00
76#define C6DOFIMU16_REG_ACCEL_DATA_X0_UI 0x01
77#define C6DOFIMU16_REG_ACCEL_DATA_Y1_UI 0x02
78#define C6DOFIMU16_REG_ACCEL_DATA_Y0_UI 0x03
79#define C6DOFIMU16_REG_ACCEL_DATA_Z1_UI 0x04
80#define C6DOFIMU16_REG_ACCEL_DATA_Z0_UI 0x05
81#define C6DOFIMU16_REG_GYRO_DATA_X1_UI 0x06
82#define C6DOFIMU16_REG_GYRO_DATA_X0_UI 0x07
83#define C6DOFIMU16_REG_GYRO_DATA_Y1_UI 0x08
84#define C6DOFIMU16_REG_GYRO_DATA_Y0_UI 0x09
85#define C6DOFIMU16_REG_GYRO_DATA_Z1_UI 0x0A
86#define C6DOFIMU16_REG_GYRO_DATA_Z0_UI 0x0B
87#define C6DOFIMU16_REG_TEMP_DATA1_UI 0x0C
88#define C6DOFIMU16_REG_TEMP_DATA0_UI 0x0D
89#define C6DOFIMU16_REG_TMST_FSYNCH 0x0E
90#define C6DOFIMU16_REG_TMST_FSYNCL 0x0F
91#define C6DOFIMU16_REG_PWR_MGMNT0 0x10
92#define C6DOFIMU16_REG_FIFO_COUNT_0 0x12
93#define C6DOFIMU16_REG_FIFO_COUNT_1 0x13
94#define C6DOFIMU16_REG_FIFO_DATA 0x14
95#define C6DOFIMU16_REG_INT1_CONFIG0 0x16
96#define C6DOFIMU16_REG_INT1_CONFIG1 0x17
97#define C6DOFIMU16_REG_INT1_CONFIG2 0x18
98#define C6DOFIMU16_REG_INT1_STATUS0 0x19
99#define C6DOFIMU16_REG_ACCEL_CONFIG0 0x1B
100#define C6DOFIMU16_REG_GYRO_CONFIG0 0x1C
101#define C6DOFIMU16_REG_FIFO_CONFIG0 0x1D
102#define C6DOFIMU16_REG_FIFO_CONFIG1_0 0x1E
103#define C6DOFIMU16_REG_FIFO_CONFIG1_1 0x1F
104#define C6DOFIMU16_REG_FIFO_CONFIG2 0x20
105#define C6DOFIMU16_REG_FIFO_CONFIG3 0x21
106#define C6DOFIMU16_REG_FIFO_CONFIG4 0x22
107#define C6DOFIMU16_REG_DMP_EXT_SEN_ODR_CFG 0x27
108#define C6DOFIMU16_REG_EDMP_APEX_EN0 0x29
109#define C6DOFIMU16_REG_EDMP_APEX_EN1 0x2A
110#define C6DOFIMU16_REG_APEX_BUFFER_MGMT 0x2B
111#define C6DOFIMU16_REG_INTF_CONFIG0 0x2C
112#define C6DOFIMU16_REG_INTF_CONFIG1_OVRD 0x2D
113#define C6DOFIMU16_REG_IOC_PAD_SCENARIO 0x2F
114#define C6DOFIMU16_REG_IOC_PAD_SCENARIO_AUX_OVRD 0x30
115#define C6DOFIMU16_REG_IOC_PAD_SCENARIO_OVRD 0x31
116#define C6DOFIMU16_REG_DRIVE_CONFIG0 0x32
117#define C6DOFIMU16_REG_DRIVE_CONFIG1 0x33
118#define C6DOFIMU16_REG_DRIVE_CONFIG2 0x34
119#define C6DOFIMU16_REG_INT_APEX_CONFIG1 0x3A
120#define C6DOFIMU16_REG_INT_APEX_STATUS0 0x3B
121#define C6DOFIMU16_REG_INT_APEX_STATUS1 0x3C
122#define C6DOFIMU16_REG_INT2_CONFIG0 0x56
123#define C6DOFIMU16_REG_INT2_CONFIG1 0x57
124#define C6DOFIMU16_REG_INT2_CONFIG2 0x58
125#define C6DOFIMU16_REG_INT2_STATUS0 0x59
126#define C6DOFIMU16_REG_WHO_AM_I 0x72
127#define C6DOFIMU16_REG_REG_HOST_MSG 0x73
128#define C6DOFIMU16_REG_IREG_ADDR_15_8 0x7C
129#define C6DOFIMU16_REG_IREG_ADDR_7_0 0x7D
130#define C6DOFIMU16_REG_IREG_DATA 0x7E
131#define C6DOFIMU16_REG_REG_MISC2 0x7F
149#define C6DOFIMU16_GYRO_MODE_OFF 0x00
150#define C6DOFIMU16_GYRO_MODE_STANDBY 0x04
151#define C6DOFIMU16_GYRO_MODE_LOW_POWER 0x08
152#define C6DOFIMU16_GYRO_MODE_LOW_NOISE 0x0C
153#define C6DOFIMU16_ACCEL_MODE_OFF 0x00
154#define C6DOFIMU16_ACCEL_MODE_STANDBY 0x01
155#define C6DOFIMU16_ACCEL_MODE_LOW_POWER 0x02
156#define C6DOFIMU16_ACCEL_MODE_LOW_NOISE 0x03
162#define C6DOFIMU16_GYRO_UI_FS_SEL_MASK 0xF0
163#define C6DOFIMU16_GYRO_UI_FS_SEL_2000DPS 0x10
164#define C6DOFIMU16_GYRO_UI_FS_SEL_1000DPS 0x20
165#define C6DOFIMU16_GYRO_UI_FS_SEL_500DPS 0x30
166#define C6DOFIMU16_GYRO_UI_FS_SEL_250DPS 0x40
167#define C6DOFIMU16_GYRO_UI_FS_SEL_125DPS 0x50
168#define C6DOFIMU16_GYRO_UI_FS_SEL_62_5DPS 0x60
169#define C6DOFIMU16_GYRO_UI_FS_SEL_31_25DPS 0x70
170#define C6DOFIMU16_GYRO_UI_FS_SEL_15_625DPS 0x80
176#define C6DOFIMU16_ACCEL_UI_FS_SEL_MASK 0x70
177#define C6DOFIMU16_ACCEL_UI_FS_SEL_16g 0x10
178#define C6DOFIMU16_ACCEL_UI_FS_SEL_8g 0x20
179#define C6DOFIMU16_ACCEL_UI_FS_SEL_4g 0x30
180#define C6DOFIMU16_ACCEL_UI_FS_SEL_2g 0x40
186#define C6DOFIMU16_ACCEL_ODR_6_4_KHZ 0x03
187#define C6DOFIMU16_ACCEL_ODR_3_2_KHZ 0x04
188#define C6DOFIMU16_ACCEL_ODR_1_6_KHZ 0x05
189#define C6DOFIMU16_ACCEL_ODR_800_HZ 0x06
190#define C6DOFIMU16_ACCEL_ODR_400_HZ 0x07
191#define C6DOFIMU16_ACCEL_ODR_200_HZ 0x08
192#define C6DOFIMU16_ACCEL_ODR_100_HZ 0x09
193#define C6DOFIMU16_ACCEL_ODR_50_HZ 0x0A
194#define C6DOFIMU16_ACCEL_ODR_25_HZ 0x0B
195#define C6DOFIMU16_ACCEL_ODR_12_5_HZ 0x0C
196#define C6DOFIMU16_ACCEL_ODR_6_25_HZ 0x0D
197#define C6DOFIMU16_ACCEL_ODR_3_125_HZ 0x0E
198#define C6DOFIMU16_ACCEL_ODR_1_5625_HZ 0x0F
204#define C6DOFIMU16_GYRO_ODR_6_4_KHZ 0x03
205#define C6DOFIMU16_GYRO_ODR_3_2_KHZ 0x04
206#define C6DOFIMU16_GYRO_ODR_1_6_KHZ 0x05
207#define C6DOFIMU16_GYRO_ODR_800_HZ 0x06
208#define C6DOFIMU16_GYRO_ODR_400_HZ 0x07
209#define C6DOFIMU16_GYRO_ODR_200_HZ 0x08
210#define C6DOFIMU16_GYRO_ODR_100_HZ 0x09
211#define C6DOFIMU16_GYRO_ODR_50_HZ 0x0A
212#define C6DOFIMU16_GYRO_ODR_25_HZ 0x0B
213#define C6DOFIMU16_GYRO_ODR_12_5_HZ 0x0C
214#define C6DOFIMU16_GYRO_ODR_6_25_HZ 0x0D
215#define C6DOFIMU16_GYRO_ODR_3_125_HZ 0x0E
216#define C6DOFIMU16_GYRO_ODR_1_5625_HZ 0x0F
222#define C6DOFIMU16_SOFTWARE_RESET 0x02
228#define C6DOFIMU16_DEVICE_ID 0xE5
235#define C6DOFIMU16_ACCEL_2G_CONV_MUL 16384u
236#define C6DOFIMU16_ACCEL_4G_CONV_MUL 8192u
237#define C6DOFIMU16_ACCEL_8G_CONV_MUL 4096u
238#define C6DOFIMU16_ACCEL_16G_CONV_MUL 2048u
239#define C6DOFIMU16_GYRO_2000DPS_CONV_MUL 16.4f
240#define C6DOFIMU16_GYRO_1000DPS_CONV_MUL 32.8f
241#define C6DOFIMU16_GYRO_500DPS_CONV_MUL 65.5f
242#define C6DOFIMU16_GYRO_250DPS_CONV_MUL 131.0f
243#define C6DOFIMU16_GYRO_125DPS_CONV_MUL 262.0f
244#define C6DOFIMU16_GYRO_62_5DPS_CONV_MUL 524.3f
245#define C6DOFIMU16_GYRO_31_25DPS_CONV_MUL 1048.6f
246#define C6DOFIMU16_GYRO_15_625DPS_CONV_MUL 2097.2f
253#define C6DOFIMU16_DEVICE_ADDRESS_0 0x68
254#define C6DOFIMU16_DEVICE_ADDRESS_1 0x69
264#define C6DOFIMU16_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
265#define C6DOFIMU16_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
283#define C6DOFIMU16_MAP_MIKROBUS( cfg, mikrobus ) \
284 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
285 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
286 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
287 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
288 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
289 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
290 cfg.int1 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
291 cfg.int2 = MIKROBUS( mikrobus, MIKROBUS_INT )
struct c6dofimu16_s c6dofimu16_t
6DOF IMU 16 Click context object.
err_t(* c6dofimu16_master_io_t)(struct c6dofimu16_s *, uint8_t, uint8_t *, uint8_t)
Definition c6dofimu16.h:312
c6dofimu16_return_value_t
6DOF IMU 16 Click return value data.
Definition c6dofimu16.h:378
@ C6DOFIMU16_ERROR
Definition c6dofimu16.h:380
@ C6DOFIMU16_OK
Definition c6dofimu16.h:379
c6dofimu16_drv_t
6DOF IMU 16 Click driver selector.
Definition c6dofimu16.h:301
@ C6DOFIMU16_DRV_SEL_I2C
Definition c6dofimu16.h:303
@ C6DOFIMU16_DRV_SEL_SPI
Definition c6dofimu16.h:302
err_t c6dofimu16_get_gyro_data(c6dofimu16_t *ctx, c6dofimu16_axis_t *gyro_data)
6DOF IMU 16 read gyro function.
err_t c6dofimu16_sw_reset(c6dofimu16_t *ctx)
6DOF IMU 16 software reset device function.
uint8_t c6dofimu16_get_int1_pin(c6dofimu16_t *ctx)
6DOF IMU 16 get int1 pin function.
err_t c6dofimu16_reg_write(c6dofimu16_t *ctx, uint8_t reg, uint8_t data_in)
6DOF IMU 16 data writing function.
err_t c6dofimu16_generic_read(c6dofimu16_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
6DOF IMU 16 data reading function.
err_t c6dofimu16_generic_write(c6dofimu16_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
6DOF IMU 16 data writing function.
void c6dofimu16_cfg_setup(c6dofimu16_cfg_t *cfg)
6DOF IMU 16 configuration object setup function.
void c6dofimu16_drv_interface_sel(c6dofimu16_cfg_t *cfg, c6dofimu16_drv_t drv_sel)
6DOF IMU 16 driver interface setup function.
uint8_t c6dofimu16_get_int2_pin(c6dofimu16_t *ctx)
6DOF IMU 16 get int2 pin function.
err_t c6dofimu16_reg_read(c6dofimu16_t *ctx, uint8_t reg, uint8_t *data_out)
6DOF IMU 16 register data reading function.
err_t c6dofimu16_get_accel_data(c6dofimu16_t *ctx, c6dofimu16_axis_t *accel_data)
6DOF IMU 16 read accel function.
err_t c6dofimu16_init(c6dofimu16_t *ctx, c6dofimu16_cfg_t *cfg)
6DOF IMU 16 initialization function.
err_t c6dofimu16_default_cfg(c6dofimu16_t *ctx)
6DOF IMU 16 default configuration function.
This file contains SPI specific macros, functions, etc.
6DOF IMU 16 Click axes data structure.
Definition c6dofimu16.h:366
float y_data
Definition c6dofimu16.h:368
float z_data
Definition c6dofimu16.h:369
float x_data
Definition c6dofimu16.h:367
6DOF IMU 16 Click configuration object.
Definition c6dofimu16.h:340
pin_name_t int1
Definition c6dofimu16.h:347
c6dofimu16_drv_t drv_sel
Definition c6dofimu16.h:357
pin_name_t int2
Definition c6dofimu16.h:348
uint32_t i2c_speed
Definition c6dofimu16.h:350
spi_master_chip_select_polarity_t cs_polarity
Definition c6dofimu16.h:355
pin_name_t sck
Definition c6dofimu16.h:345
spi_master_mode_t spi_mode
Definition c6dofimu16.h:354
pin_name_t mosi
Definition c6dofimu16.h:344
uint32_t spi_speed
Definition c6dofimu16.h:353
pin_name_t scl
Definition c6dofimu16.h:341
pin_name_t miso
Definition c6dofimu16.h:343
pin_name_t sda
Definition c6dofimu16.h:342
pin_name_t cs
Definition c6dofimu16.h:346
uint8_t i2c_address
Definition c6dofimu16.h:351
6DOF IMU 16 Click context object.
Definition c6dofimu16.h:319
c6dofimu16_drv_t drv_sel
Definition c6dofimu16.h:328
digital_in_t int2
Definition c6dofimu16.h:321
spi_master_t spi
Definition c6dofimu16.h:324
c6dofimu16_master_io_t write_f
Definition c6dofimu16.h:330
digital_in_t int1
Definition c6dofimu16.h:320
i2c_master_t i2c
Definition c6dofimu16.h:323
c6dofimu16_master_io_t read_f
Definition c6dofimu16.h:331
uint8_t slave_address
Definition c6dofimu16.h:326
pin_name_t chip_select
Definition c6dofimu16.h:327