ChibiOS  0.0.0
Collaboration diagram for LSM6DSL:

Detailed Description

Macros

#define lsm6dslI2CWriteRegister(i2cp, sad, txbuf, n)
 Writes a value into a register using I2C. More...
 
#define lsm6dslAccelerometerGetAxesNumber(devp)   accelerometerGetAxesNumber(&((devp)->acc_if))
 Return the number of axes of the BaseAccelerometer. More...
 
#define lsm6dslAccelerometerReadRaw(devp, axes)   accelerometerReadRaw(&((devp)->acc_if), axes)
 Retrieves raw data from the BaseAccelerometer. More...
 
#define lsm6dslAccelerometerReadCooked(devp, axes)   accelerometerReadCooked(&((devp)->acc_if), axes)
 Retrieves cooked data from the BaseAccelerometer. More...
 
#define lsm6dslAccelerometerSetBias(devp, bp)   accelerometerSetBias(&((devp)->acc_if), bp)
 Set bias values for the BaseAccelerometer. More...
 
#define lsm6dslAccelerometerResetBias(devp)   accelerometerResetBias(&((devp)->acc_if))
 Reset bias values for the BaseAccelerometer. More...
 
#define lsm6dslAccelerometerSetSensitivity(devp, sp)   accelerometerSetSensitivity(&((devp)->acc_if), sp)
 Set sensitivity values for the BaseAccelerometer. More...
 
#define lsm6dslAccelerometerResetSensitivity(devp)   accelerometerResetSensitivity(&((devp)->acc_if))
 Reset sensitivity values for the BaseAccelerometer. More...
 
#define lsm6dslAccelerometerSetFullScale(devp, fs)   (devp)->vmt->acc_set_full_scale(devp, fs)
 Changes the LSM6DSLDriver accelerometer fullscale value. More...
 
#define lsm6dslGyroscopeGetAxesNumber(devp)   gyroscopeGetAxesNumber(&((devp)->gyro_if))
 Return the number of axes of the BaseGyroscope. More...
 
#define lsm6dslGyroscopeReadRaw(devp, axes)   gyroscopeReadRaw(&((devp)->gyro_if), axes)
 Retrieves raw data from the BaseGyroscope. More...
 
#define lsm6dslGyroscopeReadCooked(devp, axes)   gyroscopeReadCooked(&((devp)->gyro_if), axes)
 Retrieves cooked data from the BaseGyroscope. More...
 
#define lsm6dslGyroscopeSampleBias(devp)   gyroscopeSampleBias(&((devp)->gyro_if))
 Samples bias values for the BaseGyroscope. More...
 
#define lsm6dslGyroscopeSetBias(devp, bp)   gyroscopeSetBias(&((devp)->gyro_if), bp)
 Set bias values for the BaseGyroscope. More...
 
#define lsm6dslGyroscopeResetBias(devp)   gyroscopeResetBias(&((devp)->gyro_if))
 Reset bias values for the BaseGyroscope. More...
 
#define lsm6dslGyroscopeSetSensitivity(devp, sp)   gyroscopeSetSensitivity(&((devp)->gyro_if), sp)
 Set sensitivity values for the BaseGyroscope. More...
 
#define lsm6dslGyroscopeResetSensitivity(devp)   gyroscopeResetSensitivity(&((devp)->gyro_if))
 Reset sensitivity values for the BaseGyroscope. More...
 
#define lsm6dslGyroscopeSetFullScale(devp, fs)   (devp)->vmt->acc_set_full_scale(devp, fs)
 Changes the LSM6DSLDriver gyroscope fullscale value. More...
 

Version identification

#define EX_LSM6DSL_VERSION   "1.0.0"
 LSM6DSL driver version string. More...
 
#define EX_LSM6DSL_MAJOR   1
 LSM6DSL driver version major number. More...
 
#define EX_LSM6DSL_MINOR   0
 LSM6DSL driver version minor number. More...
 
#define EX_LSM6DSL_PATCH   0
 LSM6DSL driver version patch number. More...
 
#define LSM6DSL_ACC_NUMBER_OF_AXES   3U
 LSM6DSL accelerometer subsystem characteristics. More...
 
#define LSM6DSL_GYRO_NUMBER_OF_AXES   3U
 L3GD20 gyroscope system characteristics. More...
 

LSM6DSL communication interfaces related bit masks

#define LSM6DSL_DI_MASK   0xFF
 
#define LSM6DSL_DI(n)   (1 << n)
 
#define LSM6DSL_AD_MASK   0x7F
 
#define LSM6DSL_AD(n)   (1 << n)
 
#define LSM6DSL_MS   (1 << 7)
 

LSM6DSL register addresses

#define LSM6DSL_AD_FUNC_CFG_ACCESS   0x01
 
#define LSM6DSL_AD_SENSOR_SYNC_TIME_FRAME   0x04
 
#define LSM6DSL_AD_SENSOR_SYNC_RES_RATIO   0x05
 
#define LSM6DSL_AD_FIFO_CTRL1   0x06
 
#define LSM6DSL_AD_FIFO_CTRL2   0x07
 
#define LSM6DSL_AD_FIFO_CTRL3   0x08
 
#define LSM6DSL_AD_FIFO_CTRL4   0x09
 
#define LSM6DSL_AD_FIFO_CTRL5   0x0A
 
#define LSM6DSL_AD_DRDY_PULSE_CFG_G   0x0B
 
#define LSM6DSL_AD_INT1_CTRL   0x0D
 
#define LSM6DSL_AD_INT2_CTRL   0x0E
 
#define LSM6DSL_AD_WHO_AM_I   0x0F
 
#define LSM6DSL_AD_CTRL1_XL   0x10
 
#define LSM6DSL_AD_CTRL2_G   0x11
 
#define LSM6DSL_AD_CTRL3_C   0x12
 
#define LSM6DSL_AD_CTRL4_C   0x13
 
#define LSM6DSL_AD_CTRL5_C   0x14
 
#define LSM6DSL_AD_CTRL6_C   0x15
 
#define LSM6DSL_AD_CTRL7_G   0x16
 
#define LSM6DSL_AD_CTRL8_XL   0x17
 
#define LSM6DSL_AD_CTRL9_XL   0x18
 
#define LSM6DSL_AD_CTRL10_C   0x19
 
#define LSM6DSL_AD_MASTER_CONFIG   0x1A
 
#define LSM6DSL_AD_WAKE_UP_SRC   0x1B
 
#define LSM6DSL_AD_TAP_SRC   0x1C
 
#define LSM6DSL_AD_D6D_SRC   0x1D
 
#define LSM6DSL_AD_STATUS_REG   0x1E
 
#define LSM6DSL_AD_OUT_TEMP_L   0x20
 
#define LSM6DSL_AD_OUT_TEMP_H   0x21
 
#define LSM6DSL_AD_OUTX_L_G   0x22
 
#define LSM6DSL_AD_OUTX_H_G   0x23
 
#define LSM6DSL_AD_OUTY_L_G   0x24
 
#define LSM6DSL_AD_OUTY_H_G   0x25
 
#define LSM6DSL_AD_OUTZ_L_G   0x26
 
#define LSM6DSL_AD_OUTZ_H_G   0x27
 
#define LSM6DSL_AD_OUTX_L_XL   0x28
 
#define LSM6DSL_AD_OUTX_H_XL   0x29
 
#define LSM6DSL_AD_OUTY_L_XL   0x2A
 
#define LSM6DSL_AD_OUTY_H_XL   0x2B
 
#define LSM6DSL_AD_OUTZ_L_XL   0x2C
 
#define LSM6DSL_AD_OUTZ_H_XL   0x2D
 
#define LSM6DSL_AD_SENSORHUB1_REG   0x2E
 
#define LSM6DSL_AD_SENSORHUB2_REG   0x2F
 
#define LSM6DSL_AD_SENSORHUB3_REG   0x30
 
#define LSM6DSL_AD_SENSORHUB4_REG   0x31
 
#define LSM6DSL_AD_SENSORHUB5_REG   0x32
 
#define LSM6DSL_AD_SENSORHUB6_REG   0x33
 
#define LSM6DSL_AD_SENSORHUB7_REG   0x34
 
#define LSM6DSL_AD_SENSORHUB8_REG   0x35
 
#define LSM6DSL_AD_SENSORHUB9_REG   0x36
 
#define LSM6DSL_AD_SENSORHUB10_REG   0x37
 
#define LSM6DSL_AD_SENSORHUB11_REG   0x38
 
#define LSM6DSL_AD_SENSORHUB12_REG   0x39
 
#define LSM6DSL_AD_FIFO_STATUS1   0x3A
 
#define LSM6DSL_AD_FIFO_STATUS2   0x3B
 
#define LSM6DSL_AD_FIFO_STATUS3   0x3C
 
#define LSM6DSL_AD_FIFO_STATUS4   0x3D
 
#define LSM6DSL_AD_FIFO_DATA_OUT_L   0x3E
 
#define LSM6DSL_AD_FIFO_DATA_OUT_H   0x3F
 
#define LSM6DSL_AD_TIMESTAMP0_REG   0x40
 
#define LSM6DSL_AD_TIMESTAMP1_REG   0x41
 
#define LSM6DSL_AD_TIMESTAMP2_REG   0x42
 
#define LSM6DSL_AD_STEP_TIMESTAMP_L   0x49
 
#define LSM6DSL_AD_STEP_TIMESTAMP_H   0x4A
 
#define LSM6DSL_AD_STEP_COUNTER_L   0x4B
 
#define LSM6DSL_AD_STEP_COUNTER_H   0x4C
 
#define LSM6DSL_AD_SENSORHUB13_REG   0x4D
 
#define LSM6DSL_AD_SENSORHUB14_REG   0x4E
 
#define LSM6DSL_AD_SENSORHUB15_REG   0x4F
 
#define LSM6DSL_AD_SENSORHUB16_REG   0x50
 
#define LSM6DSL_AD_SENSORHUB17_REG   0x51
 
#define LSM6DSL_AD_SENSORHUB18_REG   0x52
 
#define LSM6DSL_AD_FUNC_SRC1   0x53
 
#define LSM6DSL_AD_FUNC_SRC2   0x54
 
#define LSM6DSL_AD_WRIST_TILT_IA   0x55
 
#define LSM6DSL_AD_TAP_CFG   0x58
 
#define LSM6DSL_AD_TAP_THS_6D   0x59
 
#define LSM6DSL_AD_INT_DUR2   0x5A
 
#define LSM6DSL_AD_WAKE_UP_THS   0x5B
 
#define LSM6DSL_AD_WAKE_UP_DUR   0x5C
 
#define LSM6DSL_AD_FREE_FALL   0x5D
 
#define LSM6DSL_AD_MD1_CFG   0x5E
 
#define LSM6DSL_AD_MD2_CFG   0x5F
 
#define LSM6DSL_AD_MASTER_CMD_CODE   0x60
 
#define LSM6DSL_AD_SENS_SYNC_SPI_ERROR_CODE   0x61
 
#define LSM6DSL_AD_OUT_MAG_RAW_X_L   0x66
 
#define LSM6DSL_AD_OUT_MAG_RAW_X_H   0x67
 
#define LSM6DSL_AD_OUT_MAG_RAW_Y_L   0x68
 
#define LSM6DSL_AD_OUT_MAG_RAW_Y_H   0x69
 
#define LSM6DSL_AD_OUT_MAG_RAW_Z_L   0x6A
 
#define LSM6DSL_AD_OUT_MAG_RAW_Z_H   0x6B
 
#define LSM6DSL_AD_X_OFS_USR   0x73
 
#define LSM6DSL_AD_Y_OFS_USR   0x74
 
#define LSM6DSL_AD_Z_OFS_USR   0x75
 

LSM6DSL_AD_CTRL1_XL register bits definitions

#define LSMDSL_CTRL1_XL_BW0_XL   (1 << 0)
 
#define LSMDSL_CTRL1_XL_LPF1_BW_SEL   (1 << 1)
 
#define LSMDSL_CTRL1_XL_FS_MASK   0x0C
 
#define LSMDSL_CTRL1_XL_FS_XL0   (1 << 2)
 
#define LSMDSL_CTRL1_XL_FS_XL1   (1 << 3)
 
#define LSMDSL_CTRL1_XL_ODR_XL0   (1 << 4)
 
#define LSMDSL_CTRL1_XL_ODR_XL1   (1 << 5)
 
#define LSMDSL_CTRL1_XL_ODR_XL2   (1 << 6)
 
#define LSMDSL_CTRL1_XL_ODR_XL3   (1 << 7)
 

LSM6DSL_AD_CTRL2_G register bits definitions

#define LSMDSL_CTRL2_G_FS_MASK   0x0E
 
#define LSMDSL_CTRL2_G_FS_125   (1 << 1)
 
#define LSMDSL_CTRL2_G_FS_G0   (1 << 2)
 
#define LSMDSL_CTRL2_G_FS_G1   (1 << 3)
 
#define LSMDSL_CTRL2_G_ODR_G0   (1 << 4)
 
#define LSMDSL_CTRL2_G_ODR_G1   (1 << 5)
 
#define LSMDSL_CTRL2_G_ODR_G2   (1 << 6)
 
#define LSMDSL_CTRL2_G_ODR_G3   (1 << 7)
 

LSM6DSL_AD_CTRL3_C register bits definitions

#define LSMDSL_CTRL3_C_SW_RESET   (1 << 0)
 
#define LSMDSL_CTRL3_C_BLE   (1 << 1)
 
#define LSMDSL_CTRL3_C_IF_INC   (1 << 2)
 
#define LSMDSL_CTRL3_C_SIM   (1 << 3)
 
#define LSMDSL_CTRL3_C_PP_OD   (1 << 4)
 
#define LSMDSL_CTRL3_C_H_LACTIVE   (1 << 5)
 
#define LSMDSL_CTRL3_C_BDU   (1 << 6)
 
#define LSMDSL_CTRL3_C_BOOT   (1 << 7)
 

LSM6DSL_AD_CTRL4_C register bits definitions

#define LSMDSL_CTRL4_C_NOT_USED_01   (1 << 0)
 
#define LSMDSL_CTRL4_C_LPF1_SEL_G   (1 << 1)
 
#define LSMDSL_CTRL4_C_I2C_DISABLE   (1 << 2)
 
#define LSMDSL_CTRL4_C_DRDY_MASK   (1 << 3)
 
#define LSMDSL_CTRL4_C_DEN_DRDY_IN   (1 << 4)
 
#define LSMDSL_CTRL4_C_INT2_ON_INT   (1 << 5)
 
#define LSMDSL_CTRL4_C_SLEEP   (1 << 6)
 
#define LSMDSL_CTRL4_C_DEN_XL_EN   (1 << 7)
 

LSM6DSL_AD_CTRL5_C register bits definitions

#define LSMDSL_CTRL5_C_ST0_XL   (1 << 0)
 
#define LSMDSL_CTRL5_C_ST1_XL   (1 << 1)
 
#define LSMDSL_CTRL5_C_ST0_G   (1 << 2)
 
#define LSMDSL_CTRL5_C_ST1_G   (1 << 3)
 
#define LSMDSL_CTRL5_C_DEN_LH   (1 << 4)
 
#define LSMDSL_CTRL5_C_ROUNDING0   (1 << 5)
 
#define LSMDSL_CTRL5_C_ROUNDING1   (1 << 6)
 
#define LSMDSL_CTRL5_C_ROUNDING2   (1 << 7)
 

LSM6DSL_AD_CTRL6_C register bits definitions

#define LSMDSL_CTRL6_C_FTYPE_0   (1 << 0)
 
#define LSMDSL_CTRL6_C_FTYPE_1   (1 << 1)
 
#define LSMDSL_CTRL6_C_USR_OFF_W   (1 << 3)
 
#define LSMDSL_CTRL6_C_XL_HM_MODE   (1 << 4)
 
#define LSMDSL_CTRL6_C_LVL2_EN   (1 << 5)
 
#define LSMDSL_CTRL6_C_LVL_EN   (1 << 6)
 
#define LSMDSL_CTRL6_C_TRIG_EN   (1 << 7)
 

LSM6DSL_AD_CTRL7_G register bits definitions

#define LSMDSL_CTRL7_G_ROUNDING_ST   (1 << 2)
 
#define LSMDSL_CTRL7_G_HPM0_G   (1 << 4)
 
#define LSMDSL_CTRL7_G_HPM1_G   (1 << 5)
 
#define LSMDSL_CTRL7_G_HP_EN_G   (1 << 6)
 
#define LSMDSL_CTRL7_G_G_HM_MODE   (1 << 7)
 

LSM6DSL_AD_CTRL8_XL register bits definitions

#define LSMDSL_CTRL8_XL_LOW_PASS_ON   (1 << 0)
 
#define LSMDSL_CTRL8_XL_HP_SLOPE_XL   (1 << 2)
 
#define LSMDSL_CTRL8_XL_INPUT_COMPO   (1 << 3)
 
#define LSMDSL_CTRL8_XL_HP_REF_MODE   (1 << 4)
 
#define LSMDSL_CTRL8_XL_HPCF_XL0   (1 << 5)
 
#define LSMDSL_CTRL8_XL_HPCF_XL1   (1 << 6)
 
#define LSMDSL_CTRL8_XL_LPF2_XL_EN   (1 << 7)
 

LSM6DSL_AD_CTRL9_XL register bits definitions

#define LSMDSL_CTRL9_XL_SOFT_EN   (1 << 2)
 
#define LSMDSL_CTRL9_XL_DEN_XL_G   (1 << 4)
 
#define LSMDSL_CTRL9_XL_DEN_Z   (1 << 5)
 
#define LSMDSL_CTRL9_XL_DEN_Y   (1 << 6)
 
#define LSMDSL_CTRL9_XL_DEN_X   (1 << 7)
 

LSM6DSL_AD_CTRL10_C register bits definitions

#define LSMDSL_CTRL10_C_SIGN_MOTION   (1 << 0)
 
#define LSMDSL_CTRL10_C_PEDO_RST_ST   (1 << 1)
 
#define LSMDSL_CTRL10_C_FUNC_EN   (1 << 2)
 
#define LSMDSL_CTRL10_C_TILT_EN   (1 << 3)
 
#define LSMDSL_CTRL10_C_PEDO_EN   (1 << 4)
 
#define LSMDSL_CTRL10_C_TIMER_EN   (1 << 5)
 
#define LSMDSL_CTRL10_C_WRIST_TILT   (1 << 7)
 

Configuration options

#define LSM6DSL_USE_SPI   FALSE
 LSM6DSL SPI interface switch. More...
 
#define LSM6DSL_SHARED_SPI   FALSE
 LSM6DSL shared SPI switch. More...
 
#define LSM6DSL_USE_I2C   TRUE
 LSM6DSL I2C interface switch. More...
 
#define LSM6DSL_SHARED_I2C   FALSE
 LSM6DSL shared I2C switch. More...
 
#define LSM6DSL_USE_ADVANCED   FALSE
 LSM6DSL advanced configurations switch. More...
 
#define LSM6DSL_ACC_USE_ADVANCED   FALSE
 LSM6DSL accelerometer subsystem advanced configurations switch. More...
 
#define LSM6DSL_GYRO_USE_ADVANCED   FALSE
 LSM6DSL gyroscope subsystem advanced configurations switch. More...
 
#define LSM6DSL_GYRO_BIAS_ACQ_TIMES   50
 Number of acquisitions for gyroscope bias removal. More...
 
#define LSM6DSL_GYRO_BIAS_SETTLING_US   5000
 Settling time for gyroscope bias removal. More...
 

LSM6DSL data structures and types.

Todo:
Add support for LSM6DSL over SPI.
typedef struct LSM6DSLDriver LSM6DSLDriver
 Structure representing a LSM6DSL driver. More...
 
#define _lsm6dsl_methods_alone
 LSM6DSL specific methods. More...
 
#define _lsm6dsl_methods
 LSM6DSL specific methods with inherited ones. More...
 
#define _lsm6dsl_data
 LSM6DSLDriver specific data. More...
 

Data Structures

struct  LSM6DSLConfig
 LSM6DSL configuration structure. More...
 
struct  LSM6DSLVMT
 LSM6DSL virtual methods table. More...
 
struct  LSM6DSLDriver
 LSM6DSL 6-axis accelerometer/gyroscope class. More...
 

Functions

msg_t lsm6dslI2CReadRegister (I2CDriver *i2cp, lsm6dsl_sad_t sad, uint8_t reg, uint8_t *rxbuf, size_t n)
 Reads registers value using I2C. More...
 
static size_t acc_get_axes_number (void *ip)
 Return the number of axes of the BaseAccelerometer. More...
 
static msg_t acc_read_raw (void *ip, int32_t axes[])
 Retrieves raw data from the BaseAccelerometer. More...
 
static msg_t acc_read_cooked (void *ip, float axes[])
 Retrieves cooked data from the BaseAccelerometer. More...
 
static msg_t acc_set_bias (void *ip, float *bp)
 Set bias values for the BaseAccelerometer. More...
 
static msg_t acc_reset_bias (void *ip)
 Reset bias values for the BaseAccelerometer. More...
 
static msg_t acc_set_sensivity (void *ip, float *sp)
 Set sensitivity values for the BaseAccelerometer. More...
 
static msg_t acc_reset_sensivity (void *ip)
 Reset sensitivity values for the BaseAccelerometer. More...
 
static msg_t acc_set_full_scale (LSM6DSLDriver *devp, lsm6dsl_acc_fs_t fs)
 Changes the LSM6DSLDriver accelerometer fullscale value. More...
 
static size_t gyro_get_axes_number (void *ip)
 Return the number of axes of the BaseGyroscope. More...
 
static msg_t gyro_read_raw (void *ip, int32_t axes[LSM6DSL_GYRO_NUMBER_OF_AXES])
 Retrieves raw data from the BaseGyroscope. More...
 
static msg_t gyro_read_cooked (void *ip, float axes[])
 Retrieves cooked data from the BaseGyroscope. More...
 
static msg_t gyro_sample_bias (void *ip)
 Samples bias values for the BaseGyroscope. More...
 
static msg_t gyro_set_bias (void *ip, float *bp)
 Set bias values for the BaseGyroscope. More...
 
static msg_t gyro_reset_bias (void *ip)
 Reset bias values for the BaseGyroscope. More...
 
static msg_t gyro_set_sensivity (void *ip, float *sp)
 Set sensitivity values for the BaseGyroscope. More...
 
static msg_t gyro_reset_sensivity (void *ip)
 Reset sensitivity values for the BaseGyroscope. More...
 
static msg_t gyro_set_full_scale (LSM6DSLDriver *devp, lsm6dsl_gyro_fs_t fs)
 Changes the LSM6DSLDriver gyroscope fullscale value. More...
 
void lsm6dslObjectInit (LSM6DSLDriver *devp)
 Initializes an instance. More...
 
void lsm6dslStart (LSM6DSLDriver *devp, const LSM6DSLConfig *config)
 Configures and activates LSM6DSL Complex Driver peripheral. More...
 
void lsm6dslStop (LSM6DSLDriver *devp)
 Deactivates the LSM6DSL Complex Driver peripheral. More...
 

Macro Definition Documentation

#define lsm6dslI2CWriteRegister (   i2cp,
  sad,
  txbuf,
 
)
Value:
i2cMasterTransmitTimeout(i2cp, sad, txbuf, n + 1, NULL, 0, \
msg_t i2cMasterTransmitTimeout(I2CDriver *i2cp, i2caddr_t addr, const uint8_t *txbuf, size_t txbytes, uint8_t *rxbuf, size_t rxbytes, sysinterval_t timeout)
Sends data via the I2C bus.
Definition: hal_i2c.c:170
#define TIME_INFINITE
Infinite interval specification for all functions with a timeout specification.
Definition: chtime.h:55

Writes a value into a register using I2C.

Precondition
The I2C interface must be initialized and the driver started.
Parameters
[in]i2cppointer to the I2C interface
[in]sadslave address without R bit
[in]txbufbuffer containing sub-address value in first position and values to write
[in]nsize of txbuf less one (not considering the first element)
Returns
the operation status.
Function Class:Not an API, this function is for internal use only.

Definition at line 83 of file lsm6dsl.c.

Referenced by acc_set_full_scale(), gyro_set_full_scale(), lsm6dslStart(), and lsm6dslStop().

#define EX_LSM6DSL_VERSION   "1.0.0"

LSM6DSL driver version string.

Definition at line 46 of file lsm6dsl.h.

#define EX_LSM6DSL_MAJOR   1

LSM6DSL driver version major number.

Definition at line 51 of file lsm6dsl.h.

#define EX_LSM6DSL_MINOR   0

LSM6DSL driver version minor number.

Definition at line 56 of file lsm6dsl.h.

#define EX_LSM6DSL_PATCH   0

LSM6DSL driver version patch number.

Definition at line 61 of file lsm6dsl.h.

#define LSM6DSL_ACC_NUMBER_OF_AXES   3U

LSM6DSL accelerometer subsystem characteristics.

Note
Sensitivity is expressed as milli-G/LSB whereas 1 milli-G = 0.00980665 m/s^2.
Bias is expressed as milli-G.

Definition at line 72 of file lsm6dsl.h.

Referenced by acc_get_axes_number(), acc_read_cooked(), acc_read_raw(), acc_reset_bias(), acc_reset_sensivity(), acc_set_bias(), acc_set_full_scale(), acc_set_sensivity(), lsm6dslObjectInit(), and lsm6dslStart().

#define LSM6DSL_GYRO_NUMBER_OF_AXES   3U

L3GD20 gyroscope system characteristics.

Note
Sensitivity is expressed as DPS/LSB whereas DPS stand for Degree per second [°/s].
Bias is expressed as DPS.

Definition at line 95 of file lsm6dsl.h.

Referenced by gyro_get_axes_number(), gyro_read_cooked(), gyro_read_raw(), gyro_reset_bias(), gyro_reset_sensivity(), gyro_sample_bias(), gyro_set_bias(), gyro_set_full_scale(), gyro_set_sensivity(), lsm6dslObjectInit(), and lsm6dslStart().

#define LSM6DSL_USE_SPI   FALSE

LSM6DSL SPI interface switch.

If set to TRUE the support for SPI is included.

Note
The default is FALSE.

Definition at line 369 of file lsm6dsl.h.

#define LSM6DSL_SHARED_SPI   FALSE

LSM6DSL shared SPI switch.

If set to TRUE the device acquires SPI bus ownership on each transaction.

Note
The default is FALSE. Requires SPI_USE_MUTUAL_EXCLUSION.

Definition at line 379 of file lsm6dsl.h.

#define LSM6DSL_USE_I2C   TRUE

LSM6DSL I2C interface switch.

If set to TRUE the support for I2C is included.

Note
The default is TRUE.

Definition at line 388 of file lsm6dsl.h.

#define LSM6DSL_SHARED_I2C   FALSE

LSM6DSL shared I2C switch.

If set to TRUE the device acquires I2C bus ownership on each transaction.

Note
The default is FALSE. Requires I2C_USE_MUTUAL_EXCLUSION.

Definition at line 398 of file lsm6dsl.h.

#define LSM6DSL_USE_ADVANCED   FALSE

LSM6DSL advanced configurations switch.

If set to TRUE more configurations are available.

Note
The default is FALSE.

Definition at line 407 of file lsm6dsl.h.

#define LSM6DSL_ACC_USE_ADVANCED   FALSE

LSM6DSL accelerometer subsystem advanced configurations switch.

If set to TRUE more configurations are available.

Note
The default is FALSE.

Definition at line 417 of file lsm6dsl.h.

#define LSM6DSL_GYRO_USE_ADVANCED   FALSE

LSM6DSL gyroscope subsystem advanced configurations switch.

If set to TRUE more configurations are available.

Note
The default is FALSE.

Definition at line 427 of file lsm6dsl.h.

#define LSM6DSL_GYRO_BIAS_ACQ_TIMES   50

Number of acquisitions for gyroscope bias removal.

This is the number of acquisitions performed to compute the bias. A repetition is required in order to remove noise.

Definition at line 436 of file lsm6dsl.h.

Referenced by gyro_sample_bias().

#define LSM6DSL_GYRO_BIAS_SETTLING_US   5000

Settling time for gyroscope bias removal.

This is the time between each bias acquisition.

Definition at line 444 of file lsm6dsl.h.

Referenced by gyro_sample_bias().

#define _lsm6dsl_methods_alone
Value:
/* Change full scale value of LSM6DSL accelerometer subsystem .*/ \
/* Change full scale value of LSM6DSL gyroscope subsystem .*/ \
lsm6dsl_gyro_fs_t
LSM6DSL gyroscope subsystem full scale.
Definition: lsm6dsl.h:539
static msg_t acc_set_full_scale(LIS302DLDriver *devp, lis302dl_acc_fs_t fs)
Changes the LIS302DLDriver accelerometer fullscale value.
Definition: lis302dl.c:332
static msg_t gyro_set_full_scale(L3GD20Driver *devp, l3gd20_fs_t fs)
Changes the L3GD20Driver gyroscope fullscale value.
Definition: l3gd20.c:378
lsm6dsl_acc_fs_t
LSM6DSL accelerometer subsystem full scale.
Definition: lsm6dsl.h:503
LSM6DSL 6-axis accelerometer/gyroscope class.
Definition: lsm6dsl.h:752
int32_t msg_t
Definition: chtypes.h:51

LSM6DSL specific methods.

Definition at line 701 of file lsm6dsl.h.

#define _lsm6dsl_methods
Value:
#define _lsm6dsl_methods_alone
LSM6DSL specific methods.
Definition: lsm6dsl.h:701

LSM6DSL specific methods with inherited ones.

Definition at line 710 of file lsm6dsl.h.

#define _lsm6dsl_data
Value:
/* Driver state.*/ \
/* Current configuration data.*/ \
const LSM6DSLConfig *config; \
/* Accelerometer subsystem axes number.*/ \
size_t accaxes; \
/* Accelerometer subsystem current sensitivity.*/ \
float accsensitivity[LSM6DSL_ACC_NUMBER_OF_AXES]; \
/* Accelerometer subsystem current bias .*/ \
float accbias[LSM6DSL_ACC_NUMBER_OF_AXES]; \
/* Accelerometer subsystem current full scale value.*/ \
float accfullscale; \
/* Gyroscope subsystem axes number.*/ \
size_t gyroaxes; \
/* Gyroscope subsystem current sensitivity.*/ \
float gyrosensitivity[LSM6DSL_GYRO_NUMBER_OF_AXES]; \
/* Gyroscope subsystem current Bias.*/ \
float gyrobias[LSM6DSL_GYRO_NUMBER_OF_AXES]; \
/* Gyroscope subsystem current full scale value.*/ \
float gyrofullscale;
LSM6DSL configuration structure.
Definition: lsm6dsl.h:611
#define LSM6DSL_GYRO_NUMBER_OF_AXES
L3GD20 gyroscope system characteristics.
Definition: lsm6dsl.h:95
#define _base_sensor_data
BaseSensor specific data.
Definition: hal_sensors.h:74
#define LSM6DSL_ACC_NUMBER_OF_AXES
LSM6DSL accelerometer subsystem characteristics.
Definition: lsm6dsl.h:72
lsm6dsl_state_t
Driver state machine possible states.
Definition: lsm6dsl.h:602

LSM6DSLDriver specific data.

Definition at line 726 of file lsm6dsl.h.

#define lsm6dslAccelerometerGetAxesNumber (   devp)    accelerometerGetAxesNumber(&((devp)->acc_if))

Return the number of axes of the BaseAccelerometer.

Parameters
[in]devppointer to LSM6DSLDriver.
Returns
the number of axes.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 776 of file lsm6dsl.h.

#define lsm6dslAccelerometerReadRaw (   devp,
  axes 
)    accelerometerReadRaw(&((devp)->acc_if), axes)

Retrieves raw data from the BaseAccelerometer.

Note
This data is retrieved from MEMS register without any algebraical manipulation.
The axes array must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]devppointer to LSM6DSLDriver.
[out]axesa buffer which would be filled with raw data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 797 of file lsm6dsl.h.

#define lsm6dslAccelerometerReadCooked (   devp,
  axes 
)    accelerometerReadCooked(&((devp)->acc_if), axes)

Retrieves cooked data from the BaseAccelerometer.

Note
This data is manipulated according to the formula cooked = (raw * sensitivity) - bias.
Final data is expressed as milli-G.
The axes array must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]devppointer to LSM6DSLDriver.
[out]axesa buffer which would be filled with cooked data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 819 of file lsm6dsl.h.

#define lsm6dslAccelerometerSetBias (   devp,
  bp 
)    accelerometerSetBias(&((devp)->acc_if), bp)

Set bias values for the BaseAccelerometer.

Note
Bias must be expressed as milli-G.
The bias buffer must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]devppointer to LSM6DSLDriver.
[in]bpa buffer which contains biases.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 836 of file lsm6dsl.h.

#define lsm6dslAccelerometerResetBias (   devp)    accelerometerResetBias(&((devp)->acc_if))

Reset bias values for the BaseAccelerometer.

Note
Default biases value are obtained from device datasheet when available otherwise they are considered zero.
Parameters
[in]devppointer to LSM6DSLDriver.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 851 of file lsm6dsl.h.

#define lsm6dslAccelerometerSetSensitivity (   devp,
  sp 
)    accelerometerSetSensitivity(&((devp)->acc_if), sp)

Set sensitivity values for the BaseAccelerometer.

Note
Sensitivity must be expressed as milli-G/LSB.
The sensitivity buffer must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]devppointer to LSM6DSLDriver.
[in]spa buffer which contains sensitivities.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 868 of file lsm6dsl.h.

#define lsm6dslAccelerometerResetSensitivity (   devp)    accelerometerResetSensitivity(&((devp)->acc_if))

Reset sensitivity values for the BaseAccelerometer.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]devppointer to LSM6DSLDriver.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETotherwise.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 883 of file lsm6dsl.h.

#define lsm6dslAccelerometerSetFullScale (   devp,
  fs 
)    (devp)->vmt->acc_set_full_scale(devp, fs)

Changes the LSM6DSLDriver accelerometer fullscale value.

Note
This function also rescale sensitivities and biases based on previous and next fullscale value.
A recalibration is highly suggested after calling this function.
Parameters
[in]devppointer to LSM6DSLDriver.
[in]fsnew fullscale value.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETotherwise.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 901 of file lsm6dsl.h.

#define lsm6dslGyroscopeGetAxesNumber (   devp)    gyroscopeGetAxesNumber(&((devp)->gyro_if))

Return the number of axes of the BaseGyroscope.

Parameters
[in]devppointer to LSM6DSLDriver.
Returns
the number of axes.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 913 of file lsm6dsl.h.

#define lsm6dslGyroscopeReadRaw (   devp,
  axes 
)    gyroscopeReadRaw(&((devp)->gyro_if), axes)

Retrieves raw data from the BaseGyroscope.

Note
This data is retrieved from MEMS register without any algebraical manipulation.
The axes array must be at least the same size of the BaseGyroscope axes number.
Parameters
[in]devppointer to LSM6DSLDriver.
[out]axesa buffer which would be filled with raw data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 934 of file lsm6dsl.h.

#define lsm6dslGyroscopeReadCooked (   devp,
  axes 
)    gyroscopeReadCooked(&((devp)->gyro_if), axes)

Retrieves cooked data from the BaseGyroscope.

Note
This data is manipulated according to the formula cooked = (raw * sensitivity) - bias.
Final data is expressed as DPS.
The axes array must be at least the same size of the BaseGyroscope axes number.
Parameters
[in]devppointer to LSM6DSLDriver.
[out]axesa buffer which would be filled with cooked data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 956 of file lsm6dsl.h.

#define lsm6dslGyroscopeSampleBias (   devp)    gyroscopeSampleBias(&((devp)->gyro_if))

Samples bias values for the BaseGyroscope.

Note
The LSM6DSL shall not be moved during the whole procedure.
After this function internal bias is automatically updated.
The behavior of this function depends on LSM6DSL_BIAS_ACQ_TIMES and LSM6DSL_BIAS_SETTLING_US.
Parameters
[in]devppointer to LSM6DSLDriver.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 976 of file lsm6dsl.h.

#define lsm6dslGyroscopeSetBias (   devp,
  bp 
)    gyroscopeSetBias(&((devp)->gyro_if), bp)

Set bias values for the BaseGyroscope.

Note
Bias must be expressed as DPS.
The bias buffer must be at least the same size of the BaseGyroscope axes number.
Parameters
[in]devppointer to LSM6DSLDriver.
[in]bpa buffer which contains biases.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 993 of file lsm6dsl.h.

#define lsm6dslGyroscopeResetBias (   devp)    gyroscopeResetBias(&((devp)->gyro_if))

Reset bias values for the BaseGyroscope.

Note
Default biases value are obtained from device datasheet when available otherwise they are considered zero.
Parameters
[in]devppointer to LSM6DSLDriver.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 1008 of file lsm6dsl.h.

#define lsm6dslGyroscopeSetSensitivity (   devp,
  sp 
)    gyroscopeSetSensitivity(&((devp)->gyro_if), sp)

Set sensitivity values for the BaseGyroscope.

Note
Sensitivity must be expressed as DPS/LSB.
The sensitivity buffer must be at least the same size of the BaseGyroscope axes number.
Parameters
[in]devppointer to LSM6DSLDriver.
[in]spa buffer which contains sensitivities.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 1025 of file lsm6dsl.h.

#define lsm6dslGyroscopeResetSensitivity (   devp)    gyroscopeResetSensitivity(&((devp)->gyro_if))

Reset sensitivity values for the BaseGyroscope.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]devppointer to LSM6DSLDriver.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETotherwise.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 1040 of file lsm6dsl.h.

#define lsm6dslGyroscopeSetFullScale (   devp,
  fs 
)    (devp)->vmt->acc_set_full_scale(devp, fs)

Changes the LSM6DSLDriver gyroscope fullscale value.

Note
This function also rescale sensitivities and biases based on previous and next fullscale value.
A recalibration is highly suggested after calling this function.
Parameters
[in]devppointer to LSM6DSLDriver.
[in]fsnew fullscale value.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETotherwise.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 1058 of file lsm6dsl.h.

Typedef Documentation

typedef struct LSM6DSLDriver LSM6DSLDriver

Structure representing a LSM6DSL driver.

Definition at line 490 of file lsm6dsl.h.

Enumeration Type Documentation

Accelerometer and Gyroscope Slave Address.

Enumerator
LSM6DSL_SAD_GND 

SAD pin connected to GND.

LSM6DSL_SAD_VCC 

SAD pin connected to VCC.

Definition at line 495 of file lsm6dsl.h.

LSM6DSL accelerometer subsystem full scale.

Enumerator
LSM6DSL_ACC_FS_2G 

Full scale ±2g.

LSM6DSL_ACC_FS_4G 

Full scale ±4g.

LSM6DSL_ACC_FS_8G 

Full scale ±8g.

LSM6DSL_ACC_FS_16G 

Full scale ±16g.

Definition at line 503 of file lsm6dsl.h.

LSM6DSL accelerometer subsystem output data rate.

Enumerator
LSM6DSL_ACC_ODR_PD 

Power down

LSM6DSL_ACC_ODR_1P6Hz 

ODR 1.6 Hz (Low Power only)

LSM6DSL_ACC_ODR_12P5Hz 

ODR 12.5 Hz

LSM6DSL_ACC_ODR_26Hz 

ODR 26 Hz

LSM6DSL_ACC_ODR_52Hz 

ODR 52 Hz

LSM6DSL_ACC_ODR_104Hz 

ODR 104 Hz

LSM6DSL_ACC_ODR_208Hz 

ODR 208 Hz

LSM6DSL_ACC_ODR_416Hz 

ODR 416 Hz

LSM6DSL_ACC_ODR_833Hz 

ODR 833 Hz

LSM6DSL_ACC_ODR_1P66Hz 

ODR 1.66 kHz

LSM6DSL_ACC_ODR_3P33Hz 

ODR 3.33 kHz

LSM6DSL_ACC_ODR_6P66Hz 

ODR 6.66 kHz

Definition at line 513 of file lsm6dsl.h.

LSM6DSL accelerometer subsystem output data rate.

Enumerator
LSM6DSL_ACC_LP_DISABLED 

Low power disabled

LSM6DSL_ACC_LP_ENABLED 

Low power enabled

Definition at line 531 of file lsm6dsl.h.

LSM6DSL gyroscope subsystem full scale.

Enumerator
LSM6DSL_GYRO_FS_125DPS 

Full scale ±125 degree per second

LSM6DSL_GYRO_FS_250DPS 

Full scale ±250 degree per second

LSM6DSL_GYRO_FS_500DPS 

Full scale ±500 degree per second

LSM6DSL_GYRO_FS_1000DPS 

Full scale ±1000 degree per second

LSM6DSL_GYRO_FS_2000DPS 

Full scale ±2000 degree per second

Definition at line 539 of file lsm6dsl.h.

LSM6DSL gyroscope subsystem output data rate.

Enumerator
LSM6DSL_GYRO_ODR_PD 

Power down

LSM6DSL_GYRO_ODR_12P5Hz 

ODR 12.5 Hz

LSM6DSL_GYRO_ODR_26Hz 

ODR 26 Hz

LSM6DSL_GYRO_ODR_52Hz 

ODR 52 Hz

LSM6DSL_GYRO_ODR_104Hz 

ODR 104 Hz

LSM6DSL_GYRO_ODR_208Hz 

ODR 208 Hz

LSM6DSL_GYRO_ODR_416Hz 

ODR 416 Hz

LSM6DSL_GYRO_ODR_833Hz 

ODR 833 Hz

LSM6DSL_GYRO_ODR_1P66Hz 

ODR 1.66 kHz

LSM6DSL_GYRO_ODR_3P33Hz 

ODR 3.33 kHz

LSM6DSL_GYRO_ODR_6P66Hz 

ODR 6.66 kHz

Definition at line 550 of file lsm6dsl.h.

LSM6DSL gyroscope subsystem low mode configuration.

Enumerator
LSM6DSL_GYRO_LP_DISABLED 

Low power mode disabled.

LSM6DSL_GYRO_LP_ENABLED 

Low power mode enabled.

Definition at line 567 of file lsm6dsl.h.

LSM6DSL gyroscope subsystem output selection.

Enumerator
LSM6DSL_GYRO_LPF_DISABLED 

Low pass filter disabled.

LSM6DSL_GYRO_LPF_FTYPE0 

Refer to table 68 of Datasheet.

LSM6DSL_GYRO_LPF_FTYPE1 

Refer to table 68 of Datasheet.

LSM6DSL_GYRO_LPF_FTYPE2 

Refer to table 68 of Datasheet.

LSM6DSL_GYRO_LPF_FTYPE3 

Refer to table 68 of Datasheet.

Definition at line 575 of file lsm6dsl.h.

LSM6DSL block data update.

Enumerator
LSM6DSL_BDU_CONTINUOUS 

Block data continuously updated.

LSM6DSL_BDU_BLOCKED 

Block data updated after reading.

Definition at line 586 of file lsm6dsl.h.

LSM6DSL endianness.

Enumerator
LSM6DSL_END_LITTLE 

Little endian.

LSM6DSL_END_BIG 

Big endian.

Definition at line 594 of file lsm6dsl.h.

Driver state machine possible states.

Enumerator
LSM6DSL_UNINIT 

Not initialized.

LSM6DSL_STOP 

Stopped.

LSM6DSL_READY 

Ready.

Definition at line 602 of file lsm6dsl.h.

Function Documentation

msg_t lsm6dslI2CReadRegister ( I2CDriver i2cp,
lsm6dsl_sad_t  sad,
uint8_t  reg,
uint8_t *  rxbuf,
size_t  n 
)

Reads registers value using I2C.

Precondition
The I2C interface must be initialized and the driver started.
Note
IF_ADD_INC bit must be 1 in CTRL_REG8
Parameters
[in]i2cppointer to the I2C interface
[in]sadslave address without R bit
[in]regfirst sub-register address
[out]rxbufpointer to an output buffer
[in]nnumber of consecutive register to read
Returns
the operation status.
Function Class:Not an API, this function is for internal use only.

Definition at line 63 of file lsm6dsl.c.

References i2cMasterTransmitTimeout(), and TIME_INFINITE.

Referenced by acc_read_raw(), acc_set_full_scale(), gyro_read_raw(), and gyro_set_full_scale().

Here is the call graph for this function:

static size_t acc_get_axes_number ( void *  ip)
static

Return the number of axes of the BaseAccelerometer.

Parameters
[in]ippointer to BaseAccelerometer interface.
Returns
the number of axes.

Definition at line 95 of file lsm6dsl.c.

References LSM6DSL_ACC_NUMBER_OF_AXES.

Referenced by gyro_set_full_scale().

static msg_t acc_read_raw ( void *  ip,
int32_t  axes[] 
)
static

Retrieves raw data from the BaseAccelerometer.

Note
This data is retrieved from MEMS register without any algebraical manipulation.
The axes array must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]ippointer to BaseAccelerometer interface.
[out]axesa buffer which would be filled with raw data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 117 of file lsm6dsl.c.

References I2C_READY, i2cAcquireBus(), i2cReleaseBus(), i2cStart(), LSM6DSL_ACC_NUMBER_OF_AXES, LSM6DSL_READY, lsm6dslI2CReadRegister(), MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by acc_read_cooked(), and gyro_set_full_scale().

Here is the call graph for this function:

static msg_t acc_read_cooked ( void *  ip,
float  axes[] 
)
static

Retrieves cooked data from the BaseAccelerometer.

Note
This data is manipulated according to the formula cooked = (raw * sensitivity) - bias.
Final data is expressed as milli-G.
The axes array must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]ippointer to BaseAccelerometer interface.
[out]axesa buffer which would be filled with cooked data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 173 of file lsm6dsl.c.

References acc_read_raw(), LSM6DSL_ACC_NUMBER_OF_AXES, LSM6DSL_READY, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by gyro_set_full_scale().

Here is the call graph for this function:

static msg_t acc_set_bias ( void *  ip,
float *  bp 
)
static

Set bias values for the BaseAccelerometer.

Note
Bias must be expressed as milli-G.
The bias buffer must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]ippointer to BaseAccelerometer interface.
[in]bpa buffer which contains biases.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 206 of file lsm6dsl.c.

References LSM6DSL_ACC_NUMBER_OF_AXES, LSM6DSL_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by gyro_set_full_scale().

static msg_t acc_reset_bias ( void *  ip)
static

Reset bias values for the BaseAccelerometer.

Note
Default biases value are obtained from device datasheet when available otherwise they are considered zero.
Parameters
[in]ippointer to BaseAccelerometer interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 235 of file lsm6dsl.c.

References LSM6DSL_ACC_NUMBER_OF_AXES, LSM6DSL_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by gyro_set_full_scale().

static msg_t acc_set_sensivity ( void *  ip,
float *  sp 
)
static

Set sensitivity values for the BaseAccelerometer.

Note
Sensitivity must be expressed as milli-G/LSB.
The sensitivity buffer must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]ippointer to BaseAccelerometer interface.
[in]spa buffer which contains sensitivities.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 265 of file lsm6dsl.c.

References LSM6DSL_ACC_NUMBER_OF_AXES, LSM6DSL_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by gyro_set_full_scale().

static msg_t acc_reset_sensivity ( void *  ip)
static

Reset sensitivity values for the BaseAccelerometer.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]ippointer to BaseAccelerometer interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETotherwise.

Definition at line 294 of file lsm6dsl.c.

References FALSE, LSM6DSL_ACC_FS_16G, LSM6DSL_ACC_FS_2G, LSM6DSL_ACC_FS_4G, LSM6DSL_ACC_FS_8G, LSM6DSL_ACC_NUMBER_OF_AXES, LSM6DSL_READY, MSG_OK, MSG_RESET, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by gyro_set_full_scale().

static msg_t acc_set_full_scale ( LSM6DSLDriver devp,
lsm6dsl_acc_fs_t  fs 
)
static

Changes the LSM6DSLDriver accelerometer fullscale value.

Note
This function also rescale sensitivities and biases based on previous and next fullscale value.
A recalibration is highly suggested after calling this function.
Parameters
[in]devppointer to LSM6DSLDriver interface.
[in]fsnew fullscale value.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETotherwise.

Definition at line 339 of file lsm6dsl.c.

References I2C_READY, i2cAcquireBus(), i2cReleaseBus(), i2cStart(), LSM6DSL_ACC_FS_16G, LSM6DSL_ACC_FS_2G, LSM6DSL_ACC_FS_4G, LSM6DSL_ACC_FS_8G, LSM6DSL_ACC_NUMBER_OF_AXES, LSM6DSL_READY, lsm6dslI2CReadRegister(), lsm6dslI2CWriteRegister, MSG_OK, MSG_RESET, osalDbgAssert, and osalDbgCheck.

Referenced by gyro_set_full_scale().

Here is the call graph for this function:

static size_t gyro_get_axes_number ( void *  ip)
static

Return the number of axes of the BaseGyroscope.

Parameters
[in]ippointer to BaseGyroscope interface.
Returns
the number of axes.

Definition at line 427 of file lsm6dsl.c.

References LSM6DSL_GYRO_NUMBER_OF_AXES.

Referenced by gyro_set_full_scale().

static msg_t gyro_read_raw ( void *  ip,
int32_t  axes[LSM6DSL_GYRO_NUMBER_OF_AXES] 
)
static

Retrieves raw data from the BaseGyroscope.

Note
This data is retrieved from MEMS register without any algebraical manipulation.
The axes array must be at least the same size of the BaseGyroscope axes number.
Parameters
[in]ippointer to BaseGyroscope interface.
[out]axesa buffer which would be filled with raw data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 449 of file lsm6dsl.c.

References I2C_READY, i2cAcquireBus(), i2cReleaseBus(), i2cStart(), LSM6DSL_GYRO_NUMBER_OF_AXES, LSM6DSL_READY, lsm6dslI2CReadRegister(), MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by gyro_read_cooked(), gyro_sample_bias(), and gyro_set_full_scale().

Here is the call graph for this function:

static msg_t gyro_read_cooked ( void *  ip,
float  axes[] 
)
static

Retrieves cooked data from the BaseGyroscope.

Note
This data is manipulated according to the formula cooked = (raw * sensitivity) - bias.
Final data is expressed as DPS.
The axes array must be at least the same size of the BaseGyroscope axes number.
Parameters
[in]ippointer to BaseGyroscope interface.
[out]axesa buffer which would be filled with cooked data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 505 of file lsm6dsl.c.

References gyro_read_raw(), LSM6DSL_GYRO_NUMBER_OF_AXES, LSM6DSL_READY, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by gyro_set_full_scale().

Here is the call graph for this function:

static msg_t gyro_sample_bias ( void *  ip)
static

Samples bias values for the BaseGyroscope.

Note
The LSM6DSL shall not be moved during the whole procedure.
After this function internal bias is automatically updated.
The behavior of this function depends on LSM6DSL_BIAS_ACQ_TIMES and LSM6DSL_BIAS_SETTLING_US.
Parameters
[in]ippointer to BaseGyroscope interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 538 of file lsm6dsl.c.

References gyro_read_raw(), I2C_READY, LSM6DSL_GYRO_BIAS_ACQ_TIMES, LSM6DSL_GYRO_BIAS_SETTLING_US, LSM6DSL_GYRO_NUMBER_OF_AXES, LSM6DSL_READY, MSG_OK, objGetInstance, osalDbgAssert, osalDbgCheck, and osalThreadSleepMicroseconds.

Referenced by gyro_set_full_scale().

Here is the call graph for this function:

static msg_t gyro_set_bias ( void *  ip,
float *  bp 
)
static

Set bias values for the BaseGyroscope.

Note
Bias must be expressed as DPS.
The bias buffer must be at least the same size of the BaseGyroscope axes number.
Parameters
[in]ippointer to BaseGyroscope interface.
[in]bpa buffer which contains biases.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 586 of file lsm6dsl.c.

References LSM6DSL_GYRO_NUMBER_OF_AXES, LSM6DSL_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by gyro_set_full_scale().

static msg_t gyro_reset_bias ( void *  ip)
static

Reset bias values for the BaseGyroscope.

Note
Default biases value are obtained from device datasheet when available otherwise they are considered zero.
Parameters
[in]ippointer to BaseGyroscope interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 615 of file lsm6dsl.c.

References LSM6DSL_GYRO_NUMBER_OF_AXES, LSM6DSL_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by gyro_set_full_scale().

static msg_t gyro_set_sensivity ( void *  ip,
float *  sp 
)
static

Set sensitivity values for the BaseGyroscope.

Note
Sensitivity must be expressed as DPS/LSB.
The sensitivity buffer must be at least the same size of the BaseGyroscope axes number.
Parameters
[in]ippointer to BaseGyroscope interface.
[in]spa buffer which contains sensitivities.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 645 of file lsm6dsl.c.

References LSM6DSL_GYRO_NUMBER_OF_AXES, LSM6DSL_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by gyro_set_full_scale().

static msg_t gyro_reset_sensivity ( void *  ip)
static

Reset sensitivity values for the BaseGyroscope.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]ippointer to BaseGyroscope interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETotherwise.

Definition at line 674 of file lsm6dsl.c.

References FALSE, LSM6DSL_GYRO_FS_1000DPS, LSM6DSL_GYRO_FS_125DPS, LSM6DSL_GYRO_FS_2000DPS, LSM6DSL_GYRO_FS_250DPS, LSM6DSL_GYRO_FS_500DPS, LSM6DSL_GYRO_NUMBER_OF_AXES, LSM6DSL_READY, MSG_OK, MSG_RESET, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by gyro_set_full_scale().

static msg_t gyro_set_full_scale ( LSM6DSLDriver devp,
lsm6dsl_gyro_fs_t  fs 
)
static

Changes the LSM6DSLDriver gyroscope fullscale value.

Note
This function also rescale sensitivities and biases based on previous and next fullscale value.
A recalibration is highly suggested after calling this function.
Parameters
[in]devppointer to BaseGyroscope interface.
[in]fsnew fullscale value.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETotherwise.

Definition at line 721 of file lsm6dsl.c.

References acc_get_axes_number(), acc_read_cooked(), acc_read_raw(), acc_reset_bias(), acc_reset_sensivity(), acc_set_bias(), acc_set_full_scale(), acc_set_sensivity(), gyro_get_axes_number(), gyro_read_cooked(), gyro_read_raw(), gyro_reset_bias(), gyro_reset_sensivity(), gyro_sample_bias(), gyro_set_bias(), gyro_set_sensivity(), I2C_READY, i2cAcquireBus(), i2cReleaseBus(), i2cStart(), LSM6DSL_GYRO_FS_1000DPS, LSM6DSL_GYRO_FS_125DPS, LSM6DSL_GYRO_FS_2000DPS, LSM6DSL_GYRO_FS_250DPS, LSM6DSL_GYRO_FS_500DPS, LSM6DSL_GYRO_NUMBER_OF_AXES, LSM6DSL_READY, lsm6dslI2CReadRegister(), lsm6dslI2CWriteRegister, MSG_OK, MSG_RESET, osalDbgAssert, and osalDbgCheck.

Here is the call graph for this function:

void lsm6dslObjectInit ( LSM6DSLDriver devp)

Initializes an instance.

Parameters
[out]devppointer to the LSM6DSLDriver object
Function Class:Initializer, this function just initializes an object and can be invoked before the kernel is initialized.

Definition at line 832 of file lsm6dsl.c.

References LSM6DSLDriver::acc_if, LSM6DSLDriver::gyro_if, LSM6DSL_ACC_NUMBER_OF_AXES, LSM6DSL_GYRO_NUMBER_OF_AXES, LSM6DSL_STOP, BaseAccelerometer::vmt, BaseGyroscope::vmt, and LSM6DSLDriver::vmt.

void lsm6dslStart ( LSM6DSLDriver devp,
const LSM6DSLConfig config 
)

Configures and activates LSM6DSL Complex Driver peripheral.

Parameters
[in]devppointer to the LSM6DSLDriver object
[in]configpointer to the LSM6DSLConfig object
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 853 of file lsm6dsl.c.

References FALSE, i2cAcquireBus(), i2cReleaseBus(), i2cStart(), LSM6DSL_ACC_FS_16G, LSM6DSL_ACC_FS_2G, LSM6DSL_ACC_FS_4G, LSM6DSL_ACC_FS_8G, LSM6DSL_ACC_NUMBER_OF_AXES, LSM6DSL_GYRO_FS_1000DPS, LSM6DSL_GYRO_FS_125DPS, LSM6DSL_GYRO_FS_2000DPS, LSM6DSL_GYRO_FS_250DPS, LSM6DSL_GYRO_FS_500DPS, LSM6DSL_GYRO_LPF_DISABLED, LSM6DSL_GYRO_NUMBER_OF_AXES, LSM6DSL_READY, LSM6DSL_STOP, lsm6dslI2CWriteRegister, osalDbgAssert, osalDbgCheck, and osalThreadSleepMilliseconds.

Here is the call graph for this function:

void lsm6dslStop ( LSM6DSLDriver devp)

Deactivates the LSM6DSL Complex Driver peripheral.

Parameters
[in]devppointer to the LSM6DSLDriver object
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 1087 of file lsm6dsl.c.

References i2cAcquireBus(), i2cReleaseBus(), i2cStart(), i2cStop(), LSM6DSL_ACC_ODR_PD, LSM6DSL_GYRO_ODR_PD, LSM6DSL_READY, LSM6DSL_STOP, lsm6dslI2CWriteRegister, osalDbgAssert, and osalDbgCheck.

Here is the call graph for this function: