lsm6dsl 2.0.0.0
Public function

Functions

void lsm6dsl_cfg_setup (lsm6dsl_cfg_t *cfg)
 Config Object Initialization function.
 
LSM6DSL_RETVAL lsm6dsl_init (lsm6dsl_t *ctx, lsm6dsl_cfg_t *cfg)
 Initialization function.
 
void lsm6dsl_default_cfg (lsm6dsl_t *ctx)
 Click Default Configuration function.
 
void lsm6dsl_generic_transfer (lsm6dsl_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
 Generic transfer function.
 
uint8_t lsm6dsl_read_byte (lsm6dsl_t *ctx, uint8_t reg_address)
 Read byte of data function.
 
void lsm6dsl_write_byte (lsm6dsl_t *ctx, uint8_t reg_address, uint8_t write_data)
 Write byte of data function.
 
uint8_t lsm6dsl_check_id (lsm6dsl_t *ctx)
 Function check LSM6DSL ID.
 
void lsm6dsl_set_accel_config (lsm6dsl_t *ctx, uint8_t odr_sel, uint8_t full_scale)
 Set accel configuration function.
 
void lsm6dsl_set_gyro_config (lsm6dsl_t *ctx, uint8_t odr_sel, uint8_t full_scale)
 Set gyro configuration function.
 
void lsm6dsl_soft_reset (lsm6dsl_t *ctx)
 Set soft reset function.
 
void lsm6dsl_sleep_gyro (lsm6dsl_t *ctx)
 Set gyroscope sleep mode function.
 
void lsm6dsl_wake_up_gyro (lsm6dsl_t *ctx)
 Set gyroscope wake up mode function.
 
void lsm6dsl_circular_burst_mode (lsm6dsl_t *ctx, uint8_t burst_mode)
 Set circular burst mode function.
 
void lsm6dsl_set_self_test_mode (lsm6dsl_t *ctx, uint8_t gyro_self_test, uint8_t accel_self_test)
 Set self-test mode function.
 
uint8_t lsm6dsl_get_status_reg (lsm6dsl_t *ctx)
 Get status function.
 
uint16_t lsm6dsl_get_axis (lsm6dsl_t *ctx, uint8_t reg_address_low)
 Get axis value function.
 
float lsm6dsl_get_temperature (lsm6dsl_t *ctx)
 
void lsm6dsl_get_accel (lsm6dsl_t *ctx, lsm6dsl_accel_t *accel, uint8_t full_scale)
 Get acceleration function.
 
void lsm6dsl_get_gyro (lsm6dsl_t *ctx, lsm6dsl_gyro_t *gyro, uint8_t full_scale)
 Get gyroscope function.
 

Detailed Description

Function Documentation

◆ lsm6dsl_cfg_setup()

void lsm6dsl_cfg_setup ( lsm6dsl_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ lsm6dsl_check_id()

uint8_t lsm6dsl_check_id ( lsm6dsl_t * ctx)

Function check LSM6DSL ID.

Parameters
ctxClick object.

@description This function check ID by read WHO_AM_I register of LSM6DSL sensor.

◆ lsm6dsl_circular_burst_mode()

void lsm6dsl_circular_burst_mode ( lsm6dsl_t * ctx,
uint8_t burst_mode )

Set circular burst mode function.

Parameters
ctxClick object.
burst_modeBurst mode.

@description This function set circular burst mode of LSM6DSL sensor.

◆ lsm6dsl_default_cfg()

void lsm6dsl_default_cfg ( lsm6dsl_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for LSM6DSL click.

◆ lsm6dsl_generic_transfer()

void lsm6dsl_generic_transfer ( lsm6dsl_t * ctx,
uint8_t * wr_buf,
uint16_t wr_len,
uint8_t * rd_buf,
uint16_t rd_len )

Generic transfer function.

Parameters
ctxClick object.
wr_bufWrite data buffer
wr_lenNumber of byte in write data buffer
rd_bufRead data buffer
rd_lenNumber of byte in read data buffer

@description Generic SPI transfer, for sending and receiving packages

◆ lsm6dsl_get_accel()

void lsm6dsl_get_accel ( lsm6dsl_t * ctx,
lsm6dsl_accel_t * accel,
uint8_t full_scale )

Get acceleration function.

Parameters
ctxClick object.
accelPointer to accel structure ( accel_x, accel_y, accel_z ) .
full_scaleFull scale value.

@description This function get accel x-axis, y-axis and z-axis from the six:

  • LSM6DSL_OUTX_L_XL,
  • LSM6DSL_OUTX_H_XL,
  • LSM6DSL_OUTY_L_XL,
  • LSM6DSL_OUTY_H_XL,
  • LSM6DSL_OUTZ_L_XL,
  • LSM6DSL_OUTZ_H_XL, register address of LSM6DSL sensor.

◆ lsm6dsl_get_axis()

uint16_t lsm6dsl_get_axis ( lsm6dsl_t * ctx,
uint8_t reg_address_low )

Get axis value function.

Parameters
ctxClick object.
reg_address_lowRegister address of low data output.

@description This function get axis value from the two target 8-bit register address of LSM6DSL sensor.

◆ lsm6dsl_get_gyro()

void lsm6dsl_get_gyro ( lsm6dsl_t * ctx,
lsm6dsl_gyro_t * gyro,
uint8_t full_scale )

Get gyroscope function.

Parameters
ctxClick object.
gyroPointer to gyro structure ( gyro_x, gyro_y, gyro_z ) .
full_scaleFull scale value.

@description This function get gyroscope X-axis, Y-axis and Z-axis from the six:

  • LSM6DSL_OUTX_L_G,
  • LSM6DSL_OUTX_H_G,
  • LSM6DSL_OUTY_L_G,
  • LSM6DSL_OUTY_H_G,
  • LSM6DSL_OUTZ_L_G,
  • LSM6DSL_OUTZ_H_G, register address of LSM6DSL sensor.

◆ lsm6dsl_get_status_reg()

uint8_t lsm6dsl_get_status_reg ( lsm6dsl_t * ctx)

Get status function.

Parameters
ctxClick object.

@description This function get status from the LSM6DSL_STATUS_REG register of LSM6DSL sensor.

◆ lsm6dsl_get_temperature()

float lsm6dsl_get_temperature ( lsm6dsl_t * ctx)

@briefGet temperature function.

Parameters
ctxClick object.

@description This function read temperature data from the two:

  • LSM6DSL_OUT_TEMP_L,
  • LSM6DSL_OUT_TEMP_H, register address of LSM6DSL sensor.

◆ lsm6dsl_init()

LSM6DSL_RETVAL lsm6dsl_init ( lsm6dsl_t * ctx,
lsm6dsl_cfg_t * cfg )

Initialization function.

Parameters
lsm6dslClick object.
cfgClick configuration structure.

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

◆ lsm6dsl_read_byte()

uint8_t lsm6dsl_read_byte ( lsm6dsl_t * ctx,
uint8_t reg_address )

Read byte of data function.

Parameters
ctxClick object.
reg_addressRegister address.

@description This function read the 8-bit of data from the target 8-bit register address of LSM6DSL sensor.

◆ lsm6dsl_set_accel_config()

void lsm6dsl_set_accel_config ( lsm6dsl_t * ctx,
uint8_t odr_sel,
uint8_t full_scale )

Set accel configuration function.

Parameters
ctxClick object.
odr_selOutput data rate.
full_scaleFull-scale.

@description This function set accel configuration to the target LSM6DSL_CTRL1_XL register of LSM6DSL sensor.

◆ lsm6dsl_set_gyro_config()

void lsm6dsl_set_gyro_config ( lsm6dsl_t * ctx,
uint8_t odr_sel,
uint8_t full_scale )

Set gyro configuration function.

Parameters
ctxClick object.
odr_selOutput data rate.
full_scaleFull-scale.

@description This function set gyro configuration to the target LSM6DSL_CTRL1_XL register of LSM6DSL sensor.

◆ lsm6dsl_set_self_test_mode()

void lsm6dsl_set_self_test_mode ( lsm6dsl_t * ctx,
uint8_t gyro_self_test,
uint8_t accel_self_test )

Set self-test mode function.

Parameters
ctxClick object.
gyro_self_testGyroscope self-test mode data.
accel_self_testAcceleration self-test mode data.

@description This function set gyro and accel self-test mode by set data to the LSM6DSL_CTRL5_C register of LSM6DSL sensor.

◆ lsm6dsl_sleep_gyro()

void lsm6dsl_sleep_gyro ( lsm6dsl_t * ctx)

Set gyroscope sleep mode function.

Parameters
ctxClick object.

@description This function set gyroscope sleep mode by set high sleep bit to the target LSM6DSL_CTRL3_C register of LSM6DSL sensor.

◆ lsm6dsl_soft_reset()

void lsm6dsl_soft_reset ( lsm6dsl_t * ctx)

Set soft reset function.

Parameters
ctxClick object.

@description This function set soft reset by set soft reset bit high to the target LSM6DSL_CTRL3_C register of LSM6DSL sensor.

◆ lsm6dsl_wake_up_gyro()

void lsm6dsl_wake_up_gyro ( lsm6dsl_t * ctx)

Set gyroscope wake up mode function.

Parameters
ctxClick object.

@description This function set gyroscope wake up mode by set low sleep bit to the target LSM6DSL_CTRL3_C register of LSM6DSL sensor.

◆ lsm6dsl_write_byte()

void lsm6dsl_write_byte ( lsm6dsl_t * ctx,
uint8_t reg_address,
uint8_t write_data )

Write byte of data function.

Parameters
ctxClick object.
reg_addressRegister address.
write_dataByte of data to write.

@description This function write the 8-bit of data to the target 8-bit register address of LSM6DSL sensor.