ChibiOS  0.0.0
Collaboration diagram for LSM6DS0:

Detailed Description

Macros

#define lsm6ds0I2CWriteRegister(i2cp, sad, txbuf, n)
 Writes a value into a register using I2C. More...
 
#define lsm6ds0AccelerometerGetAxesNumber(devp)   accelerometerGetAxesNumber(&((devp)->acc_if))
 Return the number of axes of the BaseAccelerometer. More...
 
#define lsm6ds0AccelerometerReadRaw(devp, axes)   accelerometerReadRaw(&((devp)->acc_if), axes)
 Retrieves raw data from the BaseAccelerometer. More...
 
#define lsm6ds0AccelerometerReadCooked(devp, axes)   accelerometerReadCooked(&((devp)->acc_if), axes)
 Retrieves cooked data from the BaseAccelerometer. More...
 
#define lsm6ds0AccelerometerSetBias(devp, bp)   accelerometerSetBias(&((devp)->acc_if), bp)
 Set bias values for the BaseAccelerometer. More...
 
#define lsm6ds0AccelerometerResetBias(devp)   accelerometerResetBias(&((devp)->acc_if))
 Reset bias values for the BaseAccelerometer. More...
 
#define lsm6ds0AccelerometerSetSensitivity(devp, sp)   accelerometerSetSensitivity(&((devp)->acc_if), sp)
 Set sensitivity values for the BaseAccelerometer. More...
 
#define lsm6ds0AccelerometerResetSensitivity(devp)   accelerometerResetSensitivity(&((devp)->acc_if))
 Reset sensitivity values for the BaseAccelerometer. More...
 
#define lsm6ds0AccelerometerSetFullScale(devp, fs)   (devp)->vmt->acc_set_full_scale(devp, fs)
 Changes the LSM6DS0Driver accelerometer fullscale value. More...
 
#define lsm6ds0GyroscopeGetAxesNumber(devp)   gyroscopeGetAxesNumber(&((devp)->gyro_if))
 Return the number of axes of the BaseGyroscope. More...
 
#define lsm6ds0GyroscopeReadRaw(devp, axes)   gyroscopeReadRaw(&((devp)->gyro_if), axes)
 Retrieves raw data from the BaseGyroscope. More...
 
#define lsm6ds0GyroscopeReadCooked(devp, axes)   gyroscopeReadCooked(&((devp)->gyro_if), axes)
 Retrieves cooked data from the BaseGyroscope. More...
 
#define lsm6ds0GyroscopeSampleBias(devp)   gyroscopeSampleBias(&((devp)->gyro_if))
 Samples bias values for the BaseGyroscope. More...
 
#define lsm6ds0GyroscopeSetBias(devp, bp)   gyroscopeSetBias(&((devp)->gyro_if), bp)
 Set bias values for the BaseGyroscope. More...
 
#define lsm6ds0GyroscopeResetBias(devp)   gyroscopeResetBias(&((devp)->gyro_if))
 Reset bias values for the BaseGyroscope. More...
 
#define lsm6ds0GyroscopeSetSensitivity(devp, sp)   gyroscopeSetSensitivity(&((devp)->gyro_if), sp)
 Set sensitivity values for the BaseGyroscope. More...
 
#define lsm6ds0GyroscopeResetSensitivity(devp)   gyroscopeResetSensitivity(&((devp)->gyro_if))
 Reset sensitivity values for the BaseGyroscope. More...
 
#define lsm6ds0GyroscopeSetFullScale(devp, fs)   (devp)->vmt->acc_set_full_scale(devp, fs)
 Changes the LSM6DS0Driver gyroscope fullscale value. More...
 

Version identification

#define EX_LSM6DS0_VERSION   "1.1.1"
 LSM6DS0 driver version string. More...
 
#define EX_LSM6DS0_MAJOR   1
 LSM6DS0 driver version major number. More...
 
#define EX_LSM6DS0_MINOR   1
 LSM6DS0 driver version minor number. More...
 
#define EX_LSM6DS0_PATCH   1
 LSM6DS0 driver version patch number. More...
 
#define LSM6DS0_ACC_NUMBER_OF_AXES   3U
 LSM6DS0 accelerometer subsystem characteristics. More...
 
#define LSM6DS0_GYRO_NUMBER_OF_AXES   3U
 L3GD20 gyroscope system characteristics. More...
 

LSM6DS0 communication interfaces related bit masks

#define LSM6DS0_DI_MASK   0xFF
 
#define LSM6DS0_DI(n)   (1 << n)
 
#define LSM6DS0_AD_MASK   0x7F
 
#define LSM6DS0_AD(n)   (1 << n)
 
#define LSM6DS0_MS   (1 << 7)
 

LSM6DS0 register addresses

#define LSM6DS0_AD_ACT_THS   0x04
 
#define LSM6DS0_AD_ACT_DUR   0x05
 
#define LSM6DS0_AD_INT_GEN_CFG_XL   0x06
 
#define LSM6DS0_AD_INT_GEN_THS_X_XL   0x07
 
#define LSM6DS0_AD_INT_GEN_THS_Y_XL   0x08
 
#define LSM6DS0_AD_INT_GEN_THS_Z_XL   0x09
 
#define LSM6DS0_AD_INT_GEN_DUR_XL   0x0A
 
#define LSM6DS0_AD_REFERENCE_G   0x0B
 
#define LSM6DS0_AD_INT_CTRL   0x0C
 
#define LSM6DS0_AD_WHO_AM_I   0x0F
 
#define LSM6DS0_AD_CTRL_REG1_G   0x10
 
#define LSM6DS0_AD_CTRL_REG2_G   0x11
 
#define LSM6DS0_AD_CTRL_REG3_G   0x12
 
#define LSM6DS0_AD_ORIENT_CFG_G   0x13
 
#define LSM6DS0_AD_INT_GEN_SRC_G   0x14
 
#define LSM6DS0_AD_OUT_TEMP_L   0x15
 
#define LSM6DS0_AD_OUT_TEMP_H   0x16
 
#define LSM6DS0_AD_STATUS_REG1   0x17
 
#define LSM6DS0_AD_OUT_X_L_G   0x18
 
#define LSM6DS0_AD_OUT_X_H_G   0x19
 
#define LSM6DS0_AD_OUT_Y_L_G   0x1A
 
#define LSM6DS0_AD_OUT_Y_H_G   0x1B
 
#define LSM6DS0_AD_OUT_Z_L_G   0x1C
 
#define LSM6DS0_AD_OUT_Z_H_G   0x1D
 
#define LSM6DS0_AD_CTRL_REG4   0x1E
 
#define LSM6DS0_AD_CTRL_REG5_XL   0x1F
 
#define LSM6DS0_AD_CTRL_REG6_XL   0x20
 
#define LSM6DS0_AD_CTRL_REG7_XL   0x21
 
#define LSM6DS0_AD_CTRL_REG8   0x22
 
#define LSM6DS0_AD_CTRL_REG9   0x23
 
#define LSM6DS0_AD_CTRL_REG10   0x24
 
#define LSM6DS0_AD_INT_GEN_SRC_XL   0x26
 
#define LSM6DS0_AD_STATUS_REG2   0x27
 
#define LSM6DS0_AD_OUT_X_L_XL   0x28
 
#define LSM6DS0_AD_OUT_X_H_XL   0x29
 
#define LSM6DS0_AD_OUT_Y_L_XL   0x2A
 
#define LSM6DS0_AD_OUT_Y_H_XL   0x2B
 
#define LSM6DS0_AD_OUT_Z_L_XL   0x2C
 
#define LSM6DS0_AD_OUT_Z_H_XL   0x2D
 
#define LSM6DS0_AD_FIFO_CTRL   0x2E
 
#define LSM6DS0_AD_FIFO_SRC   0x2F
 
#define LSM6DS0_AD_INT_GEN_CFG_G   0x30
 
#define LSM6DS0_AD_INT_GEN_THS_XH_G   0x31
 
#define LSM6DS0_AD_INT_GEN_THS_XL_G   0x32
 
#define LSM6DS0_AD_INT_GEN_THS_YH_G   0x33
 
#define LSM6DS0_AD_INT_GEN_THS_YL_G   0x34
 
#define LSM6DS0_AD_INT_GEN_THS_ZH_G   0x35
 
#define LSM6DS0_AD_INT_GEN_THS_ZL_G   0x36
 
#define LSM6DS0_AD_INT_GEN_DUR_G   0x37
 

LSM6DS0_AD_CTRL_REG1_G register bits definitions

#define LSM6DS0_CTRL_REG1_G   0xFA
 
#define LSM6DS0_CTRL_REG1_G_BW_G0   (1 << 0)
 
#define LSM6DS0_CTRL_REG1_G_BW_G1   (1 << 1)
 
#define LSM6DS0_CTRL_REG1_G_FS_MASK   0x1F
 
#define LSM6DS0_CTRL_REG1_G_FS_G0   (1 << 3)
 
#define LSM6DS0_CTRL_REG1_G_FS_G1   (1 << 4)
 
#define LSM6DS0_CTRL_REG1_G_ODR_G0   (1 << 5)
 
#define LSM6DS0_CTRL_REG1_G_ODR_G1   (1 << 6)
 
#define LSM6DS0_CTRL_REG1_G_ODR_G2   (1 << 7)
 

LSM6DS0_AD_CTRL_REG2_G register bits definitions

#define LSM6DS0_CTRL_REG2_G   0x0F
 
#define LSM6DS0_CTRL_REG2_G_OUT_SEL0   (1 << 0)
 
#define LSM6DS0_CTRL_REG2_G_OUT_SEL1   (1 << 1)
 
#define LSM6DS0_CTRL_REG2_G_INT_SEL0   (1 << 2)
 
#define LSM6DS0_CTRL_REG2_G_INT_SEL1   (1 << 3)
 

LSM6DS0_AD_CTRL_REG3_G register bits definitions

#define LSM6DS0_CTRL_REG3_G   0x64
 
#define LSM6DS0_CTRL_REG3_G_HP_CF0_G   (1 << 0)
 
#define LSM6DS0_CTRL_REG3_G_HP_CF1_G   (1 << 1)
 
#define LSM6DS0_CTRL_REG3_G_HP_CF2_G   (1 << 2)
 
#define LSM6DS0_CTRL_REG3_G_HP_CF3_G   (1 << 3)
 
#define LSM6DS0_CTRL_REG3_G_HP_EN   (1 << 6)
 
#define LSM6DS0_CTRL_REG3_G_LP_MODE   (1 << 7)
 

LSM6DS0_AD_CTRL_REG4 register bits definitions

#define LSM6DS0_CTRL_REG4   0x3A
 
#define LSM6DS0_CTRL_REG4_4D_XL1   (1 << 0)
 
#define LSM6DS0_CTRL_REG4_LIR_XL1   (1 << 1)
 
#define LSM6DS0_CTRL_REG4_XEN_G   (1 << 3)
 
#define LSM6DS0_CTRL_REG4_YEN_G   (1 << 4)
 
#define LSM6DS0_CTRL_REG4_ZEN_G   (1 << 5)
 

LSM6DS0_AD_CTRL_REG5_XL register bits definitions

#define LSM6DS0_CTRL_REG5_XL   0xF8
 
#define LSM6DS0_CTRL_REG5_XL_XEN_XL   (1 << 3)
 
#define LSM6DS0_CTRL_REG5_XL_YEN_XL   (1 << 4)
 
#define LSM6DS0_CTRL_REG5_XL_ZEN_XL   (1 << 5)
 
#define LSM6DS0_CTRL_REG5_XL_DEC0   (1 << 6)
 
#define LSM6DS0_CTRL_REG5_XL_DEC1   (1 << 7)
 

LSM6DS0_AD_CTRL_REG6_XL register bits definitions

#define LSM6DS0_CTRL_REG6_XL   0xFF
 
#define LSM6DS0_CTRL_REG6_XL_BW_XL0   (1 << 0)
 
#define LSM6DS0_CTRL_REG6_XL_BW_XL1   (1 << 1)
 
#define LSM6DS0_CTRL_REG6_XL_BW_SCAL_ODR   (1 << 2)
 
#define LSM6DS0_CTRL_REG6_XL_FS_MASK   0x1F
 
#define LSM6DS0_CTRL_REG6_XL_FS0_XL   (1 << 3)
 
#define LSM6DS0_CTRL_REG6_XL_FS1_XL   (1 << 4)
 
#define LSM6DS0_CTRL_REG6_XL_ODR_XL0   (1 << 5)
 
#define LSM6DS0_CTRL_REG6_XL_ODR_XL1   (1 << 6)
 
#define LSM6DS0_CTRL_REG6_XL_ODR_XL2   (1 << 7)
 

LSM6DS0_AD_CTRL_REG7_XL register bits definitions

#define LSM6DS0_CTRL_REG7_XL   0xE5
 
#define LSM6DS0_CTRL_REG7_XL_HPIS1   (1 << 0)
 
#define LSM6DS0_CTRL_REG7_XL_FDS   (1 << 2)
 
#define LSM6DS0_CTRL_REG7_XL_DCF0   (1 << 5)
 
#define LSM6DS0_CTRL_REG7_XL_DCF1   (1 << 6)
 
#define LSM6DS0_CTRL_REG7_XL_HR   (1 << 7)
 

LSM6DS0_AD_CTRL_REG8 register bits definitions

#define LSM6DS0_CTRL_REG8   0xFF
 
#define LSM6DS0_CTRL_REG8_SW_RESET   (1 << 0)
 
#define LSM6DS0_CTRL_REG8_BLE   (1 << 1)
 
#define LSM6DS0_CTRL_REG8_IF_ADD_INC   (1 << 2)
 
#define LSM6DS0_CTRL_REG8_SIM   (1 << 3)
 
#define LSM6DS0_CTRL_REG8_PP_OD   (1 << 4)
 
#define LSM6DS0_CTRL_REG8_H_LACTIVE   (1 << 5)
 
#define LSM6DS0_CTRL_REG8_BDU   (1 << 6)
 
#define LSM6DS0_CTRL_REG8_BOOT   (1 << 7)
 

LSM6DS0_AD_CTRL_REG9 register bits definitions

#define LSM6DS0_CTRL_REG9   0x5F
 
#define LSM6DS0_CTRL_REG9_STOP_ON_FTH   (1 << 0)
 
#define LSM6DS0_CTRL_REG9_FIFO_EN   (1 << 1)
 
#define LSM6DS0_CTRL_REG9_I2C_DISABLE   (1 << 2)
 
#define LSM6DS0_CTRL_REG9_DRDY_MASK_BIT   (1 << 3)
 
#define LSM6DS0_CTRL_REG9_FIFO_TEMP_EN   (1 << 4)
 
#define LSM6DS0_CTRL_REG9_SLEEP_G   (1 << 6)
 

LSM6DS0_AD_CTRL_REG10 register bits definitions

#define LSM6DS0_CTRL_REG10   0x05
 
#define LSM6DS0_CTRL_REG10_ST_XL   (1 << 0)
 
#define LSM6DS0_CTRL_REG10_ST_G   (1 << 2)
 

Configuration options

#define LSM6DS0_USE_SPI   FALSE
 LSM6DS0 SPI interface switch. More...
 
#define LSM6DS0_SHARED_SPI   FALSE
 LSM6DS0 shared SPI switch. More...
 
#define LSM6DS0_USE_I2C   TRUE
 LSM6DS0 I2C interface switch. More...
 
#define LSM6DS0_SHARED_I2C   FALSE
 LSM6DS0 shared I2C switch. More...
 
#define LSM6DS0_USE_ADVANCED   FALSE
 LSM6DS0 advanced configurations switch. More...
 
#define LSM6DS0_ACC_USE_ADVANCED   FALSE
 LSM6DS0 accelerometer subsystem advanced configurations switch. More...
 
#define LSM6DS0_GYRO_USE_ADVANCED   FALSE
 LSM6DS0 gyroscope subsystem advanced configurations switch. More...
 
#define LSM6DS0_GYRO_BIAS_ACQ_TIMES   50
 Number of acquisitions for gyroscope bias removal. More...
 
#define LSM6DS0_GYRO_BIAS_SETTLING_US   5000
 Settling time for gyroscope bias removal. More...
 

LSM6DS0 data structures and types.

Todo:
Add support for LSM6DS0 over SPI.
typedef struct LSM6DS0Driver LSM6DS0Driver
 Structure representing a LSM6DS0 driver. More...
 
#define _lsm6ds0_methods_alone
 LSM6DS0 specific methods. More...
 
#define _lsm6ds0_methods
 LSM6DS0 specific methods with inherited ones. More...
 
#define _lsm6ds0_data
 LSM6DS0Driver specific data. More...
 

Data Structures

struct  LSM6DS0Config
 LSM6DS0 configuration structure. More...
 
struct  LSM6DS0VMT
 LSM6DS0 virtual methods table. More...
 
struct  LSM6DS0Driver
 LSM6DS0 6-axis accelerometer/gyroscope class. More...
 

Functions

msg_t lsm6ds0I2CReadRegister (I2CDriver *i2cp, lsm6ds0_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 (LSM6DS0Driver *devp, lsm6ds0_acc_fs_t fs)
 Changes the LSM6DS0Driver 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[LSM6DS0_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 (LSM6DS0Driver *devp, lsm6ds0_gyro_fs_t fs)
 Changes the LSM6DS0Driver gyroscope fullscale value. More...
 
void lsm6ds0ObjectInit (LSM6DS0Driver *devp)
 Initializes an instance. More...
 
void lsm6ds0Start (LSM6DS0Driver *devp, const LSM6DS0Config *config)
 Configures and activates LSM6DS0 Complex Driver peripheral. More...
 
void lsm6ds0Stop (LSM6DS0Driver *devp)
 Deactivates the LSM6DS0 Complex Driver peripheral. More...
 

Macro Definition Documentation

#define lsm6ds0I2CWriteRegister (   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 lsm6ds0.c.

Referenced by acc_set_full_scale(), gyro_set_full_scale(), lsm6ds0Start(), and lsm6ds0Stop().

#define EX_LSM6DS0_VERSION   "1.1.1"

LSM6DS0 driver version string.

Definition at line 46 of file lsm6ds0.h.

#define EX_LSM6DS0_MAJOR   1

LSM6DS0 driver version major number.

Definition at line 51 of file lsm6ds0.h.

#define EX_LSM6DS0_MINOR   1

LSM6DS0 driver version minor number.

Definition at line 56 of file lsm6ds0.h.

#define EX_LSM6DS0_PATCH   1

LSM6DS0 driver version patch number.

Definition at line 61 of file lsm6ds0.h.

#define LSM6DS0_ACC_NUMBER_OF_AXES   3U

LSM6DS0 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 lsm6ds0.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(), lsm6ds0ObjectInit(), and lsm6ds0Start().

#define LSM6DS0_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 lsm6ds0.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(), lsm6ds0ObjectInit(), and lsm6ds0Start().

#define LSM6DS0_USE_SPI   FALSE

LSM6DS0 SPI interface switch.

If set to TRUE the support for SPI is included.

Note
The default is FALSE.

Definition at line 316 of file lsm6ds0.h.

#define LSM6DS0_SHARED_SPI   FALSE

LSM6DS0 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 326 of file lsm6ds0.h.

#define LSM6DS0_USE_I2C   TRUE

LSM6DS0 I2C interface switch.

If set to TRUE the support for I2C is included.

Note
The default is TRUE.

Definition at line 335 of file lsm6ds0.h.

#define LSM6DS0_SHARED_I2C   FALSE

LSM6DS0 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 345 of file lsm6ds0.h.

#define LSM6DS0_USE_ADVANCED   FALSE

LSM6DS0 advanced configurations switch.

If set to TRUE more configurations are available.

Note
The default is FALSE.

Definition at line 354 of file lsm6ds0.h.

#define LSM6DS0_ACC_USE_ADVANCED   FALSE

LSM6DS0 accelerometer subsystem advanced configurations switch.

If set to TRUE more configurations are available.

Note
The default is FALSE.

Definition at line 364 of file lsm6ds0.h.

#define LSM6DS0_GYRO_USE_ADVANCED   FALSE

LSM6DS0 gyroscope subsystem advanced configurations switch.

If set to TRUE more configurations are available.

Note
The default is FALSE.

Definition at line 374 of file lsm6ds0.h.

#define LSM6DS0_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 383 of file lsm6ds0.h.

Referenced by gyro_sample_bias().

#define LSM6DS0_GYRO_BIAS_SETTLING_US   5000

Settling time for gyroscope bias removal.

This is the time between each bias acquisition.

Definition at line 391 of file lsm6ds0.h.

Referenced by gyro_sample_bias().

#define _lsm6ds0_methods_alone
Value:
/* Change full scale value of LSM6DS0 accelerometer subsystem .*/ \
/* Change full scale value of LSM6DS0 gyroscope subsystem .*/ \
static msg_t acc_set_full_scale(LIS302DLDriver *devp, lis302dl_acc_fs_t fs)
Changes the LIS302DLDriver accelerometer fullscale value.
Definition: lis302dl.c:332
lsm6ds0_acc_fs_t
LSM6DS0 accelerometer subsystem full scale.
Definition: lsm6ds0.h:450
static msg_t gyro_set_full_scale(L3GD20Driver *devp, l3gd20_fs_t fs)
Changes the L3GD20Driver gyroscope fullscale value.
Definition: l3gd20.c:378
LSM6DS0 6-axis accelerometer/gyroscope class.
Definition: lsm6ds0.h:731
lsm6ds0_gyro_fs_t
LSM6DS0 gyroscope subsystem full scale.
Definition: lsm6ds0.h:483
int32_t msg_t
Definition: chtypes.h:51

LSM6DS0 specific methods.

Definition at line 680 of file lsm6ds0.h.

#define _lsm6ds0_methods
Value:
#define _lsm6ds0_methods_alone
LSM6DS0 specific methods.
Definition: lsm6ds0.h:680

LSM6DS0 specific methods with inherited ones.

Definition at line 689 of file lsm6ds0.h.

#define _lsm6ds0_data
Value:
/* Driver state.*/ \
/* Current configuration data.*/ \
const LSM6DS0Config *config; \
/* Accelerometer subsystem axes number.*/ \
size_t accaxes; \
/* Accelerometer subsystem current sensitivity.*/ \
float accsensitivity[LSM6DS0_ACC_NUMBER_OF_AXES]; \
/* Accelerometer subsystem current bias .*/ \
float accbias[LSM6DS0_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[LSM6DS0_GYRO_NUMBER_OF_AXES]; \
/* Gyroscope subsystem current Bias.*/ \
float gyrobias[LSM6DS0_GYRO_NUMBER_OF_AXES]; \
/* Gyroscope subsystem current full scale value.*/ \
float gyrofullscale;
LSM6DS0 configuration structure.
Definition: lsm6ds0.h:582
lsm6ds0_state_t
Driver state machine possible states.
Definition: lsm6ds0.h:573
#define LSM6DS0_ACC_NUMBER_OF_AXES
LSM6DS0 accelerometer subsystem characteristics.
Definition: lsm6ds0.h:72
#define LSM6DS0_GYRO_NUMBER_OF_AXES
L3GD20 gyroscope system characteristics.
Definition: lsm6ds0.h:95
#define _base_sensor_data
BaseSensor specific data.
Definition: hal_sensors.h:74

LSM6DS0Driver specific data.

Definition at line 705 of file lsm6ds0.h.

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

Return the number of axes of the BaseAccelerometer.

Parameters
[in]devppointer to LSM6DS0Driver.
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 755 of file lsm6ds0.h.

#define lsm6ds0AccelerometerReadRaw (   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 LSM6DS0Driver.
[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 776 of file lsm6ds0.h.

#define lsm6ds0AccelerometerReadCooked (   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 LSM6DS0Driver.
[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 798 of file lsm6ds0.h.

#define lsm6ds0AccelerometerSetBias (   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 LSM6DS0Driver.
[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 815 of file lsm6ds0.h.

#define lsm6ds0AccelerometerResetBias (   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 LSM6DS0Driver.
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 830 of file lsm6ds0.h.

#define lsm6ds0AccelerometerSetSensitivity (   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 LSM6DS0Driver.
[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 847 of file lsm6ds0.h.

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

Reset sensitivity values for the BaseAccelerometer.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]devppointer to LSM6DS0Driver.
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 862 of file lsm6ds0.h.

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

Changes the LSM6DS0Driver 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 LSM6DS0Driver.
[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 880 of file lsm6ds0.h.

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

Return the number of axes of the BaseGyroscope.

Parameters
[in]devppointer to LSM6DS0Driver.
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 892 of file lsm6ds0.h.

#define lsm6ds0GyroscopeReadRaw (   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 LSM6DS0Driver.
[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 913 of file lsm6ds0.h.

#define lsm6ds0GyroscopeReadCooked (   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 LSM6DS0Driver.
[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 935 of file lsm6ds0.h.

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

Samples bias values for the BaseGyroscope.

Note
The LSM6DS0 shall not be moved during the whole procedure.
After this function internal bias is automatically updated.
The behavior of this function depends on LSM6DS0_BIAS_ACQ_TIMES and LSM6DS0_BIAS_SETTLING_US.
Parameters
[in]devppointer to LSM6DS0Driver.
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 955 of file lsm6ds0.h.

#define lsm6ds0GyroscopeSetBias (   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 LSM6DS0Driver.
[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 972 of file lsm6ds0.h.

#define lsm6ds0GyroscopeResetBias (   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 LSM6DS0Driver.
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 987 of file lsm6ds0.h.

#define lsm6ds0GyroscopeSetSensitivity (   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 LSM6DS0Driver.
[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 1004 of file lsm6ds0.h.

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

Reset sensitivity values for the BaseGyroscope.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]devppointer to LSM6DS0Driver.
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 1019 of file lsm6ds0.h.

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

Changes the LSM6DS0Driver 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 LSM6DS0Driver.
[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 1037 of file lsm6ds0.h.

Typedef Documentation

typedef struct LSM6DS0Driver LSM6DS0Driver

Structure representing a LSM6DS0 driver.

Definition at line 437 of file lsm6ds0.h.

Enumeration Type Documentation

Accelerometer and Gyroscope Slave Address.

Enumerator
LSM6DS0_SAD_GND 

SAD pin connected to GND.

LSM6DS0_SAD_VCC 

SAD pin connected to VCC.

Definition at line 442 of file lsm6ds0.h.

LSM6DS0 accelerometer subsystem full scale.

Enumerator
LSM6DS0_ACC_FS_2G 

Full scale ±2g.

LSM6DS0_ACC_FS_4G 

Full scale ±4g.

LSM6DS0_ACC_FS_8G 

Full scale ±8g.

LSM6DS0_ACC_FS_16G 

Full scale ±16g.

Definition at line 450 of file lsm6ds0.h.

LSM6DS0 accelerometer subsystem output data rate.

Enumerator
LSM6DS0_ACC_ODR_PD 

Power down

LSM6DS0_ACC_ODR_10Hz 

ODR 10 Hz

LSM6DS0_ACC_ODR_50Hz 

ODR 50 Hz

LSM6DS0_ACC_ODR_119Hz 

ODR 119 Hz

LSM6DS0_ACC_ODR_238Hz 

ODR 238 Hz

LSM6DS0_ACC_ODR_476Hz 

ODR 476 Hz

LSM6DS0_ACC_ODR_952Hz 

ODR 952 Hz

Definition at line 460 of file lsm6ds0.h.

LSM6DS0 accelerometer subsystem decimation mode.

Enumerator
LSM6DS0_ACC_DEC_DISABLED 

Decimation disabled.

LSM6DS0_ACC_DEC_X2 

Output updated every 2 samples.

LSM6DS0_ACC_DEC_X4 

Output updated every 4 samples.

LSM6DS0_ACC_DEC_X8 

Output updated every 8 samples.

Definition at line 473 of file lsm6ds0.h.

LSM6DS0 gyroscope subsystem full scale.

Enumerator
LSM6DS0_GYRO_FS_245DPS 

Full scale ±245 degree per second

LSM6DS0_GYRO_FS_500DPS 

Full scale ±500 degree per second

LSM6DS0_GYRO_FS_2000DPS 

Full scale ±2000 degree per second

Definition at line 483 of file lsm6ds0.h.

LSM6DS0 gyroscope subsystem output data rate.

Definition at line 492 of file lsm6ds0.h.

LSM6DS0 gyroscope subsystem low mode configuration.

Enumerator
LSM6DS0_GYRO_LP_DISABLED 

Low power mode disabled.

LSM6DS0_GYRO_LP_ENABLED 

Low power mode enabled.

Definition at line 516 of file lsm6ds0.h.

LSM6DS0 gyroscope subsystem output selection.

Enumerator
LSM6DS0_GYRO_OUT_SEL_0 

Low pass filter 1.

LSM6DS0_GYRO_OUT_SEL_1 

High pass filter 1 if enabled.

LSM6DS0_GYRO_OUT_SEL_2 

Low pass filter 2.

Definition at line 524 of file lsm6ds0.h.

LSM6DS0 gyroscope subsystem high pass filter.

Enumerator
LSM6DS0_GYRO_HP_DISABLED 

High pass filter disabled.

LSM6DS0_GYRO_HP_ENABLED 

High pass filter enabled.

Definition at line 533 of file lsm6ds0.h.

LSM6DS0 gyroscope subsystem high pass filter configuration.

Enumerator
LSM6DS0_GYRO_HPCF_0 

Refer to table 48 of RM

Definition at line 541 of file lsm6ds0.h.

LSM6DS0 block data update.

Enumerator
LSM6DS0_BDU_CONTINUOUS 

Block data continuously updated.

LSM6DS0_BDU_BLOCKED 

Block data updated after reading.

Definition at line 557 of file lsm6ds0.h.

LSM6DS0 endianness.

Enumerator
LSM6DS0_END_LITTLE 

Little endian.

LSM6DS0_END_BIG 

Big endian.

Definition at line 565 of file lsm6ds0.h.

Driver state machine possible states.

Enumerator
LSM6DS0_UNINIT 

Not initialized.

LSM6DS0_STOP 

Stopped.

LSM6DS0_READY 

Ready.

Definition at line 573 of file lsm6ds0.h.

Function Documentation

msg_t lsm6ds0I2CReadRegister ( I2CDriver i2cp,
lsm6ds0_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 lsm6ds0.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 lsm6ds0.c.

References LSM6DS0_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 lsm6ds0.c.

References I2C_READY, i2cAcquireBus(), i2cReleaseBus(), i2cStart(), LSM6DS0_ACC_NUMBER_OF_AXES, LSM6DS0_READY, lsm6ds0I2CReadRegister(), 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 lsm6ds0.c.

References acc_read_raw(), LSM6DS0_ACC_NUMBER_OF_AXES, LSM6DS0_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 lsm6ds0.c.

References LSM6DS0_ACC_NUMBER_OF_AXES, LSM6DS0_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 lsm6ds0.c.

References LSM6DS0_ACC_NUMBER_OF_AXES, LSM6DS0_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 lsm6ds0.c.

References LSM6DS0_ACC_NUMBER_OF_AXES, LSM6DS0_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 lsm6ds0.c.

References FALSE, LSM6DS0_ACC_FS_16G, LSM6DS0_ACC_FS_2G, LSM6DS0_ACC_FS_4G, LSM6DS0_ACC_FS_8G, LSM6DS0_ACC_NUMBER_OF_AXES, LSM6DS0_READY, MSG_OK, MSG_RESET, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by gyro_set_full_scale().

static msg_t acc_set_full_scale ( LSM6DS0Driver devp,
lsm6ds0_acc_fs_t  fs 
)
static

Changes the LSM6DS0Driver 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 LSM6DS0Driver interface.
[in]fsnew fullscale value.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETotherwise.

Definition at line 339 of file lsm6ds0.c.

References I2C_READY, i2cAcquireBus(), i2cReleaseBus(), i2cStart(), LSM6DS0_ACC_FS_16G, LSM6DS0_ACC_FS_2G, LSM6DS0_ACC_FS_4G, LSM6DS0_ACC_FS_8G, LSM6DS0_ACC_NUMBER_OF_AXES, LSM6DS0_READY, lsm6ds0I2CReadRegister(), lsm6ds0I2CWriteRegister, 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 lsm6ds0.c.

References LSM6DS0_GYRO_NUMBER_OF_AXES.

Referenced by gyro_set_full_scale().

static msg_t gyro_read_raw ( void *  ip,
int32_t  axes[LSM6DS0_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 lsm6ds0.c.

References I2C_READY, i2cAcquireBus(), i2cReleaseBus(), i2cStart(), LSM6DS0_GYRO_NUMBER_OF_AXES, LSM6DS0_READY, lsm6ds0I2CReadRegister(), 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 lsm6ds0.c.

References gyro_read_raw(), LSM6DS0_GYRO_NUMBER_OF_AXES, LSM6DS0_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 LSM6DS0 shall not be moved during the whole procedure.
After this function internal bias is automatically updated.
The behavior of this function depends on LSM6DS0_BIAS_ACQ_TIMES and LSM6DS0_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 lsm6ds0.c.

References gyro_read_raw(), I2C_READY, LSM6DS0_GYRO_BIAS_ACQ_TIMES, LSM6DS0_GYRO_BIAS_SETTLING_US, LSM6DS0_GYRO_NUMBER_OF_AXES, LSM6DS0_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 lsm6ds0.c.

References LSM6DS0_GYRO_NUMBER_OF_AXES, LSM6DS0_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 lsm6ds0.c.

References LSM6DS0_GYRO_NUMBER_OF_AXES, LSM6DS0_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 lsm6ds0.c.

References LSM6DS0_GYRO_NUMBER_OF_AXES, LSM6DS0_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 lsm6ds0.c.

References FALSE, LSM6DS0_GYRO_FS_2000DPS, LSM6DS0_GYRO_FS_245DPS, LSM6DS0_GYRO_FS_500DPS, LSM6DS0_GYRO_NUMBER_OF_AXES, LSM6DS0_READY, MSG_OK, MSG_RESET, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by gyro_set_full_scale().

static msg_t gyro_set_full_scale ( LSM6DS0Driver devp,
lsm6ds0_gyro_fs_t  fs 
)
static

Changes the LSM6DS0Driver 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 716 of file lsm6ds0.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(), LSM6DS0_GYRO_FS_2000DPS, LSM6DS0_GYRO_FS_245DPS, LSM6DS0_GYRO_FS_500DPS, LSM6DS0_GYRO_NUMBER_OF_AXES, LSM6DS0_READY, lsm6ds0I2CReadRegister(), lsm6ds0I2CWriteRegister, MSG_OK, MSG_RESET, osalDbgAssert, and osalDbgCheck.

Here is the call graph for this function:

void lsm6ds0ObjectInit ( LSM6DS0Driver devp)

Initializes an instance.

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

Definition at line 821 of file lsm6ds0.c.

References LSM6DS0Driver::acc_if, LSM6DS0Driver::gyro_if, LSM6DS0_ACC_NUMBER_OF_AXES, LSM6DS0_GYRO_NUMBER_OF_AXES, LSM6DS0_STOP, BaseAccelerometer::vmt, BaseGyroscope::vmt, and LSM6DS0Driver::vmt.

void lsm6ds0Start ( LSM6DS0Driver devp,
const LSM6DS0Config config 
)

Configures and activates LSM6DS0 Complex Driver peripheral.

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

Definition at line 842 of file lsm6ds0.c.

References FALSE, i2cAcquireBus(), i2cReleaseBus(), i2cStart(), LSM6DS0_ACC_FS_16G, LSM6DS0_ACC_FS_2G, LSM6DS0_ACC_FS_4G, LSM6DS0_ACC_FS_8G, LSM6DS0_ACC_NUMBER_OF_AXES, LSM6DS0_GYRO_FS_2000DPS, LSM6DS0_GYRO_FS_245DPS, LSM6DS0_GYRO_FS_500DPS, LSM6DS0_GYRO_NUMBER_OF_AXES, LSM6DS0_READY, LSM6DS0_STOP, lsm6ds0I2CWriteRegister, osalDbgAssert, osalDbgCheck, and osalThreadSleepMilliseconds.

Here is the call graph for this function:

void lsm6ds0Stop ( LSM6DS0Driver devp)

Deactivates the LSM6DS0 Complex Driver peripheral.

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

Definition at line 1074 of file lsm6ds0.c.

References i2cAcquireBus(), i2cReleaseBus(), i2cStart(), i2cStop(), LSM6DS0_READY, LSM6DS0_STOP, lsm6ds0I2CWriteRegister, osalDbgAssert, and osalDbgCheck.

Here is the call graph for this function: