gyro6 2.0.0.0
gyro6.h File Reference

This file contains API for Gyro 6 Click Driver. More...

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

Go to the source code of this file.

Data Structures

struct  gyro6_s
 Gyro 6 Click context object. More...
 
struct  gyro6_cfg_t
 Gyro 6 Click configuration object. More...
 

Macros

#define GYRO6_REG_SELF_TEST_X_GYRO   0x00
 Gyro 6 Register Map.
 
#define GYRO6_REG_SELF_TEST_Y_GYRO   0x01
 
#define GYRO6_REG_SELF_TEST_Z_GYRO   0x02
 
#define GYRO6_REG_XG_OFFS_USRH   0x13
 
#define GYRO6_REG_XG_OFFS_USRL   0x14
 
#define GYRO6_REG_YG_OFFS_USRH   0x15
 
#define GYRO6_REG_YG_OFFS_USRL   0x16
 
#define GYRO6_REG_ZG_OFFS_USRH   0x17
 
#define GYRO6_REG_ZG_OFFS_USRL   0x18
 
#define GYRO6_REG_SMPLRT_DIV   0x19
 
#define GYRO6_REG_CONFIG   0x1A
 
#define GYRO6_REG_GYRO_CONFIG   0x1B
 
#define GYRO6_REG_LP_MODE_CFG   0x1E
 
#define GYRO6_REG_FIFO_EN   0x23
 
#define GYRO6_REG_FSYNC_INT   0x36
 
#define GYRO6_REG_INT_PIN_CFG   0x37
 
#define GYRO6_REG_INT_ENABLE   0x38
 
#define GYRO6_REG_INT_STATUS   0x3A
 
#define GYRO6_REG_TEMP_OUT_H   0x41
 
#define GYRO6_REG_TEMP_OUT_L   0x42
 
#define GYRO6_REG_GYRO_XOUT_H   0x43
 
#define GYRO6_REG_GYRO_XOUT_L   0x44
 
#define GYRO6_REG_GYRO_YOUT_H   0x45
 
#define GYRO6_REG_GYRO_YOUT_L   0x46
 
#define GYRO6_REG_GYRO_ZOUT_H   0x47
 
#define GYRO6_REG_GYRO_ZOUT_L   0x48
 
#define GYRO6_REG_SIGNAL_PATH_RESET   0x68
 
#define GYRO6_REG_USER_CTRL   0x6A
 
#define GYRO6_REG_PWR_MGMT_1   0x6B
 
#define GYRO6_REG_PWR_MGMT_2   0x6C
 
#define GYRO6_REG_FIFO_COUNTH   0x72
 
#define GYRO6_REG_FIFO_COUNTL   0x73
 
#define GYRO6_REG_FIFO_R_W   0x74
 
#define GYRO6_REG_WHO_AM_I   0x75
 
#define GYRO6_CONFIG_FIFO_MODE   0x40
 Gyro 6 Configuration settings.
 
#define GYRO6_CONFIG_EXT_SYNC_DIS   0x00
 
#define GYRO6_CONFIG_EXT_SYNC_TEMP_OUT_L   0x08
 
#define GYRO6_CONFIG_EXT_SYNC_GYRO_XOUT_L   0x10
 
#define GYRO6_CONFIG_EXT_SYNC_GYRO_YOUT_L   0x18
 
#define GYRO6_CONFIG_EXT_SYNC_GYRO_ZOUT_L   0x20
 
#define GYRO6_CONFIG_FIFO_MODE   0x40
 Gyro 6 Configuration settings.
 
#define GYRO6_CONFIG_DLPF_CFG_0   0x00
 
#define GYRO6_CONFIG_DLPF_CFG_1   0x01
 
#define GYRO6_CONFIG_DLPF_CFG_2   0x02
 
#define GYRO6_CONFIG_DLPF_CFG_3   0x03
 
#define GYRO6_CONFIG_DLPF_CFG_4   0x04
 
#define GYRO6_CONFIG_DLPF_CFG_5   0x05
 
#define GYRO6_CONFIG_DLPF_CFG_6   0x06
 
#define GYRO6_CONFIG_DLPF_CFG_7   0x07
 
#define GYRO6_GYRO_CONFIG_XG_ST   0x80
 Gyro 6 Gyro Configuration settings.
 
#define GYRO6_GYRO_CONFIG_YG_ST   0x40
 
#define GYRO6_GYRO_CONFIG_ZG_ST   0x20
 
#define GYRO6_GYRO_CONFIG_FS_SEL_250DPS   0x00
 
#define GYRO6_GYRO_CONFIG_FS_SEL_500DPS   0x08
 
#define GYRO6_GYRO_CONFIG_FS_SEL_1000DPS   0x10
 
#define GYRO6_GYRO_CONFIG_FS_SEL_2000DPS   0x18
 
#define GYRO6_GYRO_CONFIG_FS_SEL_BITS_MASK   0x18
 
#define GYRO6_GYRO_CONFIG_FCHOICE_B_0   0x00
 
#define GYRO6_GYRO_CONFIG_FCHOICE_B_1   0x01
 
#define GYRO6_GYRO_CONFIG_FCHOICE_B_2   0x02
 
#define GYRO6_GYRO_CONFIG_FCHOICE_B_3   0x03
 
#define GYRO6_SAMPLE_RATE_3p9HZ   255
 Gyro 6 Sample Rate settings.
 
#define GYRO6_SAMPLE_RATE_10HZ   99
 
#define GYRO6_SAMPLE_RATE_15p4HZ   64
 
#define GYRO6_SAMPLE_RATE_30p3HZ   32
 
#define GYRO6_SAMPLE_RATE_50HZ   19
 
#define GYRO6_SAMPLE_RATE_100HZ   9
 
#define GYRO6_SAMPLE_RATE_125HZ   7
 
#define GYRO6_SAMPLE_RATE_200HZ   4
 
#define GYRO6_SAMPLE_RATE_250HZ   3
 
#define GYRO6_SAMPLE_RATE_333p3HZ   2
 
#define GYRO6_SAMPLE_RATE_500HZ   1
 
#define GYRO6_SAMPLE_RATE_1000HZ   0
 
#define GYRO6_LP_MODE_CFG_GYRO_CYCLE   0x80
 Gyro 6 Low Power Mode Configuration settings.
 
#define GYRO6_LP_MODE_CFG_G_AVGCFG_1X   0x00
 
#define GYRO6_LP_MODE_CFG_G_AVGCFG_2X   0x10
 
#define GYRO6_LP_MODE_CFG_G_AVGCFG_4X   0x20
 
#define GYRO6_LP_MODE_CFG_G_AVGCFG_8X   0x30
 
#define GYRO6_LP_MODE_CFG_G_AVGCFG_16X   0x40
 
#define GYRO6_LP_MODE_CFG_G_AVGCFG_32X   0x50
 
#define GYRO6_LP_MODE_CFG_G_AVGCFG_64X   0x60
 
#define GYRO6_LP_MODE_CFG_G_AVGCFG_128X   0x70
 
#define GYRO6_FIFO_EN_TEMP_FIFO_EN   0x80
 Gyro 6 FIFO Enable settings.
 
#define GYRO6_FIFO_EN_XG_FIFO_EN   0x40
 
#define GYRO6_FIFO_EN_YG_FIFO_EN   0x20
 
#define GYRO6_FIFO_EN_ZG_FIFO_EN   0x10
 
#define GYRO6_FSYNC_INT   0x80
 Gyro 6 FSYNC Interrupt Status settings.
 
#define GYRO6_INT_PIN_CFG_INT_LEVEL   0x80
 Gyro 6 Interrupt PIN CFG settings.
 
#define GYRO6_INT_PIN_CFG_INT_OPEN   0x40
 
#define GYRO6_INT_PIN_CFG_LATCH_INT_EN   0x20
 
#define GYRO6_INT_PIN_CFG_INT_RD_CLEAR   0x10
 
#define GYRO6_INT_PIN_CFG_FSYNC_INT_LEVEL   0x08
 
#define GYRO6_INT_PIN_CFG_FSYNC_INT_MODE_EN   0x04
 
#define GYRO6_INT_ENABLE_FIFO_OFLOW_INT_EN   0x10
 Gyro 6 Interrupt Enable settings.
 
#define GYRO6_INT_ENABLE_GDRIVE_INT_EN   0x04
 
#define GYRO6_INT_ENABLE_DATA_RDY_INT_EN   0x01
 
#define GYRO6_INT_STATUS_FIFO_OFLOW_INT   0x10
 Gyro 6 Interrupt Status values.
 
#define GYRO6_INT_STATUS_GDRIVE_INT   0x04
 
#define GYRO6_INT_STATUS_DATA_RDY_INT   0x01
 
#define GYRO6_ROOM_TEMP_OFFSET   0
 Gyro 6 Temperature Calculation constants.
 
#define GYRO6_TEMP_SENSITIVITY   326.8
 
#define GYRO6_TEMP_NOMINAL   25.0
 
#define GYRO6_GYRO_SENSITIVITY_FS_SEL_0   131.0
 Gyro 6 Gyro Sensitivity Scale Factor.
 
#define GYRO6_GYRO_SENSITIVITY_FS_SEL_1   65.5
 
#define GYRO6_GYRO_SENSITIVITY_FS_SEL_2   32.8
 
#define GYRO6_GYRO_SENSITIVITY_FS_SEL_3   16.4
 
#define GYRO6_SIGNAL_PATH_RESET_TEMP_RST   0x01
 Gyro 6 Signal Path Reset settings.
 
#define GYRO6_USER_CTRL_FIFO_EN   0x40
 Gyro 6 User Control settings.
 
#define GYRO6_USER_CTRL_I2C_IF_DIS   0x10
 
#define GYRO6_USER_CTRL_FIFO_RST   0x04
 
#define GYRO6_USER_CTRL_SIG_COND_RST   0x01
 
#define GYRO6_PWR_MGMT_1_DEVICE_RESET   0x80
 Gyro 6 Power Management 1 settings.
 
#define GYRO6_PWR_MGMT_1_SLEEP   0x40
 
#define GYRO6_PWR_MGMT_1_GYRO_STANDBY   0x10
 
#define GYRO6_PWR_MGMT_1_INTERNAL_OSC   0x00
 
#define GYRO6_PWR_MGMT_1_AUTO_SEL_CLOCK   0x01
 
#define GYRO6_PWR_MGMT_1_STOP_CLOCK   0x07
 
#define GYRO6_PWR_MGMT_2_DISABLE_X_GYRO   0x04
 Gyro 6 Power Management 2 settings.
 
#define GYRO6_PWR_MGMT_2_DISABLE_Y_GYRO   0x02
 
#define GYRO6_PWR_MGMT_2_DISABLE_Z_GYRO   0x01
 
#define GYRO6_DEVICE_ID   0xB5
 Gyro 6 Device ID.
 
#define GYRO6_SET_DEV_ADDR_0   0x68
 Gyro 6 device address setting.
 
#define GYRO6_SET_DEV_ADDR_1   0x69
 
#define GYRO6_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define GYRO6_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define GYRO6_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* gyro6_master_io_t) (struct gyro6_s *, uint8_t, uint8_t *, uint8_t)
 Gyro 6 Click driver interface.
 
typedef struct gyro6_s gyro6_t
 Gyro 6 Click context object.
 

Enumerations

enum  gyro6_drv_t { GYRO6_DRV_SEL_SPI , GYRO6_DRV_SEL_I2C }
 Gyro 6 Click driver selector. More...
 
enum  gyro6_return_value_t { GYRO6_OK = 0 , GYRO6_ERROR = -1 }
 Gyro 6 Click return value data. More...
 

Functions

void gyro6_cfg_setup (gyro6_cfg_t *cfg)
 Gyro 6 configuration object setup function.
 
void gyro6_drv_interface_selection (gyro6_cfg_t *cfg, gyro6_drv_t drv_sel)
 Gyro 6 driver interface setup function.
 
err_t gyro6_init (gyro6_t *ctx, gyro6_cfg_t *cfg)
 Gyro 6 initialization function.
 
err_t gyro6_default_cfg (gyro6_t *ctx)
 Gyro 6 default configuration function.
 
err_t gyro6_generic_write (gyro6_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Gyro 6 data writing function.
 
err_t gyro6_generic_read (gyro6_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Gyro 6 data reading function.
 
err_t gyro6_write_register (gyro6_t *ctx, uint8_t reg, uint8_t data_in)
 Gyro 6 write register function.
 
err_t gyro6_read_register (gyro6_t *ctx, uint8_t reg, uint8_t *data_out)
 Gyro 6 read register function.
 
uint8_t gyro6_get_int_pin (gyro6_t *ctx)
 Gyro 6 get INT pin function.
 
void gyro6_set_pwm_pin (gyro6_t *ctx, uint8_t state)
 Gyro 6 set PWM pin function.
 
err_t gyro6_check_communication (gyro6_t *ctx)
 Gyro 6 check communication function.
 
err_t gyro6_read_die_temperature (gyro6_t *ctx, float *temperature)
 Gyro 6 read DIE temperature function.
 
err_t gyro6_get_axis (gyro6_t *ctx, float *x_axis, float *y_axis, float *z_axis)
 Gyro 6 get axis function.
 
err_t gyro6_set_low_power_mode (gyro6_t *ctx, uint8_t sample_rate, uint8_t average)
 Gyro 6 set low power mode function.
 

Detailed Description

This file contains API for Gyro 6 Click Driver.

Typedef Documentation

◆ gyro6_master_io_t

typedef err_t(* gyro6_master_io_t) (struct gyro6_s *, uint8_t, uint8_t *, uint8_t)

Gyro 6 Click driver interface.

Definition of driver interface of Gyro 6 Click driver. Driver serial interface.

◆ gyro6_t

typedef struct gyro6_s gyro6_t

Gyro 6 Click context object.

Context object definition of Gyro 6 Click driver.

Enumeration Type Documentation

◆ gyro6_drv_t

Gyro 6 Click driver selector.

Selects target driver interface of Gyro 6 Click driver.

Enumerator
GYRO6_DRV_SEL_SPI 

SPI driver descriptor.

GYRO6_DRV_SEL_I2C 

I2C driver descriptor.

◆ gyro6_return_value_t

Gyro 6 Click return value data.

Predefined enum values for driver return values.

Enumerator
GYRO6_OK 
GYRO6_ERROR