Go to the documentation of this file.
42 #ifdef PREINIT_SUPPORTED
46 #ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52 #include "drv_digital_out.h"
53 #include "drv_digital_in.h"
54 #include "drv_i2c_master.h"
55 #include "drv_spi_master.h"
68 #define C6DOFIMU2_MAP_MIKROBUS( cfg, mikrobus ) \
69 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
70 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
71 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
72 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
73 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
74 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
75 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
82 #define C6DOFIMU2_MASTER_I2C 0
83 #define C6DOFIMU2_MASTER_SPI 1
90 #define C6DOFIMU2_RETVAL uint8_t
92 #define C6DOFIMU2_OK 0x00
93 #define C6DOFIMU2_INIT_ERROR 0xFF
100 #define C6DOFIMU2_I2C_ADDR 0x68
107 #define C6DOFIMU2_REG_CHIP_ID 0x00
108 #define C6DOFIMU2_REG_ERROR 0x02
109 #define C6DOFIMU2_REG_PMU_STATUS 0x03
110 #define C6DOFIMU2_REG_AUX_DATA 0x04
111 #define C6DOFIMU2_REG_GYRO_DATA 0x0C
112 #define C6DOFIMU2_REG_ACCEL_DATA 0x12
113 #define C6DOFIMU2_REG_STATUS 0x1B
114 #define C6DOFIMU2_REG_INT_STATUS 0x1C
115 #define C6DOFIMU2_REG_FIFO_LENGTH 0x22
116 #define C6DOFIMU2_REG_FIFO_DATA 0x24
117 #define C6DOFIMU2_REG_ACCEL_CONFIG 0x40
118 #define C6DOFIMU2_REG_ACCEL_RANGE 0x41
119 #define C6DOFIMU2_REG_GYRO_CONFIG 0x42
120 #define C6DOFIMU2_REG_GYRO_RANGE 0x43
121 #define C6DOFIMU2_REG_AUX_ODR 0x44
122 #define C6DOFIMU2_REG_FIFO_DOWN 0x45
123 #define C6DOFIMU2_REG_FIFO_CONFIG_0 0x46
124 #define C6DOFIMU2_REG_FIFO_CONFIG_1 0x47
125 #define C6DOFIMU2_REG_AUX_IF_0 0x4B
126 #define C6DOFIMU2_REG_AUX_IF_1 0x4C
127 #define C6DOFIMU2_REG_AUX_IF_2 0x4D
128 #define C6DOFIMU2_REG_AUX_IF_3 0x4E
129 #define C6DOFIMU2_REG_AUX_IF_4 0x4F
130 #define C6DOFIMU2_REG_INT_ENABLE_0 0x50
131 #define C6DOFIMU2_REG_INT_ENABLE_1 0x51
132 #define C6DOFIMU2_REG_INT_ENABLE_2 0x52
133 #define C6DOFIMU2_REG_INT_OUT_CTRL 0x53
134 #define C6DOFIMU2_REG_INT_LATCH 0x54
135 #define C6DOFIMU2_REG_INT_MAP_0 0x55
136 #define C6DOFIMU2_REG_INT_MAP_1 0x56
137 #define C6DOFIMU2_REG_INT_MAP_2 0x57
138 #define C6DOFIMU2_REG_INT_DATA_0 0x58
139 #define C6DOFIMU2_REG_INT_DATA_1 0x59
140 #define C6DOFIMU2_REG_INT_LOWHIGH_0 0x5A
141 #define C6DOFIMU2_REG_INT_LOWHIGH_1 0x5B
142 #define C6DOFIMU2_REG_INT_LOWHIGH_2 0x5C
143 #define C6DOFIMU2_REG_INT_LOWHIGH_3 0x5D
144 #define C6DOFIMU2_REG_INT_LOWHIGH_4 0x5E
145 #define C6DOFIMU2_REG_INT_MOTION_0 0x5F
146 #define C6DOFIMU2_REG_INT_MOTION_1 0x60
147 #define C6DOFIMU2_REG_INT_MOTION_2 0x61
148 #define C6DOFIMU2_REG_INT_MOTION_3 0x62
149 #define C6DOFIMU2_REG_INT_TAP_0 0x63
150 #define C6DOFIMU2_REG_INT_TAP_1 0x64
151 #define C6DOFIMU2_REG_INT_ORIENT_0 0x65
152 #define C6DOFIMU2_REG_INT_ORIENT_1 0x66
153 #define C6DOFIMU2_REG_INT_FLAT_0 0x67
154 #define C6DOFIMU2_REG_INT_FLAT_1 0x68
155 #define C6DOFIMU2_REG_FOC_CONF 0x69
156 #define C6DOFIMU2_REG_CONF 0x6A
157 #define C6DOFIMU2_REG_NV_CONF 0x70
164 #define C6DOFIMU2_CFG_IF_CONF 0x6B
165 #define C6DOFIMU2_CFG_SELF_TEST 0x6D
166 #define C6DOFIMU2_CFG_OFFSET 0x71
167 #define C6DOFIMU2_CFG_OFFSET_CONF 0x77
168 #define C6DOFIMU2_CFG_INT_STEP_CNT_0 0x78
169 #define C6DOFIMU2_CFG_INT_STEP_CONFIG_0 0x7A
170 #define C6DOFIMU2_CFG_INT_STEP_CONFIG_1 0x7B
171 #define C6DOFIMU2_CFG_COMMAND 0x7E
172 #define C6DOFIMU2_CFG_SPI_COMM_TEST 0x7F
173 #define C6DOFIMU2_CFG_INTL_PULLUP_CONF 0x85
180 #define C6DOFIMU2_CMD_ACCEL_NORMAL 0x11
181 #define C6DOFIMU2_CMD_ACCEL_LOW_PWR 0x12
182 #define C6DOFIMU2_CMD_GYRO_NORMAL 0x15
183 #define C6DOFIMU2_CMD_GYRO_FAST 0x7E
184 #define C6DOFIMU2_CMD_SEL_I2C 0x00
185 #define C6DOFIMU2_CMD_SEL_SPI 0x01
195 #define C6DOFIMU2_GYRO_X_L 0x0C
196 #define C6DOFIMU2_GYRO_X_H 0x0D
197 #define C6DOFIMU2_GYRO_Y_L 0x0E
198 #define C6DOFIMU2_GYRO_Y_H 0x0F
199 #define C6DOFIMU2_GYRO_Z_L 0x10
200 #define C6DOFIMU2_GYRO_Z_H 0x11
204 #define C6DOFIMU2_ACCEL_X_L 0x12
205 #define C6DOFIMU2_ACCEL_X_H 0x13
206 #define C6DOFIMU2_ACCEL_Y_L 0x14
207 #define C6DOFIMU2_ACCEL_Y_H 0x15
208 #define C6DOFIMU2_ACCEL_Z_L 0x16
209 #define C6DOFIMU2_ACCEL_Z_H 0x17
430 #endif // _C6DOFIMU2_H_
c6dofimu2_gyro_data_t gyro_data
Definition: main.c:39
Gyro data object definition.
Definition: c6dofimu2.h:310
void c6dofimu2_default_cfg(c6dofimu2_t *ctx, c6dofimu2_cfg_t *cfg)
Click Default Configuration function.
C6DOFIMU2_RETVAL c6dofimu2_init(c6dofimu2_t *ctx, c6dofimu2_cfg_t *cfg)
Initialization function.
uint8_t i2c_address
Definition: c6dofimu2.h:279
spi_master_mode_t spi_mode
Definition: c6dofimu2.h:281
int16_t gyro_y
Definition: c6dofimu2.h:312
c6dofimu2_select_t master_sel
Definition: c6dofimu2.h:254
c6dofimu2_accel_data_t accel_data
Definition: main.c:38
Click configuration structure definition.
Definition: c6dofimu2.h:262
Click ctx object definition.
Definition: c6dofimu2.h:234
int16_t accel_x
Definition: c6dofimu2.h:300
pin_name_t mosi
Definition: c6dofimu2.h:268
struct c6dofimu2_s c6dofimu2_t
Click ctx object definition.
spi_master_chip_select_polarity_t cs_polarity
Definition: c6dofimu2.h:282
int16_t accel_z
Definition: c6dofimu2.h:302
Accel data object definition.
Definition: c6dofimu2.h:299
pin_name_t scl
Definition: c6dofimu2.h:265
c6dofimu2_select_t sel
Definition: c6dofimu2.h:284
int16_t c6dofimu2_get_axis(c6dofimu2_t *ctx, uint8_t adr_reg_low, uint8_t adr_reg_high)
Low and high register data function.
pin_name_t sck
Definition: c6dofimu2.h:269
digital_in_t int_pin
Definition: c6dofimu2.h:241
void c6dofimu2_read_gyro(c6dofimu2_t *ctx, c6dofimu2_gyro_data_t *gyro_data)
Read axis function.
void c6dofimu2_generic_read(c6dofimu2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
pin_name_t sda
Definition: c6dofimu2.h:266
#define C6DOFIMU2_RETVAL
Definition: c6dofimu2.h:90
void c6dofimu2_read_accel(c6dofimu2_t *ctx, c6dofimu2_accel_data_t *accel_data)
Read axis function.
spi_master_t spi
Definition: c6dofimu2.h:246
int16_t accel_y
Definition: c6dofimu2.h:301
uint32_t i2c_speed
Definition: c6dofimu2.h:278
c6dofimu2_master_io_t read_f
Definition: c6dofimu2.h:253
uint8_t slave_address
Definition: c6dofimu2.h:250
void c6dofimu2_cfg_setup(c6dofimu2_cfg_t *cfg)
Config Object Initialization function.
int16_t gyro_x
Definition: c6dofimu2.h:311
pin_name_t cs
Definition: c6dofimu2.h:270
pin_name_t miso
Definition: c6dofimu2.h:267
pin_name_t chip_select
Definition: c6dofimu2.h:251
digital_out_t cs
Definition: c6dofimu2.h:237
int16_t gyro_z
Definition: c6dofimu2.h:313
void(* c6dofimu2_master_io_t)(struct c6dofimu2_s *, uint8_t, uint8_t *, uint8_t)
Master Input/Output type.
Definition: c6dofimu2.h:228
c6dofimu2_master_io_t write_f
Definition: c6dofimu2.h:252
uint32_t spi_speed
Definition: c6dofimu2.h:280
void c6dofimu2_generic_write(c6dofimu2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
pin_name_t int_pin
Definition: c6dofimu2.h:274
i2c_master_t i2c
Definition: c6dofimu2.h:245
uint8_t c6dofimu2_select_t
Communication type.
Definition: c6dofimu2.h:223