c6dofimu4 2.0.0.0
c6dofimu4.h File Reference

This file contains API for c6DOF IMU 4 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  c6dofimu4_axis_t
 
struct  c6dofimu4_s
 Click ctx object definition. More...
 
struct  c6dofimu4_cfg_t
 Click configuration structure definition. More...
 

Macros

#define C6DOFIMU4_MAP_MIKROBUS(cfg, mikrobus)
 
#define C6DOFIMU4_MASTER_I2C   0
 
#define C6DOFIMU4_MASTER_SPI   1
 
#define C6DOFIMU4_RETVAL   uint8_t
 
#define C6DOFIMU4_OK   0x00
 
#define C6DOFIMU4_INIT_ERROR   0xFF
 
#define C6DOFIMU4_DEVICE_ADDR   0x68
 
#define C6DOFIMU4_XG_OFFS_TC_REG   0x04
 
#define C6DOFIMU4_YG_OFFS_TC_REG   0x07
 
#define C6DOFIMU4_ZG_OFFS_TC_REG   0x0A
 
#define C6DOFIMU4_SELF_TEST_X_REG   0x0D
 
#define C6DOFIMU4_SELF_TEST_Y_REG   0x0E
 
#define C6DOFIMU4_SELF_TEST_Z_REG   0x0F
 
#define C6DOFIMU4_XG_OFFS_USR_REG   0x13
 
#define C6DOFIMU4_YG_OFFS_USR_REG   0x15
 
#define C6DOFIMU4_ZG_OFFS_USR_REG   0x17
 
#define C6DOFIMU4_SMPLRT_DIV_REG   0x19
 
#define C6DOFIMU4_CONFIG_REG   0x1A
 
#define C6DOFIMU4_GYRO_CONFIG_REG   0x1B
 
#define C6DOFIMU4_ACCEL_CONFIG_REG   0x1C
 
#define C6DOFIMU4_ACCEL_CONFIG2_REG   0x1D
 
#define C6DOFIMU4_LP_MODE_CFG_REG   0x1E
 
#define C6DOFIMU4_ACCEL_WOM_X_THR_REG   0x20
 
#define C6DOFIMU4_ACCEL_WOM_Y_THR_REG   0x21
 
#define C6DOFIMU4_ACCEL_WOM_Z_THR_REG   0x22
 
#define C6DOFIMU4_FIFO_EN_REG   0x23
 
#define C6DOFIMU4_FSYNC_INT_REG   0x36
 
#define C6DOFIMU4_INT_PIN_CFG_REG   0x37
 
#define C6DOFIMU4_INT_ENABLE_REG   0x38
 
#define C6DOFIMU4_FIFO_WM_INT_STATUS_REG   0x39
 
#define C6DOFIMU4_INT_STATUS_REG   0x3A
 
#define C6DOFIMU4_ACCEL_XOUT_REG   0x3B
 
#define C6DOFIMU4_ACCEL_YOUT_REG   0x3D
 
#define C6DOFIMU4_ACCEL_ZOUT_REG   0x3F
 
#define C6DOFIMU4_TEMP_OUT_REG   0x41
 
#define C6DOFIMU4_GYRO_XOUT_REG   0x43
 
#define C6DOFIMU4_GYRO_YOUT_REG   0x45
 
#define C6DOFIMU4_GYRO_ZOUT_REG   0x47
 
#define C6DOFIMU4_SELF_TEST_X_GYRO_REG   0x50
 
#define C6DOFIMU4_SELF_TEST_Y_GYRO_REG   0x51
 
#define C6DOFIMU4_SELF_TEST_Z_GYRO_REG   0x52
 
#define C6DOFIMU4_FIFO_WM_TH_REG   0x60
 
#define C6DOFIMU4_SIGNAL_PATH_RESET_REG   0x68
 
#define C6DOFIMU4_ACCEL_INTEL_CTRL_REG   0x69
 
#define C6DOFIMU4_USER_CTRL_REG   0x6A
 
#define C6DOFIMU4_PWR_MGMT_1_REG   0x6B
 
#define C6DOFIMU4_PWR_MGMT_2_REG   0x6C
 
#define C6DOFIMU4_I2C_IF_REG   0x70
 
#define C6DOFIMU4_FIFO_COUNT_REG   0x72
 
#define C6DOFIMU4_FIFO_R_W_REG   0x74
 
#define C6DOFIMU4_WHO_AM_I_REG   0x75
 
#define C6DOFIMU4_XA_OFFSET_REG   0x77
 
#define C6DOFIMU4_YA_OFFSET_REG   0x7A
 
#define C6DOFIMU4_ZA_OFFSET_REG   0x7D
 
#define C6DOFIMU4_FIFO_REPLACING_DIS   0x40
 
#define C6DOFIMU4_EXT_SYNC_FUNC_DIS   0x00
 
#define C6DOFIMU4_EXT_SYNC_TEMP_OUT_L   0x08
 
#define C6DOFIMU4_EXT_SYNC_GYRO_XOUT_L   0x10
 
#define C6DOFIMU4_EXT_SYNC_GYRO_YOUT_L   0x18
 
#define C6DOFIMU4_EXT_SYNC_GYRO_ZOUT_L   0x20
 
#define C6DOFIMU4_EXT_SYNC_ACCEL_XOUT_L   0x28
 
#define C6DOFIMU4_EXT_SYNC_ACCEL_YOUT_L   0x30
 
#define C6DOFIMU4_EXT_SYNC_ACCEL_ZOUT_L   0x38
 
#define C6DOFIMU4_FCHOICE_8173_HZ   0x01
 
#define C6DOFIMU4_GYRO_FCHOICE_3281_HZ   0x02
 
#define C6DOFIMU4_G_DLPF_CFG_250_HZ   0x00
 
#define C6DOFIMU4_G_DLPF_CFG_176_HZ   0x01
 
#define C6DOFIMU4_G_DLPF_CFG_92_HZ   0x02
 
#define C6DOFIMU4_G_DLPF_CFG_41_HZ   0x03
 
#define C6DOFIMU4_G_DLPF_CFG_20_HZ   0x04
 
#define C6DOFIMU4_G_DLPF_CFG_10_HZ   0x05
 
#define C6DOFIMU4_G_DLPF_CFG_5_HZ   0x06
 
#define C6DOFIMU4_G_DLPF_CFG_3281_HZ   0x07
 
#define C6DOFIMU4_XG_ST   0x80
 
#define C6DOFIMU4_YG_ST   0x40
 
#define C6DOFIMU4_ZG_ST   0x20
 
#define C6DOFIMU4_GYRO_FS_SEL_250_DPS   0x00
 
#define C6DOFIMU4_GYRO_FS_SEL_500_DPS   0x01
 
#define C6DOFIMU4_GYRO_FS_SEL_1000_DPS   0x02
 
#define C6DOFIMU4_GYRO_FS_SEL_2000_DPS   0x03
 
#define C6DOFIMU4_XA_ST   0x80
 
#define C6DOFIMU4_YA_ST   0x40
 
#define C6DOFIMU4_ZA_ST   0x20
 
#define C6DOFIMU4_ACCEL_FS_SEL_2_G   0x00
 
#define C6DOFIMU4_ACCEL_FS_SEL_4_G   0x01
 
#define C6DOFIMU4_ACCEL_FS_SEL_8_G   0x02
 
#define C6DOFIMU4_ACCEL_FS_SEL_16_G   0x03
 
#define C6DOFIMU4_ACCEL_AVRG_CFG_4_SAMPLES   0x00
 
#define C6DOFIMU4_ACCEL_AVRG_CFG_8_SAMPLES   0x10
 
#define C6DOFIMU4_ACCEL_AVRG_CFG_16_SAMPLES   0x20
 
#define C6DOFIMU4_ACCEL_AVRG_CFG_32_SAMPLES   0x30
 
#define C6DOFIMU4_ACCEL_FCHOICE_1046_HZ   0x08
 
#define C6DOFIMU4_A_DLPF_CFG_218_HZ   0x01
 
#define C6DOFIMU4_A_DLPF_CFG_99_HZ   0x02
 
#define C6DOFIMU4_A_DLPF_CFG_44_HZ   0x03
 
#define C6DOFIMU4_A_DLPF_CFG_21_HZ   0x04
 
#define C6DOFIMU4_A_DLPF_CFG_10_HZ   0x05
 
#define C6DOFIMU4_A_DLPF_CFG_5_HZ   0x06
 
#define C6DOFIMU4_A_DLPF_CFG_420_HZ   0x07
 
#define C6DOFIMU4_GYRO_LP_MODE_EN   0x80
 
#define C6DOFIMU4_G_AVGCFG_1X_622HZ   0x00
 
#define C6DOFIMU4_G_AVGCFG_2X_391HZ   0x10
 
#define C6DOFIMU4_G_AVGCFG_4X_211HZ   0x20
 
#define C6DOFIMU4_G_AVGCFG_8X_108HZ   0x30
 
#define C6DOFIMU4_G_AVGCFG_16X_54HZ   0x40
 
#define C6DOFIMU4_G_AVGCFG_32X_27HZ   0x50
 
#define C6DOFIMU4_G_AVGCFG_64X_14HZ   0x60
 
#define C6DOFIMU4_G_AVGCFG_128X_7HZ   0x70
 
#define C6DOFIMU4_GYRO_FIFO_EN   0x10
 
#define C6DOFIMU4_ACCEL_FIFO_EN   0x08
 
#define C6DOFIMU4_FSYNC_INT_MASK   0x80
 
#define C6DOFIMU4_FSYNC_INT_OCCURED   0x80
 
#define C6DOFIMU4_FSYNC_INT_NOT_OCCURED   0x00
 
#define C6DOFIMU4_INT_DRDY_PIN_ACT_LOW   0x80
 
#define C6DOFIMU4_INT_DRDY_PIN_ACT_HIGH   0x00
 
#define C6DOFIMU4_INT_DRDY_PIN_OPEN_DRAIN   0x40
 
#define C6DOFIMU4_INT_DRDY_PIN_PUSH_PULL   0x00
 
#define C6DOFIMU4_INT_DRDY_PIN_STAT_CLEARED   0x20
 
#define C6DOFIMU4_INT_DRDY_PIN_PULSE   0x00
 
#define C6DOFIMU4_INT_STAT_CLEARED_ANY_READ   0x10
 
#define C6DOFIMU4_INT_STAT_CLEARED_STAT_REG_READ   0x00
 
#define C6DOFIMU4_FSYNC_PIN_INT_ACT_LOW   0x08
 
#define C6DOFIMU4_FSYNC_PIN_INT_ACT_HIGH   0x00
 
#define C6DOFIMU4_FSYNC_INT_MODE_EN   0x04
 
#define C6DOFIMU4_FIFO_WM_INT_MASK   0x40
 
#define C6DOFIMU4_FIFO_WM_INT_OCCURED   0x40
 
#define C6DOFIMU4_FIFO_WM_INT_NOT_OCCURED   0x00
 
#define C6DOFIMU4_WOM_X_INT_MASK   0x80
 
#define C6DOFIMU4_WOM_X_INT_OCCURED   0x80
 
#define C6DOFIMU4_WOM_Y_INT_MASK   0x40
 
#define C6DOFIMU4_WOM_Y_INT_OCCURED   0x40
 
#define C6DOFIMU4_WOM_Z_INT_MASK   0x20
 
#define C6DOFIMU4_WOM_Z_INT_OCCURED   0x20
 
#define C6DOFIMU4_FIFO_OFLOW_INT_MASK   0x10
 
#define C6DOFIMU4_FIFO_OFLOW_INT_OCCURED   0x10
 
#define C6DOFIMU4_GDRIVE_INT_MASK   0x04
 
#define C6DOFIMU4_GDRIVE_INT_OCCURED   0x04
 
#define C6DOFIMU4_DATA_RDY_INT_MASK   0x01
 
#define C6DOFIMU4_DATA_RDY_INT_OCCURED   0x01
 
#define C6DOFIMU4_INT_STATUS_NOT_OCCURED   0x00
 
#define C6DOFIMU4_ACCEL_RST   0x02
 
#define C6DOFIMU4_TEMP_RST   0x01
 
#define C6DOFIMU4_ACCEL_INTEL_WOM_DET_LOGIC_EN   0x80
 
#define C6DOFIMU4_ACCEL_INTEL_MODE_NOT_USE   0x00
 
#define C6DOFIMU4_ACCEL_INTEL_MODE_COMPARE   0x40
 
#define C6DOFIMU4_OUTPUT_LIMIT_EN   0x02
 
#define C6DOFIMU4_WOM_TH_MODE_OR   0x00
 
#define C6DOFIMU4_WOM_TH_MODE_AND   0x01
 
#define C6DOFIMU4_FIFO_EN   0x40
 
#define C6DOFIMU4_FIFO_RST   0x04
 
#define C6DOFIMU4_ALL_DIG_SIG_PATH_RST   0x01
 
#define C6DOFIMU4_DEVICE_RST   0x80
 
#define C6DOFIMU4_SLEEP   0x40
 
#define C6DOFIMU4_CYCLE   0x20
 
#define C6DOFIMU4_GYRO_STANDBY   0x10
 
#define C6DOFIMU4_TEMP_DIS   0x08
 
#define C6DOFIMU4_CLKSEL_AUTO_SELECT   0x05
 
#define C6DOFIMU4_CLKSEL_INTERNAL_20_MHZ   0x06
 
#define C6DOFIMU4_CLKSEL_STOP_CLOCK   0x07
 
#define C6DOFIMU4_STBY_XA   0x20
 
#define C6DOFIMU4_STBY_YA   0x10
 
#define C6DOFIMU4_STBY_ZA   0x08
 
#define C6DOFIMU4_STBY_XG   0x04
 
#define C6DOFIMU4_STBY_YG   0x02
 
#define C6DOFIMU4_STBY_ZG   0x01
 
#define C6DOFIMU4_ALL_AXIS_EN   0x00
 
#define C6DOFIMU4_I2C_IF_DIS   0x40
 
#define C6DOFIMU4_I2C_IF_EN   0x00
 
#define C6DOFIMU4_OK   0x00
 
#define C6DOFIMU4_INT_OCCURED   0x01
 
#define C6DOFIMU4_ADDR_ERROR   0x02
 
#define C6DOFIMU4_SENS_RESOLUTION_ERROR   0x03
 
#define C6DOFIMU4_LOG_HIGH   0x01
 
#define C6DOFIMU4_LOG_LOW   0x00
 

Typedefs

typedef uint8_t c6dofimu4_select_t
 Communication type.
 
typedef void(* c6dofimu4_master_io_t) (struct c6dofimu4_s *, uint8_t, uint8_t *, uint8_t)
 Master Input/Output type.
 
typedef struct c6dofimu4_s c6dofimu4_t
 Click ctx object definition.
 

Functions

void c6dofimu4_cfg_setup (c6dofimu4_cfg_t *cfg)
 Config Object Initialization function.
 
C6DOFIMU4_RETVAL c6dofimu4_init (c6dofimu4_t *ctx, c6dofimu4_cfg_t *cfg)
 Initialization function.
 
void c6dofimu4_default_cfg (c6dofimu4_t *ctx)
 Click Default Configuration function.
 
void c6dofimu4_generic_write (c6dofimu4_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void c6dofimu4_generic_read (c6dofimu4_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
uint8_t c6dofimu4_write_byte (c6dofimu4_t *ctx, uint8_t reg_addr, uint8_t data_in)
 Generic Single Byte Write function.
 
uint8_t c6dofimu4_read_byte (c6dofimu4_t *ctx, uint8_t reg_addr, uint8_t *data_out)
 Generic Single Byte Read function.
 
uint8_t c6dofimu4_write_word (c6dofimu4_t *ctx, uint8_t reg_addr, uint16_t data_in)
 Generic Word Write function.
 
uint8_t c6dofimu4_read_word (c6dofimu4_t *ctx, uint8_t reg_addr, uint16_t *data_out)
 Generic Word Read function.
 
uint8_t c6dofimu4_write_bytes (c6dofimu4_t *ctx, uint8_t start_addr, uint8_t *data_in, uint8_t n_bytes)
 Generic Sequential Write function.
 
uint8_t c6dofimu4_read_bytes (c6dofimu4_t *ctx, uint8_t start_addr, uint8_t *data_out, uint8_t n_bytes)
 Generic Sequential Read function.
 
void c6dofimu4_reset (c6dofimu4_t *ctx)
 Device Reset function.
 
void c6dofimu4_set_sync_pin (c6dofimu4_t *ctx, uint8_t state)
 Sync Pin Setting function.
 
uint8_t c6dofimu4_get_int_pin (c6dofimu4_t *ctx)
 Int Pin Check function.
 
uint8_t c6dofimu4_get_status (c6dofimu4_t *ctx, uint8_t bit_mask)
 Status Check function.
 
void c6dofimu4_get_data (c6dofimu4_t *ctx, c6dofimu4_axis_t *accel_out, c6dofimu4_axis_t *gyro_out, int8_t *temp_out)
 Data Get function.
 
uint8_t c6dofimu4_set_fsr (c6dofimu4_t *ctx, uint8_t gyro_resol, uint8_t accel_resol)
 Full Scale Setting function.
 

Detailed Description

This file contains API for c6DOF IMU 4 Click driver.