gyro3 2.0.0.0
gyro3.h File Reference

This file contains API for Gyro 3 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  gyro3_s
 Click ctx object definition. More...
 
struct  gyro3_cfg_t
 Click configuration structure definition. More...
 

Macros

#define GYRO3_MAP_MIKROBUS(cfg, mikrobus)
 
#define GYRO3_MASTER_I2C   0
 
#define GYRO3_MASTER_SPI   1
 
#define GYRO3_RETVAL   uint8_t
 
#define GYRO3_OK   0x00
 
#define GYRO3_INIT_ERROR   0xFF
 
#define GYRO3_DEVICE_ADDR_SA0   0x68
 
#define GYRO3_DEVICE_ADDR_SA1   0x69
 
#define GYRO3_MODE_POWER_DOWN   0x00
 
#define GYRO3_MODE_SLEEP   0x08
 
#define GYRO3_MODE_NORMAL   0x0F
 
#define GYRO3_CTRL_REG1   0x20
 
#define GYRO3_CTRL_REG2   0x21
 
#define GYRO3_CTRL_REG3   0x22
 
#define GYRO3_CTRL_REG4   0x23
 
#define GYRO3_CTRL_REG5   0x24
 
#define GYRO3_ODR_100_CUTOFF_12p5   0x00
 
#define GYRO3_ODR_100_CUTOFF_25   0x10
 
#define GYRO3_ODR_200_CUTOFF_12p5   0x40
 
#define GYRO3_ODR_200_CUTOFF_25   0x50
 
#define GYRO3_ODR_200_CUTOFF_50   0x60
 
#define GYRO3_ODR_200_CUTOFF_70   0x70
 
#define GYRO3_ODR_400_CUTOFF_20   0x80
 
#define GYRO3_ODR_400_CUTOFF_25   0x90
 
#define GYRO3_ODR_400_CUTOFF_50   0xa0
 
#define GYRO3_ODR_400_CUTOFF_110   0xb0
 
#define GYRO3_ODR_800_CUTOFF_30   0xc0
 
#define GYRO3_ODR_800_CUTOFF_35   0xd0
 
#define GYRO3_ODR_800_CUTOFF_50   0xe0
 
#define GYRO3_ODR_800_CUTOFF_110   0xf0
 
#define GYRO3_FIFO_MODE_BYPASS   0x00
 
#define GYRO3_FIFO_EMPTY_INT_ON_INT2   0x01
 
#define GYRO3_FIFO_OVERRUN_INT_ON_INT2   0x02
 
#define GYRO3_FIFO_WATERMARK_INT_ON_INT2   0x04
 
#define GYRO3_FIFO_MODE_FIFO   0x20
 
#define GYRO3_FIFO_MODE_STREAM   0x40
 
#define GYRO3_FIFO_WTM_STATUS_MASK   0x80
 
#define GYRO3_FIFO_OVERRUN_MASK   0x40
 
#define GYRO3_FIFO_EMPTY_STATUS   0x20
 
#define GYRO3_WHO_AM_I   0x0f
 
#define GYRO3_REF_DATACAP   0x25
 
#define GYRO3_OUT_TEMP   0x26
 
#define GYRO3_STATUS_REG   0x27
 
#define GYRO3_OUT_X_L   0x28
 
#define GYRO3_OUT_X_H   0x29
 
#define GYRO3_OUT_Y_L   0x2a
 
#define GYRO3_OUT_Y_H   0x2b
 
#define GYRO3_OUT_Z_L   0x2c
 
#define GYRO3_OUT_Z_H   0x2d
 
#define GYRO3_FIFO_CTRL   0x2e
 
#define GYRO3_FIFO_SRC   0x2f
 
#define GYRO3_INT1_CFG   0x30
 
#define GYRO3_INT1_SRC   0x31
 
#define GYRO3_INT1_THS_XH   0x32
 
#define GYRO3_INT1_THS_XL   0x33
 
#define GYRO3_INT1_THS_YH   0x34
 
#define GYRO3_INT1_THS_YL   0x35
 
#define GYRO3_INT1_THS_ZH   0x36
 
#define GYRO3_INT1_THS_ZL   0x37
 
#define GYRO3_INT1_DURATION   0x38
 
#define GYRO3_HPF_MODE_NORMAL   0x00
 
#define GYRO3_HPF_MODE_REF_SIGNAL   0x10
 
#define GYRO3_HPF_MODE_AUTO_RESET_ON_INT   0x30
 
#define GYRO3_HPF_CUTOFF_FREQ_8   0x00
 
#define GYRO3_HPF_CUTOFF_FREQ_4   0x01
 
#define GYRO3_HPF_CUTOFF_FREQ_2   0x02
 
#define GYRO3_HPF_CUTOFF_FREQ_1   0x03
 
#define GYRO3_HPF_CUTOFF_FREQ_0p5   0x04
 
#define GYRO3_HPF_CUTOFF_FREQ_0p2   0x05
 
#define GYRO3_HPF_CUTOFF_FREQ_0p1   0x06
 
#define GYRO3_HPF_CUTOFF_FREQ_0p05   0x07
 
#define GYRO3_HPF_CUTOFF_FREQ_0p02   0x08
 
#define GYRO3_HPF_CUTOFF_FREQ_0p01   0x09
 
#define GYRO3_INT_ON_INT1   0x80
 
#define GYRO3_BOOT_STATUS_ON_INT1   0x40
 
#define GYRO3_INT_ACTIVE_CFG_ON_INT1   0x20
 
#define GYRO3_PUSH_PULL   0x00
 
#define GYRO3_OPEN_DRAIN   0x10
 
#define GYRO3_DRDY_ON_INT2   0x08
 
#define GYRO3_BIG_ENDIAN   0x40
 
#define GYRO3_LITTLE_ENDIAN   0x00
 
#define GYRO3_FULL_SCACLE_245   0x00
 
#define GYRO3_FULL_SCACLE_500   0x10
 
#define GYRO3_FULL_SCACLE_1000   0x20
 
#define GYRO3_FULL_SCACLE_2000   0x30
 
#define GYRO3_SELF_TEST_NORMAL   0x00
 
#define GYRO3_SELF_TEST_0   0x02
 
#define GYRO3_SELF_TEST_1   0x06
 
#define GYRO3_SPI_MODE_4_WIRE   0x00
 
#define GYRO3_SPI_MODE_3_WIRE   0x01
 
#define GYRO3_REBOOT_MEMORY   0x80
 
#define GYRO3_FIFO_EN   0x40
 
#define GYRO3_HPF_EN   0x10
 
#define GYRO3_INT_SEL_00   0x00
 
#define GYRO3_INT_SEL_01   0x40
 
#define GYRO3_INT_SEL_10   0x80
 
#define GYRO3_OUT_SEL_00   0x00
 
#define GYRO3_OUT_SEL_01   0x01
 
#define GYRO3_OUT_SEL_10   0x02
 
#define GYRO3_ZYX_OVERRUN_MASK   0x80
 
#define GYRO3_Z_MASK   0x40
 
#define GYRO3_Y_MASK   0x20
 
#define GYRO3_X_MASK   0x10
 
#define GYRO3_ZYX_NEW_DATA_MASK   0x08
 
#define GYRO3_Z_NEW_DATA_MASK   0x04
 
#define GYRO3_Y_NEW_DATA_MASK   0x02
 
#define GYRO3_X_NEW_DATA_MASK   0x01
 
#define GYRO3_INT1_AND_OR   0x80
 
#define GYRO3_INT1_LATCH   0x40
 
#define GYRO3_INT1_ON_HIGH_Z   0x20
 
#define GYRO3_INT1_ON_LOW_Z   0x10
 
#define GYRO3_INT1_ON_HIGH_Y   0x08
 
#define GYRO3_INT1_ON_LOW_Y   0x04
 
#define GYRO3_INT1_ON_HIGH_X   0x02
 
#define GYRO3_INT1_ON_LOW_X   0x01
 
#define GYRO3_INT1_INT_ACTIVE_MASK   0x40
 
#define GYRO3_INT1_Z_HIGH_INT_MASK   0x20
 
#define GYRO3_INT1_Z_LOW_INT_MASK   0x10
 
#define GYRO3_INT1_Y_HIGH_INT_MASK   0x08
 
#define GYRO3_INT1_Y_LOW_INT_MASK   0x04
 
#define GYRO3_INT1_X_HIGH_INT_MASK   0x02
 
#define GYRO3_INT1_X_LOW_INT_MASK   0x01
 
#define GYRO3_WAIT_ENABLE   0x80
 
#define GYRO3_WAIT_DISABLE   0x00
 
#define GYRO3_MEAS_RANGE_245   0x01
 
#define GYRO3_MEAS_RANGE_500   0x02
 
#define GYRO3_MEAS_RANGE_2000   0x03
 

Typedefs

typedef uint8_t gyro3_select_t
 Communication type.
 
typedef void(* gyro3_master_io_t) (struct gyro3_s *, uint8_t, uint8_t *, uint8_t)
 Master Input/Output type.
 
typedef struct gyro3_s gyro3_t
 Click ctx object definition.
 

Functions

void gyro3_cfg_setup (gyro3_cfg_t *cfg)
 Config Object Initialization function.
 
GYRO3_RETVAL gyro3_init (gyro3_t *ctx, gyro3_cfg_t *cfg)
 Initialization function.
 
void gyro3_default_cfg (gyro3_t *ctx)
 Click Default Configuration function.
 
void gyro3_generic_write (gyro3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void gyro3_generic_read (gyro3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
uint8_t gyro3_int_get (gyro3_t *ctx)
 Get INT pin state.
 
uint8_t gyro3_di2_get (gyro3_t *ctx)
 Get di2 (AN) pin state.
 
void gyro3_read (gyro3_t *ctx, uint8_t register_address, uint8_t *read_buffer, uint8_t n_bytes)
 Reading register(s)
 
void gyro3_write (gyro3_t *ctx, uint8_t register_address, uint8_t value)
 Write byte to regiter.
 
void gyro3_get_temp (gyro3_t *ctx, uint8_t *temperature_value)
 Read value from temperature register.
 
void gyro3_get_axes (gyro3_t *ctx, float *x_axis, float *y_axis, float *z_axis, uint8_t measurement_range)
 Get XYZ axes dps values.
 
void gyro3_get_status (gyro3_t *ctx, uint8_t *status_register)
 Getting status register content.
 
void gyro3_get_fifo_data_level (gyro3_t *ctx, uint8_t *fifo_data_level)
 Get FIFO data level.
 
void gyro3_set_int1_thresholds (gyro3_t *ctx, int16_t x_threshold, int16_t y_threshold, int16_t z_threshold)
 Setting values for interrupt thresholds.
 
uint8_t gyro3_set_int1_duration (gyro3_t *ctx, uint8_t wait_enable_bit, uint8_t duration_value)
 Setting interrupt duration time on INT1 pin.
 

Detailed Description

This file contains API for Gyro 3 Click driver.