gyro5 2.0.0.0
gyro5.h File Reference

This file contains API for Gyro 5 Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"
#include "drv_spi_master.h"

Go to the source code of this file.

Data Structures

struct  gyro5_s
 Click ctx object definition. More...
 
struct  gyro5_cfg_t
 Click configuration structure definition. More...
 

Macros

#define GYRO5_MAP_MIKROBUS(cfg, mikrobus)
 
#define GYRO5_MASTER_I2C   0
 
#define GYRO5_MASTER_SPI   1
 
#define GYRO5_COM_I2C   0x01
 
#define GYRO5_COM_SPI   0x02
 
#define GYRO5_RETVAL   uint8_t
 
#define GYRO5_OK   0x00
 
#define GYRO5_INIT_ERROR   0xFF
 
#define GYRO5_I2C_DEV_ADR_GND   0x68
 
#define GYRO5_I2C_DEV_ADR_VCC   0x69
 
#define GYRO5_SLEEP_DISABLE   0x00
 
#define GYRO5_SLEEP_ENABLE   0x01
 
#define GYRO5_INT_DATA_RDY   0x00
 
#define GYRO5_INT_FSYNC   0x01
 
#define GYRO5_INT_FIFO_OVF   0x02
 
#define GYRO5_REG_XG_OFFS_TC_H   0x04
 
#define GYRO5_REG_XG_OFFS_TC_L   0x05
 
#define GYRO5_REG_YG_OFFS_TC_H   0x07
 
#define GYRO5_REG_YG_OFFS_TC_L   0x08
 
#define GYRO5_REG_ZG_OFFS_TC_H   0x0A
 
#define GYRO5_REG_ZG_OFFS_TC_L   0x0B
 
#define GYRO5_REG_XG_OFFS_USRH   0x13
 
#define GYRO5_REG_XG_OFFS_USRL   0x14
 
#define GYRO5_REG_YG_OFFS_USRH   0x15
 
#define GYRO5_REG_YG_OFFS_USRL   0x16
 
#define GYRO5_REG_ZG_OFFS_USRH   0x17
 
#define GYRO5_REG_G_OFFS_USRL   0x18
 
#define GYRO5_REG_SMPLRT_DIV   0x19
 
#define GYRO5_REG_CONFIG   0x1A
 
#define GYRO5_REG_GYRO_CONFIG   0x1B
 
#define GYRO5_REG_FIFO_EN   0x23
 
#define GYRO5_REG_INT_PIN_CFG   0x37
 
#define GYRO5_REG_INT_ENABLE   0x38
 
#define GYRO5_REG_INT_STATUS   0x3A
 
#define GYRO5_REG_TEMP_OUT_H   0x41
 
#define GYRO5_REG_TEMP_OUT_L   0x42
 
#define GYRO5_REG_GYRO_XOUT_H   0x43
 
#define GYRO5_REG_GYRO_XOUT_L   0x44
 
#define GYRO5_REG_GYRO_YOUT_H   0x45
 
#define GYRO5_REG_GYRO_YOUT_L   0x46
 
#define GYRO5_REG_GYRO_ZOUT_H   0x47
 
#define GYRO5_REG_GYRO_ZOUT_L   0x48
 
#define GYRO5_REG_USER_CTRL   0x6A
 
#define GYRO5_REG_PWR_MGMT_1   0x6B
 
#define GYRO5_REG_PWR_MGMT_2   0x6C
 
#define GYRO5_REG_FIFO_COUNTH   0x72
 
#define GYRO5_REG_FIFO_COUNTL   0x73
 
#define GYRO5_REG_FIFO_R_W   0x74
 
#define GYRO5_REG_WHO_AM_I   0x75
 
#define GYRO5_CFG_PWR_MGMT_1_DEV_RST   0x80
 
#define GYRO5_CFG_PWR_MGMT_1_SLEEP   0x40
 
#define GYRO5_CFG_PWR_MGMT_1_TEMP_DIS   0x10
 
#define GYRO5_CFG_PWR_MGMT_1_CLKSEL_EXT_OSC   0x06
 
#define GYRO5_CFG_PWR_MGMT_1_CLKSEL_PLL   0x01
 
#define GYRO5_CFG_PWR_MGMT_1_CLKSEL_INT_OSC   0x00
 
#define GYRO5_CFG_PWR_MGMT_2_STBY_XG   0x04
 
#define GYRO5_CFG_PWR_MGMT_2_STBY_YG   0x02
 
#define GYRO5_CFG_PWR_MGMT_2_STBY_ZG   0x01
 
#define GYRO5_CFG_PWR_MGMT_2_DIS_ALL   0x00
 
#define GYRO5_CFG_USER_CTRL_FIFO_EN   0x40
 
#define GYRO5_CFG_USER_CTRL_I2C_IF_DIS   0x10
 
#define GYRO5_CFG_USER_CTRL_FIFO_RESET   0x08
 
#define GYRO5_CFG_USER_CTRL_SIG_COND_RST   0x01
 
#define GYRO5_CFG_SMPLRT_DIV_DEF   0x00
 
#define GYRO5_CFG_CONFIG_EXT_SYNC_SET_GYRO_ZOUT_L   0x20
 
#define GYRO5_CFG_CONFIG_EXT_SYNC_SET_GYRO_YOUT_L   0x18
 
#define GYRO5_CFG_CONFIG_EXT_SYNC_SET_GYRO_XOUT_L   0x10
 
#define GYRO5_CFG_CONFIG_EXT_SYNC_SET_TEMP_OUT_L   0x08
 
#define GYRO5_CFG_CONFIG_EXT_SYNC_SET_IN_DIS   0x00
 
#define GYRO5_CFG_CONFIG_DEF   0x00
 
#define GYRO5_CFG_GYRO_CONFIG_FS_SEL_4000   0x18
 
#define GYRO5_CFG_GYRO_CONFIG_FS_SEL_2000   0x10
 
#define GYRO5_CFG_GYRO_CONFIG_FS_SEL_1000   0x08
 
#define GYRO5_CFG_GYRO_CONFIG_FS_SEL_500   0x00
 
#define GYRO5_CFG_FIFO_EN_TEMP   0x80
 
#define GYRO5_CFG_FIFO_EN_GYRO_X   0x40
 
#define GYRO5_CFG_FIFO_EN_GYRO_Y   0x20
 
#define GYRO5_CFG_FIFO_EN_GYRO_Z   0x10
 
#define GYRO5_CFG_FIFO_EN_DIS_ALL   0x00
 
#define GYRO5_CFG_INT_PIN_CFG_INT_LEVEL   0x80
 
#define GYRO5_CFG_INT_PIN_CFG_INT_OPEN   0x40
 
#define GYRO5_CFG_INT_PIN_CFG_LATCH_INT_EN   0x20
 
#define GYRO5_CFG_INT_PIN_CFG_INT_RD_CLEAR   0x10
 
#define GYRO5_CFG_INT_PIN_CFG_FSYNC_INT_LEVEL   0x08
 
#define GYRO5_CFG_INT_PIN_CFG_FSYNC_INT_MODE_EN   0x04
 
#define GYRO5_CFG_INT_PIN_CFG_DIS_ALL   0x00
 
#define GYRO5_CFG_INT_ENABLE_FIFO_OFLOW_EN   0x10
 
#define GYRO5_CFG_INT_ENABLE_FSYNC_INT_EN   0x08
 
#define GYRO5_CFG_INT_ENABLE_DATA_RDY_EN   0x01
 
#define GYRO5_STATUS_INT_FIFO_OFLOW   0x10
 
#define GYRO5_STATUS_INT_FSYNC   0x08
 
#define GYRO5_STATUS_INT_DATA_RDY   0x01
 
#define GYRO5_STATUS_INT_NOT_DATA_RDY   0x00
 
#define GYRO5_STATUS_INT_TYPES_SEL_FIFO_OFLOW   0x02
 
#define GYRO5_STATUS_INT_TYPES_INT_FSYNC   0x01
 
#define GYRO5_STATUS_INT_TYPES_INT_DATA_RDY   0x00
 
#define GYRO5_SLEEP_STATUS_EN   0x01
 
#define GYRO5_SLEEP_STATUS_DIS   0x00
 

Typedefs

typedef uint8_t gyro5_select_t
 Communication type.
 
typedef void(* gyro5_master_io_t) (struct gyro5_s *, uint8_t, uint8_t *, uint8_t)
 Master Input/Output type.
 
typedef struct gyro5_s gyro5_t
 Click ctx object definition.
 

Functions

void gyro5_cfg_setup (gyro5_cfg_t *cfg)
 Config Object Initialization function.
 
GYRO5_RETVAL gyro5_init (gyro5_t *ctx, gyro5_cfg_t *cfg)
 Initialization function.
 
void gyro5_default_cfg (gyro5_t *ctx)
 Click Default Configuration function.
 
void gyro5_generic_write (gyro5_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void gyro5_generic_read (gyro5_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
uint8_t gyro5_get_int (gyro5_t *ctx)
 Getting INT pin state.
 
uint8_t gyro5_int_status (gyro5_t *ctx, uint8_t int_type)
 Getting interrupt status.
 
void gyro5_get_temperature (gyro5_t *ctx, float *temperature)
 Getting temperature value.
 
void gyro5_get_axes (gyro5_t *ctx, float *x_axis, float *y_axis, float *z_axis)
 Getting gyroscope axes values.
 
void gyro5_sleep (gyro5_t *ctx, uint8_t en_sleep)
 Set sleep mode.
 

Detailed Description

This file contains API for Gyro 5 Click driver.