Go to the documentation of this file.
38 #include "mikrosdk_version.h"
41 #if mikroSDK_GET_VERSION < 20800ul
42 #include "rcu_delays.h"
48 #include "drv_digital_out.h"
49 #include "drv_digital_in.h"
50 #include "drv_i2c_master.h"
51 #include "drv_spi_master.h"
64 #define C6DOFIMU2_MAP_MIKROBUS( cfg, mikrobus ) \
65 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
66 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
67 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
68 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
69 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
70 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
71 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
78 #define C6DOFIMU2_MASTER_I2C 0
79 #define C6DOFIMU2_MASTER_SPI 1
86 #define C6DOFIMU2_RETVAL uint8_t
88 #define C6DOFIMU2_OK 0x00
89 #define C6DOFIMU2_INIT_ERROR 0xFF
96 #define C6DOFIMU2_I2C_ADDR 0x68
103 #define C6DOFIMU2_REG_CHIP_ID 0x00
104 #define C6DOFIMU2_REG_ERROR 0x02
105 #define C6DOFIMU2_REG_PMU_STATUS 0x03
106 #define C6DOFIMU2_REG_AUX_DATA 0x04
107 #define C6DOFIMU2_REG_GYRO_DATA 0x0C
108 #define C6DOFIMU2_REG_ACCEL_DATA 0x12
109 #define C6DOFIMU2_REG_STATUS 0x1B
110 #define C6DOFIMU2_REG_INT_STATUS 0x1C
111 #define C6DOFIMU2_REG_FIFO_LENGTH 0x22
112 #define C6DOFIMU2_REG_FIFO_DATA 0x24
113 #define C6DOFIMU2_REG_ACCEL_CONFIG 0x40
114 #define C6DOFIMU2_REG_ACCEL_RANGE 0x41
115 #define C6DOFIMU2_REG_GYRO_CONFIG 0x42
116 #define C6DOFIMU2_REG_GYRO_RANGE 0x43
117 #define C6DOFIMU2_REG_AUX_ODR 0x44
118 #define C6DOFIMU2_REG_FIFO_DOWN 0x45
119 #define C6DOFIMU2_REG_FIFO_CONFIG_0 0x46
120 #define C6DOFIMU2_REG_FIFO_CONFIG_1 0x47
121 #define C6DOFIMU2_REG_AUX_IF_0 0x4B
122 #define C6DOFIMU2_REG_AUX_IF_1 0x4C
123 #define C6DOFIMU2_REG_AUX_IF_2 0x4D
124 #define C6DOFIMU2_REG_AUX_IF_3 0x4E
125 #define C6DOFIMU2_REG_AUX_IF_4 0x4F
126 #define C6DOFIMU2_REG_INT_ENABLE_0 0x50
127 #define C6DOFIMU2_REG_INT_ENABLE_1 0x51
128 #define C6DOFIMU2_REG_INT_ENABLE_2 0x52
129 #define C6DOFIMU2_REG_INT_OUT_CTRL 0x53
130 #define C6DOFIMU2_REG_INT_LATCH 0x54
131 #define C6DOFIMU2_REG_INT_MAP_0 0x55
132 #define C6DOFIMU2_REG_INT_MAP_1 0x56
133 #define C6DOFIMU2_REG_INT_MAP_2 0x57
134 #define C6DOFIMU2_REG_INT_DATA_0 0x58
135 #define C6DOFIMU2_REG_INT_DATA_1 0x59
136 #define C6DOFIMU2_REG_INT_LOWHIGH_0 0x5A
137 #define C6DOFIMU2_REG_INT_LOWHIGH_1 0x5B
138 #define C6DOFIMU2_REG_INT_LOWHIGH_2 0x5C
139 #define C6DOFIMU2_REG_INT_LOWHIGH_3 0x5D
140 #define C6DOFIMU2_REG_INT_LOWHIGH_4 0x5E
141 #define C6DOFIMU2_REG_INT_MOTION_0 0x5F
142 #define C6DOFIMU2_REG_INT_MOTION_1 0x60
143 #define C6DOFIMU2_REG_INT_MOTION_2 0x61
144 #define C6DOFIMU2_REG_INT_MOTION_3 0x62
145 #define C6DOFIMU2_REG_INT_TAP_0 0x63
146 #define C6DOFIMU2_REG_INT_TAP_1 0x64
147 #define C6DOFIMU2_REG_INT_ORIENT_0 0x65
148 #define C6DOFIMU2_REG_INT_ORIENT_1 0x66
149 #define C6DOFIMU2_REG_INT_FLAT_0 0x67
150 #define C6DOFIMU2_REG_INT_FLAT_1 0x68
151 #define C6DOFIMU2_REG_FOC_CONF 0x69
152 #define C6DOFIMU2_REG_CONF 0x6A
153 #define C6DOFIMU2_REG_NV_CONF 0x70
160 #define C6DOFIMU2_CFG_IF_CONF 0x6B
161 #define C6DOFIMU2_CFG_SELF_TEST 0x6D
162 #define C6DOFIMU2_CFG_OFFSET 0x71
163 #define C6DOFIMU2_CFG_OFFSET_CONF 0x77
164 #define C6DOFIMU2_CFG_INT_STEP_CNT_0 0x78
165 #define C6DOFIMU2_CFG_INT_STEP_CONFIG_0 0x7A
166 #define C6DOFIMU2_CFG_INT_STEP_CONFIG_1 0x7B
167 #define C6DOFIMU2_CFG_COMMAND 0x7E
168 #define C6DOFIMU2_CFG_SPI_COMM_TEST 0x7F
169 #define C6DOFIMU2_CFG_INTL_PULLUP_CONF 0x85
176 #define C6DOFIMU2_CMD_ACCEL_NORMAL 0x11
177 #define C6DOFIMU2_CMD_ACCEL_LOW_PWR 0x12
178 #define C6DOFIMU2_CMD_GYRO_NORMAL 0x15
179 #define C6DOFIMU2_CMD_GYRO_FAST 0x7E
180 #define C6DOFIMU2_CMD_SEL_I2C 0x00
181 #define C6DOFIMU2_CMD_SEL_SPI 0x01
191 #define C6DOFIMU2_GYRO_X_L 0x0C
192 #define C6DOFIMU2_GYRO_X_H 0x0D
193 #define C6DOFIMU2_GYRO_Y_L 0x0E
194 #define C6DOFIMU2_GYRO_Y_H 0x0F
195 #define C6DOFIMU2_GYRO_Z_L 0x10
196 #define C6DOFIMU2_GYRO_Z_H 0x11
200 #define C6DOFIMU2_ACCEL_X_L 0x12
201 #define C6DOFIMU2_ACCEL_X_H 0x13
202 #define C6DOFIMU2_ACCEL_Y_L 0x14
203 #define C6DOFIMU2_ACCEL_Y_H 0x15
204 #define C6DOFIMU2_ACCEL_Z_L 0x16
205 #define C6DOFIMU2_ACCEL_Z_H 0x17
426 #endif // _C6DOFIMU2_H_
c6dofimu2_gyro_data_t gyro_data
Definition: main.c:39
Gyro data object definition.
Definition: c6dofimu2.h:306
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:275
spi_master_mode_t spi_mode
Definition: c6dofimu2.h:277
int16_t gyro_y
Definition: c6dofimu2.h:308
c6dofimu2_select_t master_sel
Definition: c6dofimu2.h:250
c6dofimu2_accel_data_t accel_data
Definition: main.c:38
Click configuration structure definition.
Definition: c6dofimu2.h:258
Click ctx object definition.
Definition: c6dofimu2.h:230
int16_t accel_x
Definition: c6dofimu2.h:296
pin_name_t mosi
Definition: c6dofimu2.h:264
struct c6dofimu2_s c6dofimu2_t
Click ctx object definition.
spi_master_chip_select_polarity_t cs_polarity
Definition: c6dofimu2.h:278
int16_t accel_z
Definition: c6dofimu2.h:298
Accel data object definition.
Definition: c6dofimu2.h:295
pin_name_t scl
Definition: c6dofimu2.h:261
c6dofimu2_select_t sel
Definition: c6dofimu2.h:280
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:265
digital_in_t int_pin
Definition: c6dofimu2.h:237
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:262
#define C6DOFIMU2_RETVAL
Definition: c6dofimu2.h:86
void c6dofimu2_read_accel(c6dofimu2_t *ctx, c6dofimu2_accel_data_t *accel_data)
Read axis function.
spi_master_t spi
Definition: c6dofimu2.h:242
int16_t accel_y
Definition: c6dofimu2.h:297
uint32_t i2c_speed
Definition: c6dofimu2.h:274
c6dofimu2_master_io_t read_f
Definition: c6dofimu2.h:249
uint8_t slave_address
Definition: c6dofimu2.h:246
void c6dofimu2_cfg_setup(c6dofimu2_cfg_t *cfg)
Config Object Initialization function.
int16_t gyro_x
Definition: c6dofimu2.h:307
pin_name_t cs
Definition: c6dofimu2.h:266
pin_name_t miso
Definition: c6dofimu2.h:263
pin_name_t chip_select
Definition: c6dofimu2.h:247
digital_out_t cs
Definition: c6dofimu2.h:233
int16_t gyro_z
Definition: c6dofimu2.h:309
void(* c6dofimu2_master_io_t)(struct c6dofimu2_s *, uint8_t, uint8_t *, uint8_t)
Master Input/Output type.
Definition: c6dofimu2.h:224
c6dofimu2_master_io_t write_f
Definition: c6dofimu2.h:248
uint32_t spi_speed
Definition: c6dofimu2.h:276
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:270
i2c_master_t i2c
Definition: c6dofimu2.h:241
uint8_t c6dofimu2_select_t
Communication type.
Definition: c6dofimu2.h:219