gyro2 2.0.0.0
gyro2.h File Reference

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

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

Go to the source code of this file.

Data Structures

struct  ctrl_reg_t
 
struct  gyro2_s
 Click ctx object definition. More...
 
struct  gyro2_cfg_t
 Click configuration structure definition. More...
 

Macros

#define GYRO2_ADDR0   0x20
 
#define GYRO2_ADDR1   0x21
 
#define GYRO2_STATUS   0x00
 
#define GYRO2_OUT_X_MSB   0x01
 
#define GYRO2_OUT_X_LSB   0x02
 
#define GYRO2_OUT_Y_MSB   0x03
 
#define GYRO2_OUT_Y_LSB   0x04
 
#define GYRO2_OUT_Z_MSB   0x05
 
#define GYRO2_OUT_Z_LSB   0x06
 
#define GYRO2_DR_STATUS   0x07
 
#define GYRO2_F_STATUS   0x08
 
#define GYRO2_F_SETUP   0x09
 
#define GYRO2_F_EVENT   0x0A
 
#define GYRO2_INT_SRC_FLAG   0x0B
 
#define GYRO2_WHO_AM_I   0x0C
 
#define GYRO2_CTRL_REG0   0x0D
 
#define GYRO2_CTRL_REG1   0x13
 
#define GYRO2_SCALE_0   0
 
#define GYRO2_SCALE_1   1
 
#define GYRO2_SCALE_2   2
 
#define GYRO2_SCALE_3   3
 
#define GYRO2_HI_PASS_OFF   0x00
 
#define GYRO2_HI_PASS_MOD0   0x04
 
#define GYRO2_HI_PASS_MOD1   0x0C
 
#define GYRO2_HI_PASS_MOD2   0x14
 
#define GYRO2_HI_PASS_MOD3   0x1C
 
#define GYRO2_LO_PASS_OFF   0x00
 
#define GYRO2_LO_PASS_MOD0   0x20
 
#define GYRO2_LO_PASS_MOD1   0x60
 
#define GYRO2_LO_PASS_MOD2   0xE0
 
#define GYRO2_RT_CFG   0x0E
 
#define GYRO2_RT_CFG_ELE   0x08
 
#define GYRO2_RT_CFG_ZTEFE   0x04
 
#define GYRO2_RT_CFG_YTEFE   0x02
 
#define GYRO2_RT_CFG_XTEFE   0x01
 
#define GYRO2_RT_SRC   0x0F
 
#define GYRO2_RT_THS   0x10
 
#define GYRO2_RT_COUNT   0x11
 
#define GYRO2_TEMP   0x12
 
#define GYRO2_DR_800Hz   0
 
#define GYRO2_DR_400Hz   1
 
#define GYRO2_DR_200Hz   2
 
#define GYRO2_DR_100Hz   3
 
#define GYRO2_DR_50Hz   4
 
#define GYRO2_DR_25Hz   5
 
#define GYRO2_DR_12_5Hz   6
 
#define GYRO2_STANDBY   0
 
#define GYRO2_READY   1
 
#define GYRO2_ACTIVE   3
 
#define GYRO2_CTRL_REG2   0x14
 
#define GYRO2_INT_CFG_FIFO_INT1   0x80
 
#define GYRO2_INT_CFG_FIFO_INT2   0x00
 
#define GYRO2_INT_EN_FIFO   0x40
 
#define GYRO2_INT_DIS_FIFO   0x00
 
#define GYRO2_INT_CFG_RT_INT1   0x20
 
#define GYRO2_INT_CFG_RT_INT2   0x00
 
#define GYRO2_INT_EN_RT   0x10
 
#define GYRO2_DIS_EN_RT   0x00
 
#define GYRO2_INT_CFG_DRDY_INT1   0x08
 
#define GYRO2_INT_CFG_DRDY_INT2   0x00
 
#define GYRO2_INT_EN_DRDY   0x04
 
#define GYRO2_INT_DIS_DRDY   0x00
 
#define GYRO2_IPOL_ACTIVE_HI   0x02
 
#define GYRO2_IPOL_ACTIVE_LO   0x00
 
#define GYRO2_PP_OD_OS   0x01
 
#define GYRO2_PP_OD_PUSH_PULL   0x00
 
#define GYRO2_CTRL_REG3   0x15
 
#define GYRO2_MAP_MIKROBUS(cfg, mikrobus)
 
#define GYRO2_RETVAL   uint8_t
 
#define GYRO2_OK   0x00
 
#define GYRO2_INIT_ERROR   0xFF
 

Typedefs

typedef void(* gyro2_master_io_t) (struct gyro2_s *, uint8_t, uint8_t *, uint8_t)
 Master Input/Output type.
 
typedef struct gyro2_s gyro2_t
 Click ctx object definition.
 

Functions

void gyro2_cfg_setup (gyro2_cfg_t *cfg)
 Config Object Initialization function.
 
GYRO2_RETVAL gyro2_init (gyro2_t *ctx, gyro2_cfg_t *cfg)
 Initialization function.
 
uint8_t gyro2_default_cfg (gyro2_t *ctx)
 Click Default Configuration function.
 
void gyro2_generic_write (gyro2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void gyro2_generic_read (gyro2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void gyro2_scs_set (gyro2_t *ctx, uint8_t val)
 Set cs pin function.
 
void gyro2_rst_set (gyro2_t *ctx, uint8_t val)
 Set rst pin function.
 
void gyro2_cs_set (gyro2_t *ctx, uint8_t val)
 Comm interface function.
 
void gyro2_rdy_set (gyro2_t *ctx, uint8_t val)
 Set ready pin function.
 
uint8_t gyro2_rdy_get (gyro2_t *ctx)
 Get ready pin function.
 
uint8_t gyro2_int_get (gyro2_t *ctx)
 Get int pin function.
 
void gyro2_hw_reset (gyro2_t *ctx)
 Hardware reset function.
 
uint8_t gyro2_get_id (gyro2_t *ctx)
 ID return function.
 
void gyro2_get_axisraw (gyro2_t *ctx, int16_t *axis_data)
 Axis read function.
 
void gyro2_calc_axis (int16_t *axis_data)
 Calc axis funtion.
 
uint8_t gyro2_read_temperature (gyro2_t *ctx)
 Temperature read function.
 
void gyro2_sw_reset (gyro2_t *ctx)
 Soft reset function.
 
void gyro2_set_dr (gyro2_t *ctx, uint8_t rate)
 Data rate function.
 
void gyro2_set_opmode (gyro2_t *ctx, uint8_t opmode)
 
void gyro2_interrupt_cfg (gyro2_t *ctx, uint8_t int_route, uint8_t int_en, uint8_t polarity_outdrvsetting)
 Interrupt cfg function.
 
void gyro2_interrupt_event_generation (gyro2_t *ctx, uint8_t cfg)
 Int event generation function.
 
void gyro2_sensitivity (gyro2_t *ctx, uint8_t s_setting)
 Sensitivity function.
 
void gyro2_fr_setup (gyro2_t *ctx, uint8_t low_pass, uint8_t hi_pass, uint8_t scale_set)
 Filter and scale of measurement functio.
 

Detailed Description

This file contains API for Gyro 2 Click driver.