gyro9 2.1.0.0
gyro9.h File Reference

This file contains API for Gyro 9 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  gyro9_s
 Gyro 9 Click context object. More...
 
struct  gyro9_cfg_t
 Gyro 9 Click configuration object. More...
 
struct  gyro9_axis_data_t
 Gyro 9 Click axis raw data structure object. More...
 
struct  gyro9_axis_t
 Gyro 9 Click sensor axes structure object. More...
 

Macros

#define GYRO9_REG_WHO_AM_I   0x0F
 Gyro 9 description register.
 
#define GYRO9_REG_CTRL_REG1   0x20
 
#define GYRO9_REG_CTRL_REG2   0x21
 
#define GYRO9_REG_CTRL_REG3   0x22
 
#define GYRO9_REG_CTRL_REG4   0x23
 
#define GYRO9_REG_CTRL_REG5   0x24
 
#define GYRO9_REG_REFERENCE   0x25
 
#define GYRO9_REG_OUT_TEMP   0x26
 
#define GYRO9_REG_STATUS_REG   0x27
 
#define GYRO9_REG_OUT_X_L   0x28
 
#define GYRO9_REG_OUT_X_H   0x29
 
#define GYRO9_REG_OUT_Y_L   0x2A
 
#define GYRO9_REG_OUT_Y_H   0x2B
 
#define GYRO9_REG_OUT_Z_L   0x2C
 
#define GYRO9_REG_OUT_Z_H   0x2D
 
#define GYRO9_REG_FIFO_CTRL_REG   0x2E
 
#define GYRO9_REG_FIFO_SRC_REG   0x2F
 
#define GYRO9_REG_INT1_CFG   0x30
 
#define GYRO9_REG_INT1_SRC   0x31
 
#define GYRO9_REG_INT1_TSH_XH   0x32
 
#define GYRO9_REG_INT1_TSH_XL   0x33
 
#define GYRO9_REG_INT1_TSH_YH   0x34
 
#define GYRO9_REG_INT1_TSH_YL   0x35
 
#define GYRO9_REG_INT1_TSH_ZH   0x36
 
#define GYRO9_REG_INT1_TSH_ZL   0x37
 
#define GYRO9_REG_INT1_DURATION   0x38
 
#define GYRO9_WHO_AM_I   0xD3
 Gyro 9 device identification values.
 
#define GYRO9_ODR_100_HZ   0x00
 Gyro 9 output data rate selection.
 
#define GYRO9_ODR_200_HZ   0x01
 
#define GYRO9_ODR_400_HZ   0x02
 
#define GYRO9_ODR_800_HZ   0x03
 
#define GYRO9_ODR_BIT_MASK   0xC0
 
#define GYRO9_BW_0   0x00
 Gyro 9 bandwidth selection.
 
#define GYRO9_BW_1   0x01
 
#define GYRO9_BW_2   0x02
 
#define GYRO9_BW_3   0x03
 
#define GYRO9_BW_BIT_MASK   0x30
 
#define GYRO9_PD_POWER_DOWN   0x00
 Gyro 9 power mode selection.
 
#define GYRO9_PD_SLEEP   0x08
 
#define GYRO9_PD_NORMAL   0x0F
 
#define GYRO9_PD_BIT_MASK   0x08
 
#define GYRO9_FIFO_CTRL_BYPASS_MODE   0x00
 Gyro 9 power mode selection.
 
#define GYRO9_FIFO_CTRL_FIFO_MODE   0x01
 
#define GYRO9_FIFO_CTRL_STREAM_MODE   0x02
 
#define GYRO9_FIFO_CTRL_BIT_MASK   0xE0
 
#define GYRO9_CTRL_I1_INT1_EN   0x80
 Gyro 9 control register 3 data values.
 
#define GYRO9_CTRL_I1_INT1_DIS   0x00
 
#define GYRO9_CTRL_I1_BOOT_EN   0x40
 
#define GYRO9_CTRL_I1_BOOT_DIS   0x00
 
#define GYRO9_CTRL_H_LACTIVE_EN   0x20
 
#define GYRO9_CTRL_H_LACTIVE_DIS   0x00
 
#define GYRO9_CTRL_PP_OD_EN   0x10
 
#define GYRO9_CTRL_PP_OD_DIS   0x00
 
#define GYRO9_CTRL_I2_DRDY_EN   0x08
 
#define GYRO9_CTRL_I2_DRDY_DIS   0x00
 
#define GYRO9_CTRL_I2_WTM_EN   0x04
 
#define GYRO9_CTRL_I2_WTM_DIS   0x00
 
#define GYRO9_CTRL_I2_ORUN_EN   0x02
 
#define GYRO9_CTRL_I2_ORUN_DIS   0x00
 
#define GYRO9_CTRL_I2_EMPTY_EN   0x01
 
#define GYRO9_CTRL_I2_EMPTY_DIS   0x00
 
#define GYRO9_SENSITIVITY_DPS   0.00875f
 Gyro 9 device identification values.
 
#define GYRO9_DEVICE_ADDRESS_GND   0x68
 Gyro 9 device address setting.
 
#define GYRO9_DEVICE_ADDRESS_VCC   0x69
 
#define GYRO9_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define GYRO9_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define GYRO9_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* gyro9_master_io_t) (struct gyro9_s *, uint8_t, uint8_t *, uint8_t)
 Gyro 9 Click driver interface.
 
typedef struct gyro9_s gyro9_t
 Gyro 9 Click context object.
 

Enumerations

enum  gyro9_drv_t { GYRO9_DRV_SEL_SPI , GYRO9_DRV_SEL_I2C }
 Gyro 9 Click driver selector. More...
 
enum  gyro9_return_value_t { GYRO9_OK = 0 , GYRO9_ERROR = -1 }
 Gyro 9 Click return value data. More...
 

Functions

void gyro9_cfg_setup (gyro9_cfg_t *cfg)
 Gyro 9 configuration object setup function.
 
void gyro9_drv_interface_selection (gyro9_cfg_t *cfg, gyro9_drv_t drv_sel)
 Gyro 9 driver interface setup function.
 
err_t gyro9_init (gyro9_t *ctx, gyro9_cfg_t *cfg)
 Gyro 9 initialization function.
 
err_t gyro9_default_cfg (gyro9_t *ctx)
 Gyro 9 default configuration function.
 
err_t gyro9_generic_write (gyro9_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Gyro 9 data writing function.
 
err_t gyro9_generic_read (gyro9_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Gyro 9 data reading function.
 
err_t gyro9_get_device_id (gyro9_t *ctx, uint8_t *who_am_i)
 Gyro 9 get device ID function.
 
err_t gyro9_set_output_data_rate (gyro9_t *ctx, uint8_t odr)
 Gyro 9 set output data rate function.
 
err_t gyro9_set_bandwidth_sel (gyro9_t *ctx, uint8_t bandwidth)
 Gyro 9 set bandwidth function.
 
err_t gyro9_set_mode_pd (gyro9_t *ctx)
 Gyro 9 set power-down mode function.
 
err_t gyro9_set_mode_sleep (gyro9_t *ctx)
 Gyro 9 set sleep mode function.
 
err_t gyro9_set_mode_normal (gyro9_t *ctx)
 Gyro 9 set normal mode function.
 
err_t gyro9_set_fifo_mode (gyro9_t *ctx, uint8_t fifo_mode)
 Gyro 9 set FIFO mode function.
 
err_t gyro9_enable_data_ready (gyro9_t *ctx)
 Gyro 9 enable data ready function.
 
err_t gyro9_get_status (gyro9_t *ctx, uint8_t *status)
 Gyro 9 get status function.
 
err_t gyro9_get_axis_data (gyro9_t *ctx, gyro9_axis_data_t *gyro_axis)
 Gyro 9 get gyro data function.
 
err_t gyro9_get_gyro_axis (gyro9_t *ctx, gyro9_axis_t *gyro_axis)
 Gyro 9 get gyro sensor axes function.
 
err_t gyro9_get_temperature_raw (gyro9_t *ctx, int8_t *temp_raw)
 Gyro 9 get temperature data function.
 
uint8_t gyro9_get_data_ready (gyro9_t *ctx)
 Gyro 9 get data ready function.
 
uint8_t gyro9_get_interrupt (gyro9_t *ctx)
 Gyro 9 get interrupt function.
 

Detailed Description

This file contains API for Gyro 9 Click Driver.

Typedef Documentation

◆ gyro9_master_io_t

typedef err_t(* gyro9_master_io_t) (struct gyro9_s *, uint8_t, uint8_t *, uint8_t)

Gyro 9 Click driver interface.

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

◆ gyro9_t

typedef struct gyro9_s gyro9_t

Gyro 9 Click context object.

Context object definition of Gyro 9 Click driver.

Enumeration Type Documentation

◆ gyro9_drv_t

Gyro 9 Click driver selector.

Selects target driver interface of Gyro 9 Click driver.

Enumerator
GYRO9_DRV_SEL_SPI 

SPI driver descriptor.

GYRO9_DRV_SEL_I2C 

I2C driver descriptor.

◆ gyro9_return_value_t

Gyro 9 Click return value data.

Predefined enum values for driver return values.

Enumerator
GYRO9_OK 
GYRO9_ERROR