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_spi_master.h"
67#define GYRO4_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
69 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
70 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
71 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
72 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
79#define GYRO4_RETVAL uint8_t
82#define GYRO4_INIT_ERROR 0xFF
89#define GYRO4_REG_WHO_AM_I 0x00
90#define GYRO4_REG_TEMP_OUT_L 0x01
91#define GYRO4_REG_TEMP_OUT_H 0x02
92#define GYRO4_REG_OUT_X_L 0x03
93#define GYRO4_REG_OUT_X_H 0x04
94#define GYRO4_REG_OUT_Y_L 0x05
95#define GYRO4_REG_OUT_Y_H 0x06
96#define GYRO4_REG_DATA_STATUS_OIS 0x0A
97#define GYRO4_REG_CTRL1_OIS 0x0B
98#define GYRO4_REG_CTRL2_OIS 0x0C
99#define GYRO4_REG_CTRL3_OIS 0x0D
100#define GYRO4_REG_CTRL4_OIS 0x0E
101#define GYRO4_REG_OFF_X 0x0F
102#define GYRO4_REG_OFF_Y 0x10
103#define GYRO4_REG_OIS_CFG 0x1F
110#define GYRO4_POWER_DOWN_MODE 0x01
111#define GYRO4_SLEEP_MODE 0x02
112#define GYRO4_NORMAL_MODE 0x03
119#define GYRO4_100_DPS 0x01
120#define GYRO4_200_DPS 0x02
147 uint8_t aux_buffer [ 6 ];
254uint8_t
gyro4_spi_get (
gyro4_t *ctx, uint8_t register_address, uint8_t * register_buffer, uint16_t n_registers );
#define GYRO4_RETVAL
Definition gyro4.h:79
GYRO4_RETVAL gyro4_init(gyro4_t *ctx, gyro4_cfg_t *cfg)
Initialization function.
uint8_t gyro4_get_temperature(gyro4_t *ctx, float *temperature)
Getting die temperature value.
uint8_t gyro4_get_axes(gyro4_t *ctx, float *x_axis, float *y_axis)
Getting axes values.
uint8_t gyro4_set_power_mode(gyro4_t *ctx, uint8_t power_mode)
Setting power mode.
void gyro4_generic_transfer(gyro4_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
Generic transfer function.
void gyro4_cs_set(gyro4_t *ctx, uint8_t pin_state)
Setting CS pin state.
uint8_t gyro4_initialize(gyro4_t *ctx)
Device initialization.
uint8_t gyro4_set_full_scale_range(gyro4_t *ctx, uint8_t full_scale_range)
Settinf full scale range.
uint8_t gyro4_spi_get(gyro4_t *ctx, uint8_t register_address, uint8_t *register_buffer, uint16_t n_registers)
Getting register content.
uint8_t gyro4_int_get(gyro4_t *ctx)
Getting INT pin state.
void gyro4_cfg_setup(gyro4_cfg_t *cfg)
Config Object Initialization function.
uint8_t gyro4_software_reset(gyro4_t *ctx)
Performing software reset.
uint8_t gyro4_spi_set(gyro4_t *ctx, uint8_t register_address, uint8_t data_in)
Setting register content.
Click configuration structure definition.
Definition gyro4.h:155
spi_master_chip_select_polarity_t cs_polarity
Definition gyro4.h:171
pin_name_t sck
Definition gyro4.h:160
spi_master_mode_t spi_mode
Definition gyro4.h:170
pin_name_t mosi
Definition gyro4.h:159
uint32_t spi_speed
Definition gyro4.h:169
pin_name_t int_pin
Definition gyro4.h:165
pin_name_t miso
Definition gyro4.h:158
pin_name_t cs
Definition gyro4.h:161
Click ctx object definition.
Definition gyro4.h:134
digital_out_t cs
Definition gyro4.h:137
spi_master_t spi
Definition gyro4.h:145
digital_in_t int_pin
Definition gyro4.h:141
pin_name_t chip_select
Definition gyro4.h:146