smartdof2 2.1.0.0
Smart DOF 2 Click Driver

API for configuring and manipulating Smart DOF 2 Click driver. More...

Topics

 Smart DOF 2 Registers List
 List of registers of Smart DOF 2 Click driver.
 
 Smart DOF 2 Registers Settings
 Settings for registers of Smart DOF 2 Click driver.
 
 Smart DOF 2 MikroBUS Map
 MikroBUS pin mapping of Smart DOF 2 Click driver.
 

Functions

void smartdof2_cfg_setup (smartdof2_cfg_t *cfg)
 Smart DOF 2 configuration object setup function.
 
void smartdof2_drv_interface_selection (smartdof2_cfg_t *cfg, smartdof2_drv_t drv_sel)
 Smart DOF 2 driver interface setup function.
 
err_t smartdof2_init (smartdof2_t *ctx, smartdof2_cfg_t *cfg)
 Smart DOF 2 initialization function.
 
err_t smartdof2_default_cfg (smartdof2_t *ctx)
 Smart DOF 2 default configuration function.
 
err_t smartdof2_generic_write (smartdof2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Smart DOF 2 data writing function.
 
err_t smartdof2_generic_read (smartdof2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Smart DOF 2 data reading function.
 
err_t smartdof2_get_device_id (smartdof2_t *ctx, uint8_t *device_id)
 Smart DOF 2 get device ID function.
 
err_t smartdof2_enable_auto_increment (smartdof2_t *ctx)
 Smart DOF 2 enable auto increment function.
 
err_t smartdof2_enable_block_data_update (smartdof2_t *ctx)
 Smart DOF 2 enable block data update function.
 
err_t smartdof2_set_fifo_mode (smartdof2_t *ctx, uint8_t fifo_mode)
 Smart DOF 2 set FIFO mode function.
 
err_t smartdof2_set_acc_data_rate (smartdof2_t *ctx, uint8_t data_rate)
 Smart DOF 2 set accel data rate function.
 
err_t smartdof2_get_acc_full_scale (smartdof2_t *ctx, uint8_t *data_scale)
 Smart DOF 2 get full-scale accel range function.
 
err_t smartdof2_set_acc_full_scale (smartdof2_t *ctx, uint8_t data_scale)
 Smart DOF 2 set full-scale accel range function.
 
err_t smartdof2_set_gyro_data_rate (smartdof2_t *ctx, uint8_t data_rate)
 Smart DOF 2 set gyro data rate function.
 
err_t smartdof2_get_gyro_full_scale (smartdof2_t *ctx, uint8_t *data_scale)
 Smart DOF 2 get full-scale gyro range function.
 
err_t smartdof2_set_gyro_full_scale (smartdof2_t *ctx, uint8_t data_scale)
 Smart DOF 2 set full-scale gyro range function.
 
err_t smartdof2_get_acc_axis_data (smartdof2_t *ctx, smartdof2_axis_data_t *acc_axis)
 Smart DOF 2 get accel data function.
 
err_t smartdof2_get_gyro_axis_data (smartdof2_t *ctx, smartdof2_axis_data_t *gyro_axis)
 Smart DOF 2 get gyro data function.
 
err_t smartdof2_get_acc_sensitivity (smartdof2_t *ctx, float *sensitivity)
 Smart DOF 2 get accel sensitivity function.
 
err_t smartdof2_get_gyro_sensitivity (smartdof2_t *ctx, float *sensitivity)
 Smart DOF 2 get gyro sensitivity function.
 
err_t smartdof2_get_acc_axis (smartdof2_t *ctx, smartdof2_axis_t *acc_axis)
 Smart DOF 2 get accel sensor axes function.
 
err_t smartdof2_get_gyro_axis (smartdof2_t *ctx, smartdof2_axis_t *gyro_axis)
 Smart DOF 2 get gyro sensor axes function.
 
err_t smartdof2_get_temperature_raw (smartdof2_t *ctx, int16_t *temp_raw)
 Smart DOF 2 get temperature data function.
 
err_t smartdof2_get_temperature (smartdof2_t *ctx, float *temperature)
 Smart DOF 2 get temperature function.
 
uint8_t smartdof2_get_int_pin (smartdof2_t *ctx)
 Smart DOF 2 get interrupt function.
 

Detailed Description

API for configuring and manipulating Smart DOF 2 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ smartdof2_cfg_setup()

void smartdof2_cfg_setup ( smartdof2_cfg_t * cfg)

Smart DOF 2 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See smartdof2_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ smartdof2_default_cfg()

err_t smartdof2_default_cfg ( smartdof2_t * ctx)

Smart DOF 2 default configuration function.

This function executes a default configuration of Smart DOF 2 click board.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ smartdof2_drv_interface_selection()

void smartdof2_drv_interface_selection ( smartdof2_cfg_t * cfg,
smartdof2_drv_t drv_sel )

Smart DOF 2 driver interface setup function.

This function sets a serial driver interface which will be used further in the click driver.

Parameters
[out]cfg: Click configuration structure. See smartdof2_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See smartdof2_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be call before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ smartdof2_enable_auto_increment()

err_t smartdof2_enable_auto_increment ( smartdof2_t * ctx)

Smart DOF 2 enable auto increment function.

This function enable automatically incremented during a multiple byte access with a serial interface of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_enable_block_data_update()

err_t smartdof2_enable_block_data_update ( smartdof2_t * ctx)

Smart DOF 2 enable block data update function.

This function enable block data, output registers are not updated until LSB and MSB have been read, of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_generic_read()

err_t smartdof2_generic_read ( smartdof2_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Smart DOF 2 data reading function.

This function reads a desired number of data bytes starting from the selected register.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_generic_write()

err_t smartdof2_generic_write ( smartdof2_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Smart DOF 2 data writing function.

This function writes a desired number of data bytes starting from the selected register.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_get_acc_axis()

err_t smartdof2_get_acc_axis ( smartdof2_t * ctx,
smartdof2_axis_t * acc_axis )

Smart DOF 2 get accel sensor axes function.

This function reads the accelerometer sensor axes data of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[out]acc_axis: Linear acceleration output data object (mg).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_get_acc_axis_data()

err_t smartdof2_get_acc_axis_data ( smartdof2_t * ctx,
smartdof2_axis_data_t * acc_axis )

Smart DOF 2 get accel data function.

This function reads the accelerometer raw data of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[out]acc_axis: Accelerometer raw data object.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_get_acc_full_scale()

err_t smartdof2_get_acc_full_scale ( smartdof2_t * ctx,
uint8_t * data_scale )

Smart DOF 2 get full-scale accel range function.

This function reads selected the full-scale acceleration range of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[out]data_scale: Accelerometer full-scale selection.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_get_acc_sensitivity()

err_t smartdof2_get_acc_sensitivity ( smartdof2_t * ctx,
float * sensitivity )

Smart DOF 2 get accel sensitivity function.

This function reads the accelerometer sensitivity data of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[out]sensitivity: Accelerometer sensitivity data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_get_device_id()

err_t smartdof2_get_device_id ( smartdof2_t * ctx,
uint8_t * device_id )

Smart DOF 2 get device ID function.

This function reads a device ID value of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[out]device_id: Device ID.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_get_gyro_axis()

err_t smartdof2_get_gyro_axis ( smartdof2_t * ctx,
smartdof2_axis_t * gyro_axis )

Smart DOF 2 get gyro sensor axes function.

This function reads the gyroscope sensor axes data of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[out]gyro_axis: Angular rate output data object (dps).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_get_gyro_axis_data()

err_t smartdof2_get_gyro_axis_data ( smartdof2_t * ctx,
smartdof2_axis_data_t * gyro_axis )

Smart DOF 2 get gyro data function.

This function reads the gyroscope raw data of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[out]gyro_axis: Gyroscope raw data object.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_get_gyro_full_scale()

err_t smartdof2_get_gyro_full_scale ( smartdof2_t * ctx,
uint8_t * data_scale )

Smart DOF 2 get full-scale gyro range function.

This function reads selected the full-scale gyroscope range of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[out]data_scale: Gyroscope full-scale selection.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_get_gyro_sensitivity()

err_t smartdof2_get_gyro_sensitivity ( smartdof2_t * ctx,
float * sensitivity )

Smart DOF 2 get gyro sensitivity function.

This function reads the gyroscope sensitivity data of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[out]sensitivity: Gyroscope sensitivity data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_get_int_pin()

uint8_t smartdof2_get_int_pin ( smartdof2_t * ctx)

Smart DOF 2 get interrupt function.

This function get states of the Interrupt ( INT ) pin of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_get_temperature()

err_t smartdof2_get_temperature ( smartdof2_t * ctx,
float * temperature )

Smart DOF 2 get temperature function.

This function reads the temperature data of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[out]temperature: Temperature (degrees Celsius).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Typical specifications are not guaranteed. The output of the temperature sensor is 0 LSB (typ.) at 25 °C.

◆ smartdof2_get_temperature_raw()

err_t smartdof2_get_temperature_raw ( smartdof2_t * ctx,
int16_t * temp_raw )

Smart DOF 2 get temperature data function.

This function reads the temperature raw data of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[out]temp_raw: Temperature raw data (16-bit word in two’s complement).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_init()

err_t smartdof2_init ( smartdof2_t * ctx,
smartdof2_cfg_t * cfg )

Smart DOF 2 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See smartdof2_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_set_acc_data_rate()

err_t smartdof2_set_acc_data_rate ( smartdof2_t * ctx,
uint8_t data_rate )

Smart DOF 2 set accel data rate function.

This function selects the accelerometer data rate of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[in]data_rate: Accelerometer ODR selection
  • 0x00 (SMARTDOF2_ODR_OFF) - Power-down,
  • 0x01 (SMARTDOF2_ODR_AT_1Hz875) - 1.875 Hz (low-power mode),
  • 0x02 (SMARTDOF2_ODR_AT_7Hz5) - 7.5Hz (high-performance, normal mode),
  • 0x03 (SMARTDOF2_ODR_AT_15Hz) - 15Hz (low-power, high-performance, normal mode),
  • 0x04 (SMARTDOF2_ODR_AT_30Hz) - 30Hz (low-power, high-performance, normal mode),
  • 0x05 (SMARTDOF2_ODR_AT_60Hz) - 60Hz (low-power, high-performance, normal mode),
  • 0x06 (SMARTDOF2_ODR_AT_120Hz) - 120Hz (low-power, high-performance, normal mode),
  • 0x07 (SMARTDOF2_ODR_AT_120Hz) - 240Hz (low-power, high-performance, normal mode),
  • 0x08 (SMARTDOF2_ODR_AT_120Hz) - 480Hz (high-performance, normal mode),
  • 0x09 (SMARTDOF2_ODR_AT_120Hz) - 960Hz (high-performance, normal mode),
  • 0x0A (SMARTDOF2_ODR_AT_120Hz) - 1.92kHz (high-performance, normal mode),
  • 0x0B (SMARTDOF2_ODR_AT_120Hz) - 3.84kHz (high-performance mode),
  • 0x0C (SMARTDOF2_ODR_AT_120Hz) - 7.68kHz (high-performance mode).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_set_acc_full_scale()

err_t smartdof2_set_acc_full_scale ( smartdof2_t * ctx,
uint8_t data_scale )

Smart DOF 2 set full-scale accel range function.

This function selects the full-scale acceleration range of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[in]data_scale: Accelerometer full-scale selection
  • 0x00 (SMARTDOF2_XL_FULL_SCALE_2g) - ±2g,
  • 0x01 (SMARTDOF2_XL_FULL_SCALE_4g) - ±4g,
  • 0x02 (SMARTDOF2_XL_FULL_SCALE_8g) - ±8g,
  • 0x03 (SMARTDOF2_XL_FULL_SCALE_16g) - ±16g.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_set_fifo_mode()

err_t smartdof2_set_fifo_mode ( smartdof2_t * ctx,
uint8_t fifo_mode )

Smart DOF 2 set FIFO mode function.

This function selects the FIFO mode of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[in]fifo_mode: FIFO mode selection
  • 0x00 (SMARTDOF2_FIFO_MODE_BYPASS) - Bypass mode, FIFO disabled,
  • 0x01 (SMARTDOF2_FIFO_MODE_FIFO) - FIFO mode,
  • 0x02 (SMARTDOF2_FIFO_MODE_STREAM_WTM_TO_FULL) - ContinuousWTM,
  • 0x03 (SMARTDOF2_FIFO_MODE_STREAM_TO_FIFO) - Continuous-to-FIFO mode,
  • 0x04 (SMARTDOF2_FIFO_MODE_BYPASS_TO_STREAM) - Bypass-to-continuous mode,
  • 0x06 (SMARTDOF2_FIFO_MODE_STREAM) - Continuous mode,
  • 0x07 (SMARTDOF2_FIFO_MODE_BYPASS_TO_FIFO) - Bypass-to-FIFO mode.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_set_gyro_data_rate()

err_t smartdof2_set_gyro_data_rate ( smartdof2_t * ctx,
uint8_t data_rate )

Smart DOF 2 set gyro data rate function.

This function selects the gyroscope data rate of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[in]data_rate: Accelerometer full-scale selection
  • 0x00 (SMARTDOF2_XL_FULL_SCALE_2g) - ±2g,
  • 0x01 (SMARTDOF2_XL_FULL_SCALE_4g) - ±4g,
  • 0x02 (SMARTDOF2_XL_FULL_SCALE_8g) - ±8g,
  • 0x03 (SMARTDOF2_XL_FULL_SCALE_16g) - ±16g.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof2_set_gyro_full_scale()

err_t smartdof2_set_gyro_full_scale ( smartdof2_t * ctx,
uint8_t data_scale )

Smart DOF 2 set full-scale gyro range function.

This function selects the full-scale gyroscope range of the LSM6DSV16X, High-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, OIS/EIS paths on the Smart DOF 2 click board™.

Parameters
[in]ctx: Click context object. See smartdof2_t object definition for detailed explanation.
[in]data_scale: Accelerometer full-scale selection
  • 0x00 (SMARTDOF2_XL_FULL_SCALE_2g) - ±2g,
  • 0x01 (SMARTDOF2_XL_FULL_SCALE_4g) - ±4g,
  • 0x02 (SMARTDOF2_XL_FULL_SCALE_8g) - ±8g,
  • 0x03 (SMARTDOF2_XL_FULL_SCALE_16g) - ±16g.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.