smartdof3 2.1.0.0
smartdof3.h File Reference

This file contains API for Smart DOF 3 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  smartdof3_s
 Smart DOF 3 Click context object. More...
 
struct  smartdof3_cfg_t
 Smart DOF 3 Click configuration object. More...
 
struct  smartdof3_status_t
 Smart DOF 3 Click sensor status structure object. More...
 
struct  smartdof3_axis_data_t
 Smart DOF 3 Click axis raw data structure object. More...
 
struct  smartdof3_axis_t
 Smart DOF 3 Click sensor axes structure object. More...
 

Macros

#define SMARTDOF3_REG_FUNC_CFG_ACCESS   0x01
 Smart DOF 3 description register.
 
#define SMARTDOF3_REG_PIN_CTRL   0x02
 
#define SMARTDOF3_REG_DRDY_PULSED_REG   0x0B
 
#define SMARTDOF3_REG_INT1_CTRL   0x0D
 
#define SMARTDOF3_REG_INT2_CTRL   0x0E
 
#define SMARTDOF3_REG_WHO_AM_I   0x0F
 
#define SMARTDOF3_REG_CTRL1_XL   0x10
 
#define SMARTDOF3_REG_CTRL2_G   0x11
 
#define SMARTDOF3_REG_CTRL3_C   0x12
 
#define SMARTDOF3_REG_CTRL4_C   0x13
 
#define SMARTDOF3_REG_CTRL5_C   0x14
 
#define SMARTDOF3_REG_CTRL6_C   0x15
 
#define SMARTDOF3_REG_CTRL7_G   0x16
 
#define SMARTDOF3_REG_CTRL9_C   0x18
 
#define SMARTDOF3_REG_CTRL10_C   0x19
 
#define SMARTDOF3_REG_ISPU_INT_STATUS0_MP   0x1A
 
#define SMARTDOF3_REG_ISPU_INT_STATUS1_MP   0x1B
 
#define SMARTDOF3_REG_ISPU_INT_STATUS2_MP   0x1C
 
#define SMARTDOF3_REG_ISPU_INT_STATUS3_MP   0x1D
 
#define SMARTDOF3_REG_STATUS   0x1E
 
#define SMARTDOF3_REG_OUT_TEMP_L   0x20
 
#define SMARTDOF3_REG_OUT_TEMP_H   0x21
 
#define SMARTDOF3_REG_OUTX_L_G   0x22
 
#define SMARTDOF3_REG_OUTX_H_G   0x23
 
#define SMARTDOF3_REG_OUTY_L_G   0x24
 
#define SMARTDOF3_REG_OUTY_H_G   0x25
 
#define SMARTDOF3_REG_OUTZ_L_G   0x26
 
#define SMARTDOF3_REG_OUTZ_H_G   0x27
 
#define SMARTDOF3_REG_OUTX_L_A   0x28
 
#define SMARTDOF3_REG_OUTX_H_A   0x29
 
#define SMARTDOF3_REG_OUTY_L_A   0x2A
 
#define SMARTDOF3_REG_OUTY_H_A   0x2B
 
#define SMARTDOF3_REG_OUTZ_L_A   0x2C
 
#define SMARTDOF3_REG_OUTZ_H_A   0x2D
 
#define SMARTDOF3_REG_STATUS_MASTER_MAINPAGE   0x39
 
#define SMARTDOF3_REG_TIMESTAMP0   0x40
 
#define SMARTDOF3_REG_TIMESTAMP1   0x41
 
#define SMARTDOF3_REG_TIMESTAMP2   0x42
 
#define SMARTDOF3_REG_TIMESTAMP3   0x43
 
#define SMARTDOF3_REG_MD1_CFG   0x5E
 
#define SMARTDOF3_REG_MD2_CFG   0x5F
 
#define SMARTDOF3_REG_INTERNAL_FREQ_FINE   0x63
 
#define SMARTDOF3_REG_ISPU_DUMMY_CFG_1_L   0x73
 
#define SMARTDOF3_REG_ISPU_DUMMY_CFG_1_H   0x74
 
#define SMARTDOF3_REG_ISPU_DUMMY_CFG_2_L   0x75
 
#define SMARTDOF3_REG_ISPU_DUMMY_CFG_2_H   0x76
 
#define SMARTDOF3_REG_ISPU_DUMMY_CFG_3_L   0x77
 
#define SMARTDOF3_REG_ISPU_DUMMY_CFG_3_H   0x78
 
#define SMARTDOF3_REG_ISPU_DUMMY_CFG_4_L   0x79
 
#define SMARTDOF3_REG_ISPU_DUMMY_CFG_4_H   0x7A
 
#define SMARTDOF3_DEVICE_ID   0x22
 Smart DOF 3 device ID value.
 
#define SMARTDOF3_CTRL3_SOFT_RESET   0x01
 Smart DOF 3 control 3 register value.
 
#define SMARTDOF3_CTRL3_IF_INC_DISABLE   0x00
 
#define SMARTDOF3_CTRL3_IF_INC_ENABLE   0x04
 
#define SMARTDOF3_CTRL3_IF_INC_BIT_MASK   0xFB
 
#define SMARTDOF3_CTRL3_BDU_DISABLE   0x00
 
#define SMARTDOF3_CTRL3_BDU_ENABLE   0x40
 
#define SMARTDOF3_CTRL3_BDU_BIT_MASK   0xBF
 
#define SMARTDOF3_ODR_XL_G_OFF   0x00
 Smart DOF 3 accelerometer ODR configuration setting value.
 
#define SMARTDOF3_ODR_XL_G_12_5_HZ   0x01
 
#define SMARTDOF3_ODR_XL_G_26_HZ   0x02
 
#define SMARTDOF3_ODR_XL_G_52_HZ   0x03
 
#define SMARTDOF3_ODR_XL_G_104_HZ   0x04
 
#define SMARTDOF3_ODR_XL_G_208_HZ   0x05
 
#define SMARTDOF3_ODR_XL_G_416_HZ   0x06
 
#define SMARTDOF3_ODR_XL_G_833_HZ   0x07
 
#define SMARTDOF3_ODR_XL_G_1667_HZ   0x08
 
#define SMARTDOF3_ODR_XL_G_3333_HZ   0x09
 
#define SMARTDOF3_ODR_XL_G_6667_HZ   0x0A
 
#define SMARTDOF3_ODR_XL_G_BIT_MASK   0x0F
 
#define SMARTDOF3_XL_FULL_SCALE_2G   0x00
 Smart DOF 3 accel full-scale selection value.
 
#define SMARTDOF3_XL_FULL_SCALE_16G   0x01
 
#define SMARTDOF3_XL_FULL_SCALE_4G   0x02
 
#define SMARTDOF3_XL_FULL_SCALE_8G   0x03
 
#define SMARTDOF3_XL_FULL_SCALE_BIT_MASK   0x03
 
#define SMARTDOF3_OP_MODE_PERFORMANCE_LOW   0x00
 Smart DOF 3 operating mode value.
 
#define SMARTDOF3_OP_MODE_PERFORMANCE_HIGH   0x01
 
#define SMARTDOF3_TIMESTAMP_ENABLE   0x20
 Smart DOF 3 accel full-scale selection value.
 
#define SMARTDOF3_ACC_SENSITIVITY_FS_2G   0.061
 Smart DOF 3 accel sensitivity data value.
 
#define SMARTDOF3_ACC_SENSITIVITY_FS_4G   0.122
 
#define SMARTDOF3_ACC_SENSITIVITY_FS_8G   0.244
 
#define SMARTDOF3_ACC_SENSITIVITY_FS_16G   0.488
 
#define SMARTDOF3_GY_FULL_SCALE_125DPS   0x01
 Smart DOF 3 gyro chain full-scale selection value.
 
#define SMARTDOF3_GY_FULL_SCALE_250DPS   0x00
 
#define SMARTDOF3_GY_FULL_SCALE_500DPS   0x02
 
#define SMARTDOF3_GY_FULL_SCALE_1000DPS   0x04
 
#define SMARTDOF3_GY_FULL_SCALE_2000DPS   0x06
 
#define SMARTDOF3_GY_FULL_SCALE_BIT_MASK   0x07
 
#define SMARTDOF3_GYRO_SENSITIVITY_FS_125DPS   0.004375
 Smart DOF 3 gyro sensitivity data value.
 
#define SMARTDOF3_GYRO_SENSITIVITY_FS_250DPS   0.00875
 
#define SMARTDOF3_GYRO_SENSITIVITY_FS_500DPS   0.0175
 
#define SMARTDOF3_GYRO_SENSITIVITY_FS_1000DPS   0.035
 
#define SMARTDOF3_GYRO_SENSITIVITY_FS_2000DPS   0.07
 
#define SMARTDOF3_DEVICE_ADDRESS_GND   0x6A
 Smart DOF 3 device address setting.
 
#define SMARTDOF3_DEVICE_ADDRESS_VCC   0x6B
 
#define SMARTDOF3_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define SMARTDOF3_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define SMARTDOF3_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* smartdof3_master_io_t) (struct smartdof3_s *, uint8_t, uint8_t *, uint8_t)
 Smart DOF 3 Click driver interface.
 
typedef struct smartdof3_s smartdof3_t
 Smart DOF 3 Click context object.
 

Enumerations

enum  smartdof3_drv_t { SMARTDOF3_DRV_SEL_SPI , SMARTDOF3_DRV_SEL_I2C }
 Smart DOF 3 Click driver selector. More...
 
enum  smartdof3_return_value_t { SMARTDOF3_OK = 0 , SMARTDOF3_ERROR = -1 }
 Smart DOF 3 Click return value data. More...
 

Functions

void smartdof3_cfg_setup (smartdof3_cfg_t *cfg)
 Smart DOF 3 configuration object setup function.
 
void smartdof3_drv_interface_selection (smartdof3_cfg_t *cfg, smartdof3_drv_t drv_sel)
 Smart DOF 3 driver interface setup function.
 
err_t smartdof3_init (smartdof3_t *ctx, smartdof3_cfg_t *cfg)
 Smart DOF 3 initialization function.
 
err_t smartdof3_default_cfg (smartdof3_t *ctx)
 Smart DOF 3 default configuration function.
 
err_t smartdof3_generic_write (smartdof3_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Smart DOF 3 data writing function.
 
err_t smartdof3_generic_read (smartdof3_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Smart DOF 3 data reading function.
 
err_t smartdof3_get_device_id (smartdof3_t *ctx, uint8_t *device_id)
 Smart DOF 3 get device ID function.
 
err_t smartdof3_soft_reset (smartdof3_t *ctx)
 Smart DOF 3 software reset function.
 
err_t smartdof3_en_auto_incr (smartdof3_t *ctx)
 Smart DOF 3 enable auto-increment function.
 
err_t smartdof3_en_block_data_upd (smartdof3_t *ctx)
 Smart DOF 3 enable block data update function.
 
err_t smartdof3_set_op_mode (smartdof3_t *ctx, uint8_t acc_op_mode, uint8_t gyro_op_mode)
 Smart DOF 3 sets the operation mode function.
 
err_t smartdof3_set_acc_data_rate (smartdof3_t *ctx, uint8_t data_rate)
 Smart DOF 3 sets the accel data rate function.
 
err_t smartdof3_set_acc_full_scale (smartdof3_t *ctx, uint8_t data_scale)
 Smart DOF 3 sets the accel full-scale range function.
 
err_t smartdof3_get_acc_full_scale (smartdof3_t *ctx, uint8_t *data_scale)
 Smart DOF 3 get the accel full-scale range function.
 
err_t smartdof3_get_acc_sensitivity (smartdof3_t *ctx, float *sensitivity)
 Smart DOF 3 get the accel sensitivity function.
 
err_t smartdof3_set_gyro_data_rate (smartdof3_t *ctx, uint8_t data_rate)
 Smart DOF 3 sets the gyro data rate function.
 
err_t smartdof3_set_gyro_full_scale (smartdof3_t *ctx, uint8_t data_scale)
 Smart DOF 3 sets the gyro full-scale range function.
 
err_t smartdof3_get_gyro_full_scale (smartdof3_t *ctx, uint8_t *data_scale)
 Smart DOF 3 get the gyro full-scale range function.
 
err_t smartdof3_get_status (smartdof3_t *ctx, smartdof3_status_t *status)
 Smart DOF 3 get the status function.
 
err_t smartdof3_get_gyro_sensitivity (smartdof3_t *ctx, float *sensitivity)
 Smart DOF 3 get the gyro sensitivity function.
 
err_t smartdof3_get_acc_axis_data (smartdof3_t *ctx, smartdof3_axis_data_t *acc_axis)
 Smart DOF 3 get the accel data function.
 
err_t smartdof3_get_gyro_axis_data (smartdof3_t *ctx, smartdof3_axis_data_t *gyro_axis)
 Smart DOF 3 get the gyro data function.
 
err_t smartdof3_get_acc_axis (smartdof3_t *ctx, smartdof3_axis_t *acc_axis)
 Smart DOF 3 get the accel sensor axes function.
 
err_t smartdof3_get_gyro_axis (smartdof3_t *ctx, smartdof3_axis_t *gyro_axis)
 Smart DOF 3 get the gyro sensor axes function.
 
err_t smartdof3_enable_temperature (smartdof3_t *ctx)
 Smart DOF 3 enable the temperature function.
 
err_t smartdof3_get_temperature_raw (smartdof3_t *ctx, int16_t *temp_raw)
 Smart DOF 3 get the temperature data function.
 
err_t smartdof3_get_temperature (smartdof3_t *ctx, float *temperature)
 Smart DOF 3 get the temperature function.
 
uint8_t smartdof3_get_in1_pin (smartdof3_t *ctx)
 Smart DOF 3 get interrupt 1 function.
 
uint8_t smartdof3_get_in2_pin (smartdof3_t *ctx)
 Smart DOF 3 get interrupt 2 function.
 

Detailed Description

This file contains API for Smart DOF 3 Click Driver.

Typedef Documentation

◆ smartdof3_master_io_t

typedef err_t(* smartdof3_master_io_t) (struct smartdof3_s *, uint8_t, uint8_t *, uint8_t)

Smart DOF 3 Click driver interface.

Definition of driver interface of Smart DOF 3 Click driver. Driver serial interface.

◆ smartdof3_t

typedef struct smartdof3_s smartdof3_t

Smart DOF 3 Click context object.

Context object definition of Smart DOF 3 Click driver.

Enumeration Type Documentation

◆ smartdof3_drv_t

Smart DOF 3 Click driver selector.

Selects target driver interface of Smart DOF 3 Click driver.

Enumerator
SMARTDOF3_DRV_SEL_SPI 

SPI driver descriptor.

SMARTDOF3_DRV_SEL_I2C 

I2C driver descriptor.

◆ smartdof3_return_value_t

Smart DOF 3 Click return value data.

Predefined enum values for driver return values.

Enumerator
SMARTDOF3_OK 
SMARTDOF3_ERROR