c9dof3 2.0.0.0
c9dof3.h File Reference

This file contains API for 9DOF 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  c9dof3_s
 Click ctx object definition. More...
 
struct  c9dof3_cfg_t
 Click configuration structure definition. More...
 
struct  c9dof3_accel_t
 
struct  c9dof3_gyro_t
 
struct  c9dof3_mag_t
 

Macros

#define C9DOF3_MAP_MIKROBUS(cfg, mikrobus)
 
#define C9DOF3_MASTER_I2C   0
 
#define C9DOF3_MASTER_SPI   1
 
#define C9DOF3_RETVAL   uint8_t
 
#define C9DOF3_ACC_I2C_SLAVE_ADDRESS   0x18
 
#define C9DOF3_GYRO_I2C_SLAVE_ADDRESS   0x68
 
#define C9DOF3_MAG_I2C_SLAVE_ADDRESS   0x10
 
#define C9DOF3_ACC_DEVICE   0xFA
 
#define C9DOF3_GYRO_DEVICE   0x0F
 
#define C9DOF3_MAG_DEVICE   0x32
 
#define C9DOF3_INITIATED_SOFT_RESET   0xB6
 
#define C9DOF3_REG_ACC_WHO_AM_I   0x00
 
#define C9DOF3_REG_ACC_DATA_START   0x02
 
#define C9DOF3_REG_ACC_D_X_LSB   0x02
 
#define C9DOF3_REG_ACC_D_X_MSB   0x03
 
#define C9DOF3_REG_ACC_D_Y_LSB   0x04
 
#define C9DOF3_REG_ACC_D_Y_MSB   0x05
 
#define C9DOF3_REG_ACC_D_Z_LSB   0x06
 
#define C9DOF3_REG_ACC_D_Z_MSB   0x07
 
#define C9DOF3_REG_ACC_D_TEMP   0x08
 
#define C9DOF3_REG_ACC_INT_STATUS_0   0x09
 
#define C9DOF3_REG_ACC_INT_STATUS_1   0x0A
 
#define C9DOF3_REG_ACC_INT_STATUS_2   0x0B
 
#define C9DOF3_REG_ACC_INT_STATUS_3   0x0C
 
#define C9DOF3_REG_ACC_FIFO_STATUS   0x0E
 
#define C9DOF3_REG_ACC_PMU_RANGE   0x0F
 
#define C9DOF3_REG_ACC_PMU_BW   0x10
 
#define C9DOF3_REG_ACC_PMU_LPW   0x11
 
#define C9DOF3_REG_ACC_PMU_LOW_POWER   0x12
 
#define C9DOF3_REG_ACC_D_HBW   0x13
 
#define C9DOF3_REG_ACC_BGW_SOFTRESET   0x14
 
#define C9DOF3_REG_ACC_INT_EN_0   0x16
 
#define C9DOF3_REG_ACC_INT_EN_1   0x17
 
#define C9DOF3_REG_ACC_INT_EN_2   0x18
 
#define C9DOF3_REG_ACC_INT_MAP_0   0x19
 
#define C9DOF3_REG_ACC_INT_MAP_1   0x1A
 
#define C9DOF3_REG_ACC_INT_MAP_2   0x1B
 
#define C9DOF3_REG_ACC_INT_SRC   0x1E
 
#define C9DOF3_REG_ACC_INT_OUT_CTRL   0x20
 
#define C9DOF3_REG_ACC_INT_RST_LATCH   0x21
 
#define C9DOF3_REG_ACC_INT_0   0x22
 
#define C9DOF3_REG_ACC_INT_1   0x23
 
#define C9DOF3_REG_ACC_INT_2   0x24
 
#define C9DOF3_REG_ACC_INT_3   0x25
 
#define C9DOF3_REG_ACC_INT_4   0x26
 
#define C9DOF3_REG_ACC_INT_5   0x27
 
#define C9DOF3_REG_ACC_INT_6   0x28
 
#define C9DOF3_REG_ACC_INT_7   0x29
 
#define C9DOF3_REG_ACC_INT_8   0x2A
 
#define C9DOF3_REG_ACC_INT_9   0x2B
 
#define C9DOF3_REG_ACC_INT_A   0x2C
 
#define C9DOF3_REG_ACC_INT_B   0x2D
 
#define C9DOF3_REG_ACC_INT_C   0x2E
 
#define C9DOF3_REG_ACC_INT_D   0x2F
 
#define C9DOF3_REG_ACC_FIFO_CONFIG_0   0x30
 
#define C9DOF3_REG_ACC_PMU_SELF_TEST   0x32
 
#define C9DOF3_REG_ACC_TRIM_NVM_CTRL   0x33
 
#define C9DOF3_REG_ACC_BGW_SPI3_WDT   0x34
 
#define C9DOF3_REG_ACC_OFC_CTRL   0x36
 
#define C9DOF3_REG_ACC_OFC_SETTING   0x37
 
#define C9DOF3_REG_ACC_OFC_OFFSET_X   0x38
 
#define C9DOF3_REG_ACC_OFC_OFFSET_Y   0x39
 
#define C9DOF3_REG_ACC_OFC_OFFSET_Z   0x3A
 
#define C9DOF3_REG_ACC_TRIM_GPO   0x3B
 
#define C9DOF3_REG_ACC_TRIM_GP1   0x3C
 
#define C9DOF3_REG_ACC_FIFO_CONFIG_1   0x3E
 
#define C9DOF3_REG_ACC_FIFO_DATA   0x3F
 
#define C9DOF3_REG_GYRO_WHO_AM_I   0x00
 
#define C9DOF3_REG_GYRO_DATA_START   0x02
 
#define C9DOF3_REG_GYRO_RATE_X_LSB   0x02
 
#define C9DOF3_REG_GYRO_RATE_X_MSB   0x03
 
#define C9DOF3_REG_GYRO_RATE_Y_LSB   0x04
 
#define C9DOF3_REG_GYRO_RATE_Y_MSB   0x05
 
#define C9DOF3_REG_GYRO_RATE_Z_LSB   0x06
 
#define C9DOF3_REG_GYRO_RATE_Z_MSB   0x07
 
#define C9DOF3_REG_GYRO_INT_STATUS_0   0x09
 
#define C9DOF3_REG_GYRO_INT_STATUS_1   0x0A
 
#define C9DOF3_REG_GYRO_INT_STATUS_2   0x0B
 
#define C9DOF3_REG_GYRO_INT_STATUS_3   0x0C
 
#define C9DOF3_REG_GYRO_FIFO_STATUS   0x0E
 
#define C9DOF3_REG_GYRO_RANGE   0x0F
 
#define C9DOF3_REG_GYRO_BW   0x10
 
#define C9DOF3_REG_GYRO_LPM1   0x11
 
#define C9DOF3_REG_GYRO_LPM2   0x12
 
#define C9DOF3_REG_GYRO_RATE_HBW   0x13
 
#define C9DOF3_REG_GYRO_BGW_SOFTRESET   0x14
 
#define C9DOF3_REG_GYRO_INT_EN_0   0x15
 
#define C9DOF3_REG_GYRO_INT_EN_1   0x16
 
#define C9DOF3_REG_GYRO_INT_MAP_0   0x17
 
#define C9DOF3_REG_GYRO_INT_MAP_1   0x18
 
#define C9DOF3_REG_GYRO_INT_MAP_2   0x19
 
#define C9DOF3_REG_GYRO_INT_SRC_1   0x1A
 
#define C9DOF3_REG_GYRO_INT_SRC_2   0x1B
 
#define C9DOF3_REG_GYRO_INT_SRC_3   0x1C
 
#define C9DOF3_REG_GYRO_FIFO_EN   0x1E
 
#define C9DOF3_REG_GYRO_INT_RST_LATCH   0x21
 
#define C9DOF3_REG_GYRO_HIGH_TH_X   0x22
 
#define C9DOF3_REG_GYRO_HIGH_DUR_X   0x23
 
#define C9DOF3_REG_GYRO_HIGH_TH_Y   0x24
 
#define C9DOF3_REG_GYRO_HIGH_DUR_Y   0x25
 
#define C9DOF3_REG_GYRO_HIGH_TH_Z   0x26
 
#define C9DOF3_REG_GYRO_HIGH_DUR_Z   0x27
 
#define C9DOF3_REG_GYRO_SOC   0x31
 
#define C9DOF3_REG_GYRO_A_FOC   0x32
 
#define C9DOF3_REG_GYRO_TRIM_NVM_CTRL   0x33
 
#define C9DOF3_REG_GYRO_BGW_SPI3_WDT   0x34
 
#define C9DOF3_REG_GYRO_OFC1   0x36
 
#define C9DOF3_REG_GYRO_OFC2   0x37
 
#define C9DOF3_REG_GYRO_OFC3   0x38
 
#define C9DOF3_REG_GYRO_OFC4   0x39
 
#define C9DOF3_REG_GYRO_TRIM_GP0   0x3A
 
#define C9DOF3_REG_GYRO_TRIM_GP1   0x3B
 
#define C9DOF3_REG_GYRO_BIST   0x3C
 
#define C9DOF3_REG_GYRO_FIFO_CONFIG_0   0x3D
 
#define C9DOF3_REG_GYRO_FIFO_CONFIG_1   0x3E
 
#define C9DOF3_REG_MAG_WHO_AM_I   0x40
 
#define C9DOF3_REG_MAG_DATA_START   0x42
 
#define C9DOF3_REG_MAG_XOUT_LSB   0x42
 
#define C9DOF3_REG_MAG_XOUT_MSB   0x43
 
#define C9DOF3_REG_MAG_YOUT_LSB   0x44
 
#define C9DOF3_REG_MAG_YOUT_MSB   0x45
 
#define C9DOF3_REG_MAG_ZOUT_LSB   0x46
 
#define C9DOF3_REG_MAG_ZOUT_MSB   0x47
 
#define C9DOF3_REG_MAG_ROUT_LSB   0x48
 
#define C9DOF3_REG_MAG_ROUT_MSB   0x49
 
#define C9DOF3_REG_MAG_INT_STATUS   0x4A
 
#define C9DOF3_REG_MAG_PWR_CNTL1   0x4B
 
#define C9DOF3_REG_MAG_PWR_CNTL2   0x4C
 
#define C9DOF3_REG_MAG_INT_EN_1   0x4D
 
#define C9DOF3_REG_MAG_INT_EN_2   0x4E
 
#define C9DOF3_REG_MAG_LOW_THS   0x4F
 
#define C9DOF3_REG_MAG_HIGH_THS   0x50
 
#define C9DOF3_REG_MAG_REP_XY   0x51
 
#define C9DOF3_REG_MAG_REP_Z   0x52
 
#define C9DOF3_ACC_RANGE_2   0x03
 
#define C9DOF3_ACC_RANGE_4   0x05
 
#define C9DOF3_ACC_RANGE_8   0x08
 
#define C9DOF3_ACC_RANGE_16   0x0C
 
#define C9DOF3_ACC_PMU_BW_7_81   0x08
 
#define C9DOF3_ACC_PMU_BW_15_63   0x09
 
#define C9DOF3_ACC_PMU_BW_31_25   0x0A
 
#define C9DOF3_ACC_PMU_BW_62_5   0x0B
 
#define C9DOF3_ACC_PMU_BW_125   0x0C
 
#define C9DOF3_ACC_PMU_BW_250   0x0D
 
#define C9DOF3_ACC_PMU_BW_500   0x0E
 
#define C9DOF3_ACC_PMU_BW_1000   0x0F
 
#define C9DOF3_ACC_PMU_LPW_MODE_NOMAL   0x00
 
#define C9DOF3_ACC_PMU_LPW_MODE_DEEP_SUSPEND   0x20
 
#define C9DOF3_ACC_PMU_LPW_MODE_LOW_POWER   0x40
 
#define C9DOF3_ACC_PMU_LPW_MODE_SUSPEND   0x80
 
#define C9DOF3_ACC_PMU_LPW_SLEEP_DUR_0_5MS   0x00
 
#define C9DOF3_ACC_PMU_LPW_SLEEP_DUR_1MS   0x0C
 
#define C9DOF3_ACC_PMU_LPW_SLEEP_DUR_2MS   0x0E
 
#define C9DOF3_ACC_PMU_LPW_SLEEP_DUR_4MS   0x10
 
#define C9DOF3_ACC_PMU_LPW_SLEEP_DUR_6MS   0x12
 
#define C9DOF3_ACC_PMU_LPW_SLEEP_DUR_10MS   0x14
 
#define C9DOF3_ACC_PMU_LPW_SLEEP_DUR_25MS   0x16
 
#define C9DOF3_ACC_PMU_LPW_SLEEP_DUR_50MS   0x18
 
#define C9DOF3_ACC_PMU_LPW_SLEEP_DUR_100MS   0x1A
 
#define C9DOF3_ACC_PMU_LPW_SLEEP_DUR_500MS   0x1C
 
#define C9DOF3_ACC_PMU_LPW_SLEEP_DUR_1S   0x1E
 
#define C9DOF3_GYRO_LPM1_MODE_NOMAL   0x00
 
#define C9DOF3_GYRO_LPM1_MODE_DEEP_SUSPEND   0x01
 
#define C9DOF3_GYRO_LPM1_MODE_SUSPEND   0x10
 
#define C9DOF3_GYRO_RANGE_16_4   0x00
 
#define C9DOF3_GYRO_RANGE_32_8   0x01
 
#define C9DOF3_GYRO_RANGE_65_6   0x02
 
#define C9DOF3_GYRO_RANGE_131_2   0x03
 
#define C9DOF3_GYRO_RANGE_262_4   0x04
 
#define C9DOF3_GYRO_BW_32   0x07
 
#define C9DOF3_GYRO_BW_64   0x06
 
#define C9DOF3_GYRO_BW_12   0x05
 
#define C9DOF3_GYRO_BW_23   0x04
 
#define C9DOF3_GYRO_BW_47   0x03
 
#define C9DOF3_GYRO_BW_116   0x02
 
#define C9DOF3_GYRO_BW_230   0x01
 
#define C9DOF3_GYRO_BW_523   0x00
 
#define C9DOF3_GYRO_LPM1_SLEEP_DUR_2MS   0x00
 
#define C9DOF3_GYRO_LPM1_SLEEP_DUR_4MS   0x01
 
#define C9DOF3_GYRO_LPM1_SLEEP_DUR_5MS   0x02
 
#define C9DOF3_GYRO_LPM1_SLEEP_DUR_8MS   0x03
 
#define C9DOF3_GYRO_LPM1_SLEEP_DUR_10MS   0x04
 
#define C9DOF3_GYRO_LPM1_SLEEP_DUR_15MS   0x05
 
#define C9DOF3_GYRO_LPM1_SLEEP_DUR_18MS   0x06
 
#define C9DOF3_GYRO_LPM1_SLEEP_DUR_20MS   0x07
 
#define C9DOF3_MAG_POW_CTL_SOFT_RESET   0x82
 
#define C9DOF3_MAG_POW_CTL_SLEEP_MODE   0x01
 
#define C9DOF3_MAG_POW_CTL_SUSPEND_MODE   0x00
 
#define C9DOF3_MAG_DATA_RATE_10   0x00
 
#define C9DOF3_MAG_DATA_RATE_2   0x08
 
#define C9DOF3_MAG_DATA_RATE_6   0x10
 
#define C9DOF3_MAG_DATA_RATE_8   0x18
 
#define C9DOF3_MAG_DATA_RATE_15   0x20
 
#define C9DOF3_MAG_DATA_RATE_20   0x28
 
#define C9DOF3_MAG_DATA_RATE_25   0x30
 
#define C9DOF3_MAG_DATA_RATE_30   0x38
 
#define C9DOF3_MAG_XY_REPET_9   0x04
 
#define C9DOF3_MAG_Z_REPET_15   0x0F
 
#define C9DOF3_BIT_MASK_SPI_CMD_WRITE   0x7F
 
#define C9DOF3_BIT_MASK_SPI_CMD_READ   0x80
 
#define C9DOF3_SPI_COMMUNICATION_DUMMY   0x00
 
#define C9DOF3_ID_CHECK_ERROR   0x00
 
#define C9DOF3_ID_CHECK_SUCCESS   0x01
 
#define C9DOF3_ACC_COMM_ERROR   0x00
 
#define C9DOF3_ACC_COMM_SUCCESS   0x04
 
#define C9DOF3_GYRO_COMM_ERROR   0x00
 
#define C9DOF3_GYRO_COMM_SUCCESS   0x02
 
#define C9DOF3_MAG_COMM_ERROR   0x00
 
#define C9DOF3_MAG_COMM_SUCCESS   0x01
 
#define COMMUNICATION_MODE_ACCEL   0x01
 
#define COMMUNICATION_MODE_GYRO   0x02
 
#define COMMUNICATION_MODE_MAG   0x03
 
#define C9DOF3_PIN_STATE_LOW   0x00
 
#define C9DOF3_PIN_STATE_HIGH   0x01
 

Typedefs

typedef void(* c9dof3_master_io_t) (struct c9dof3_s *, uint8_t, uint8_t *, uint8_t)
 9DOF 3 Click driver interface.
 
typedef struct c9dof3_s c9dof3_t
 Click ctx object definition.
 

Enumerations

enum  c9dof3_drv_t { C9DOF3_DRV_SEL_SPI , C9DOF3_DRV_SEL_I2C }
 9DOF 3 Click driver selector. More...
 
enum  c9dof3_return_value_t { C9DOF3_OK = 0 , C9DOF3_ERROR = -1 }
 9DOF 3 Click return value data. More...
 

Functions

void c9dof3_cfg_setup (c9dof3_cfg_t *cfg)
 Config Object Initialization function.
 
void c9dof3_drv_interface_selection (c9dof3_cfg_t *cfg, c9dof3_drv_t drv_sel)
 9DOF 3 driver interface setup function.
 
C9DOF3_RETVAL c9dof3_init (c9dof3_t *ctx, c9dof3_cfg_t *cfg)
 Initialization function.
 
void c9dof3_default_cfg (c9dof3_t *ctx)
 Click Default Configuration function.
 
void c9dof3_generic_write (c9dof3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void c9dof3_generic_read (c9dof3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
uint8_t c9dof3_check_communication (c9dof3_t *ctx)
 Check communication function.
 
void c9dof3_read_accel_data (c9dof3_t *ctx, c9dof3_accel_t *accel_data)
 Read Accel data function.
 
void c9dof3_read_gyro_data (c9dof3_t *ctx, c9dof3_gyro_t *gyro_data)
 Read Gyro data function.
 
void c9dof3_read_mag_data (c9dof3_t *ctx, c9dof3_mag_t *mag_data)
 Read Mag data function.
 
void c9dof3_get_data (c9dof3_t *ctx, c9dof3_accel_t *accel_data, c9dof3_gyro_t *gyro_data, c9dof3_mag_t *mag_data)
 Read Accel, Gyro and Mag data function.
 
uint8_t c9dof3_check_interrupt (c9dof3_t *ctx)
 Check interrupt status function.
 

Detailed Description

This file contains API for 9DOF 3 Click driver.