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"
67#define GYRO_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
69 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
70 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
71 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
78#define GYRO_RETVAL uint8_t
81#define GYRO_INIT_ERROR 0xFF
88#define GYRO_L3GD20_I2C_ADDRESS 0x6B
89#define GYRO_L3GD20_REGISTER_WHO_AM_I 0x0F
90#define GYRO_L3GD20_REGISTER_CTRL_REG1 0x20
91#define GYRO_L3GD20_REGISTER_CTRL_REG2 0x21
92#define GYRO_L3GD20_REGISTER_CTRL_REG3 0x22
93#define GYRO_L3GD20_REGISTER_CTRL_REG4 0x23
94#define GYRO_L3GD20_REGISTER_CTRL_REG5 0x24
95#define GYRO_L3GD20_REGISTER_REFERENCE 0x25
96#define GYRO_L3GD20_REGISTER_OUT_TEMP 0x26
97#define GYRO_L3GD20_REGISTER_STATUS_REG 0x27
98#define GYRO_L3GD20_REGISTER_OUT_X_L 0x28
99#define GYRO_L3GD20_REGISTER_OUT_X_H 0x29
100#define GYRO_L3GD20_REGISTER_OUT_Y_L 0x2A
101#define GYRO_L3GD20_REGISTER_OUT_Y_H 0x2B
102#define GYRO_L3GD20_REGISTER_OUT_Z_L 0x2C
103#define GYRO_L3GD20_REGISTER_OUT_Z_H 0x2D
104#define GYRO_L3GD20_REGISTER_FIFO_CTRL_REG 0x2E
105#define GYRO_L3GD20_REGISTER_FIFO_SRC_REG 0x2F
112#define GYRO_L3GD20_REGISTER_INT1_CFG 0x30
113#define GYRO_L3GD20_REGISTER_INT1_SRC 0x31
114#define GYRO_L3GD20_REGISTER_TSH_XH 0x32
115#define GYRO_L3GD20_REGISTER_TSH_XL 0x33
116#define GYRO_L3GD20_REGISTER_TSH_YH 0x34
117#define GYRO_L3GD20_REGISTER_TSH_YL 0x35
118#define GYRO_L3GD20_REGISTER_TSH_ZH 0x36
119#define GYRO_L3GD20_REGISTER_TSH_ZL 0x37
120#define GYRO_L3GD20_REGISTER_INT1_DURATION 0x38
127#define GYRO_L3GD20_REG1_NORMAL_MODE 0x0F
128#define GYRO_L3GD20_REG4_250DPS 0x00
129#define GYRO_L3GD20_REG5_FIFO_ENABLE_INT1 0x50
130#define GYRO_L3GD20_FIFO_CTRL_REG_CONFIG 0x40
#define GYRO_RETVAL
Definition gyro.h:78
int16_t gyro_get_axis(gyro_t *ctx, uint8_t adr_reg_low)
Function get low and high register data.
uint8_t gyro_read_data(gyro_t *ctx, uint8_t address)
Generic read data function.
void gyro_cfg_setup(gyro_cfg_t *cfg)
Config Object Initialization function.
GYRO_RETVAL gyro_init(gyro_t *ctx, gyro_cfg_t *cfg)
Initialization function.
void gyro_write_data(gyro_t *ctx, uint8_t address, uint8_t write_command)
Generic write data function.
void gyro_read_gyro(gyro_t *ctx, int16_t *gyro_x, int16_t *gyro_y, int16_t *gyro_z)
Function read axis.
void gyro_default_cfg(gyro_t *ctx)
Click Default Configuration function.
Click configuration structure definition.
Definition gyro.h:167
uint32_t i2c_speed
Definition gyro.h:180
pin_name_t scl
Definition gyro.h:170
pin_name_t int_pin
Definition gyro.h:176
pin_name_t sda
Definition gyro.h:171
pin_name_t rst
Definition gyro.h:175
uint8_t i2c_address
Definition gyro.h:181
Click ctx object definition.
Definition gyro.h:144
digital_in_t int_pin
Definition gyro.h:151
i2c_master_t i2c
Definition gyro.h:155
digital_out_t rst
Definition gyro.h:147
uint8_t slave_address
Definition gyro.h:159