Go to the documentation of this file.
35 #include "mikrosdk_version.h"
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_spi_master.h"
70 #define GYRO7_REG_DLPF_B1_H_Y_AXIS 0x02
71 #define GYRO7_REG_DLPF_B1_L_Y_AXIS 0x09
72 #define GYRO7_REG_DLPF_B0B2_H_X_AXIS 0x0E
73 #define GYRO7_REG_DLPF_B0B2_L_X_AXIS 0x0F
74 #define GYRO7_REG_DLPF_B1_H_X_AXIS 0x10
75 #define GYRO7_REG_DLPF_B1_L_X_AXIS 0x11
76 #define GYRO7_REG_DLPF_B0B2_H_Y_AXIS 0x12
77 #define GYRO7_REG_XG_OFFS_USRH 0x13
78 #define GYRO7_REG_XG_OFFS_USRL 0x14
79 #define GYRO7_REG_YG_OFFS_USRH 0x15
80 #define GYRO7_REG_YG_OFFS_USRL 0x16
81 #define GYRO7_REG_SMPLRT_DIV 0x19
82 #define GYRO7_REG_CONFIG 0x1A
83 #define GYRO7_REG_GYRO_CONFIG 0x1B
84 #define GYRO7_REG_HPF_DLPF_RST_AZ 0x26
85 #define GYRO7_REG_INT_PIN_CFG 0x37
86 #define GYRO7_REG_INT_ENABLE 0x38
87 #define GYRO7_REG_INT_STATUS 0x3A
88 #define GYRO7_REG_TEMP_OUT_H 0x41
89 #define GYRO7_REG_TEMP_OUT_L 0x42
90 #define GYRO7_REG_GYRO_XOUT_H 0x43
91 #define GYRO7_REG_GYRO_XOUT_L 0x44
92 #define GYRO7_REG_GYRO_YOUT_H 0x45
93 #define GYRO7_REG_GYRO_YOUT_L 0x46
94 #define GYRO7_REG_USER_CTRL 0x6A
95 #define GYRO7_REG_PWR_MGMT_1 0x6B
96 #define GYRO7_REG_DLPF_B0B2_L_Y_AXIS 0x70
97 #define GYRO7_REG_DLPF_A1_H 0x71
98 #define GYRO7_REG_DLPF_A1_L 0x72
99 #define GYRO7_REG_DLPF_A2_H 0x73
100 #define GYRO7_REG_DLPF_A2_L 0x74
101 #define GYRO7_REG_WHO_AM_I 0x75
102 #define GYRO7_REG_SPI_SEL 0x76
120 #define GYRO7_DLPF_B0B2_40_160_HZ 0x0004
121 #define GYRO7_DLPF_B0B2_80_320_HZ 0x0011
122 #define GYRO7_DLPF_B0B2_160_640_HZ 0x0040
123 #define GYRO7_DLPF_B0B2_250_HZ 0x0095
124 #define GYRO7_DLPF_B0B2_500_HZ 0x0212
125 #define GYRO7_DLPF_B1_40_160_HZ 0x0008
126 #define GYRO7_DLPF_B1_80_320_HZ 0x001C
127 #define GYRO7_DLPF_B1_160_640_HZ 0x006D
128 #define GYRO7_DLPF_B1_250_HZ 0x0100
129 #define GYRO7_DLPF_B1_500_HZ 0x0387
130 #define GYRO7_DLPF_A1_40_160_HZ 0x82D7
131 #define GYRO7_DLPF_A1_80_320_HZ 0x85AF
132 #define GYRO7_DLPF_A1_160_640_HZ 0x8B59
133 #define GYRO7_DLPF_A1_250_HZ 0x91AE
134 #define GYRO7_DLPF_A1_500_HZ 0xA2EE
135 #define GYRO7_DLPF_A2_40_160_HZ 0x3D38
136 #define GYRO7_DLPF_A2_80_320_HZ 0x3A8F
137 #define GYRO7_DLPF_A2_160_640_HZ 0x3594
138 #define GYRO7_DLPF_A2_250_HZ 0x307C
139 #define GYRO7_DLPF_A2_500_HZ 0x24BD
140 #define GYRO7_DLPF_40_160_HZ 0x00
141 #define GYRO7_DLPF_80_320_HZ 0x01
142 #define GYRO7_DLPF_160_640_HZ 0x02
143 #define GYRO7_DLPF_250_HZ 0x03
144 #define GYRO7_DLPF_500_HZ 0x04
150 #define GYRO7_CONFIG_HPF_ORDER_BYPASS_HPF 0x00
151 #define GYRO7_CONFIG_HPF_ORDER_ONE_HPF 0x40
152 #define GYRO7_CONFIG_HPF_ORDER_TWO_HPF 0x60
153 #define GYRO7_CONFIG_HPF_CFG_M_FACTOR_9 0x00
154 #define GYRO7_CONFIG_HPF_CFG_M_FACTOR_11 0x04
155 #define GYRO7_CONFIG_HPF_CFG_M_FACTOR_12 0x08
156 #define GYRO7_CONFIG_HPF_CFG_M_FACTOR_13 0x0C
157 #define GYRO7_CONFIG_HPF_CFG_M_FACTOR_14 0x10
158 #define GYRO7_CONFIG_HPF_CFG_M_FACTOR_15 0x14
159 #define GYRO7_CONFIG_HPF_CFG_M_FACTOR_16 0x18
160 #define GYRO7_CONFIG_HPF_CFG_M_FACTOR_17 0x1C
161 #define GYRO7_CONFIG_DLPF_CFG_BYPASS_DLPF 0x00
162 #define GYRO7_CONFIG_DLPF_CFG_ENABLE_DLPF 0x02
169 #define GYRO7_SAMPLE_RATE_31p25_HZ 255
170 #define GYRO7_SAMPLE_RATE_40_HZ 199
171 #define GYRO7_SAMPLE_RATE_80_HZ 99
172 #define GYRO7_SAMPLE_RATE_100_HZ 79
173 #define GYRO7_SAMPLE_RATE_200_HZ 39
174 #define GYRO7_SAMPLE_RATE_400_HZ 19
175 #define GYRO7_SAMPLE_RATE_800_HZ 9
176 #define GYRO7_SAMPLE_RATE_1000_HZ 7
177 #define GYRO7_SAMPLE_RATE_2000_HZ 3
178 #define GYRO7_SAMPLE_RATE_4000_HZ 1
179 #define GYRO7_SAMPLE_RATE_8000_HZ 0
185 #define GYRO7_INT_PIN_CFG_INT_LEVEL 0x80
186 #define GYRO7_INT_PIN_CFG_INT_OPEN 0x40
187 #define GYRO7_INT_PIN_CFG_LATCH_INT_EN 0x20
188 #define GYRO7_INT_PIN_CFG_INT_RD_CLEAR 0x10
194 #define GYRO7_INT_ENABLE_DATA_RDY_EN 0x01
200 #define GYRO7_PWR_MGMT_1_DEVICE_RESET 0x80
201 #define GYRO7_PWR_MGMT_1_SLEEP 0x40
202 #define GYRO7_PWR_MGMT_1_INTERNAL_OSC 0x00
203 #define GYRO7_PWR_MGMT_1_PLL_OSC 0x01
209 #define GYRO7_GYRO_CONFIG_XG_ST 0x80
210 #define GYRO7_GYRO_CONFIG_YG_ST 0x40
211 #define GYRO7_GYRO_CONFIG_FS_SEL_46p5_DPS 0x00
212 #define GYRO7_GYRO_CONFIG_FS_SEL_93_DPS 0x08
213 #define GYRO7_GYRO_CONFIG_FS_SEL_187_DPS 0x10
214 #define GYRO7_GYRO_CONFIG_FS_SEL_374_DPS 0x18
215 #define GYRO7_GYRO_CONFIG_FS_SEL_BITS_MASK 0x18
216 #define GYRO7_GYRO_CONFIG_FCHOICE_B 0x01
222 #define GYRO7_GYRO_SENSITIVITY_FS_SEL_0 700.0
223 #define GYRO7_GYRO_SENSITIVITY_FS_SEL_1 350.0
224 #define GYRO7_GYRO_SENSITIVITY_FS_SEL_2 175.0
225 #define GYRO7_GYRO_SENSITIVITY_FS_SEL_3 87.5
231 #define GYRO7_TEMP_SENSITIVITY 123.0
237 #define GYRO7_WHO_AM_I 0x88
243 #define GYRO7_SPI_READ_WRITE_BIT 0x80
253 #define GYRO7_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
254 #define GYRO7_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
272 #define GYRO7_MAP_MIKROBUS( cfg, mikrobus ) \
273 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
274 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
275 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
276 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
277 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t gyro7_generic_read(gyro7_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Gyro 7 data reading function.
pin_name_t miso
Definition: gyro7.h:305
err_t gyro7_write_register(gyro7_t *ctx, uint8_t reg, uint8_t data_in)
Gyro 7 write register function.
err_t gyro7_read_register(gyro7_t *ctx, uint8_t reg, uint8_t *data_out)
Gyro 7 read register function.
err_t gyro7_generic_write(gyro7_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Gyro 7 data writing function.
This file contains SPI specific macros, functions, etc.
err_t gyro7_set_dlpf_config(gyro7_t *ctx, uint8_t freq)
Gyro 7 set DLPF config function.
spi_master_t spi
Definition: gyro7.h:292
uint32_t spi_speed
Definition: gyro7.h:314
err_t gyro7_init(gyro7_t *ctx, gyro7_cfg_t *cfg)
Gyro 7 initialization function.
pin_name_t sck
Definition: gyro7.h:307
err_t gyro7_read_temperature(gyro7_t *ctx, float *temperature)
Gyro 7 read temperature function.
pin_name_t chip_select
Definition: gyro7.h:294
pin_name_t mosi
Definition: gyro7.h:306
digital_in_t int_pin
Definition: gyro7.h:289
err_t gyro7_read_gyroscope(gyro7_t *ctx, float *x_axis, float *y_axis)
Gyro 7 read gyroscope function.
Gyro 7 Click context object.
Definition: gyro7.h:287
uint8_t gyro7_get_int_pin(gyro7_t *ctx)
Gyro 7 get int pin function.
void gyro7_cfg_setup(gyro7_cfg_t *cfg)
Gyro 7 configuration object setup function.
pin_name_t cs
Definition: gyro7.h:308
@ GYRO7_ERROR
Definition: gyro7.h:327
pin_name_t int_pin
Definition: gyro7.h:311
spi_master_mode_t spi_mode
Definition: gyro7.h:315
err_t gyro7_check_communication(gyro7_t *ctx)
Gyro 7 check communication function.
@ GYRO7_OK
Definition: gyro7.h:326
err_t gyro7_default_cfg(gyro7_t *ctx)
Gyro 7 default configuration function.
Gyro 7 Click configuration object.
Definition: gyro7.h:303
gyro7_return_value_t
Gyro 7 Click return value data.
Definition: gyro7.h:325
spi_master_chip_select_polarity_t cs_polarity
Definition: gyro7.h:316