mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #20170 from miquel-b/lsm6dsxx
drivers/lsm6dsxx: refactoring Lsm6dsl into common driver Lsm6dsxx
This commit is contained in:
commit
34fcffe37b
@ -71,8 +71,8 @@ extern "C" {
|
||||
* @name LSM6DSL accelerometer sensor configuration
|
||||
* @{
|
||||
*/
|
||||
#define LSM6DSL_PARAM_I2C I2C_DEV(1)
|
||||
#define LSM6DSL_PARAM_ADDR (0x6A)
|
||||
#define LSM6DSXX_PARAM_I2C I2C_DEV(1)
|
||||
#define LSM6DSXX_PARAM_ADDR (0x6A)
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -82,6 +82,14 @@ extern "C" {
|
||||
#define SHT3X_PARAM_I2C_ADDR (SHT3X_I2C_ADDR_1) /**< I2C address */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name LSM6DSXX accelerometer sensor configuration
|
||||
* @{
|
||||
*/
|
||||
#define LSM6DSXX_PARAM_I2C I2C_DEV(0)
|
||||
#define LSM6DSXX_PARAM_ADDR (0x6A)
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
195
dist/tools/doccheck/exclude_simple
vendored
195
dist/tools/doccheck/exclude_simple
vendored
@ -3465,120 +3465,6 @@ warning: Member LSM303DLHC_TEMP_SAMPLE_30HZ (macro definition) of file lsm303dlh
|
||||
warning: Member LSM303DLHC_TEMP_SAMPLE_3HZ (macro definition) of file lsm303dlhc-internal.h is not documented.
|
||||
warning: Member LSM303DLHC_TEMP_SAMPLE_75HZ (macro definition) of file lsm303dlhc-internal.h is not documented.
|
||||
warning: Member LSM303DLHC_TEMP_SAMPLE_7_5HZ (macro definition) of file lsm303dlhc-internal.h is not documented.
|
||||
warning: Member LSM6DSL_CTRL3_C_BOOT (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_CTRL_FS_MASK (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_CTRL_FS_SHIFT (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_CTRL_ODR_MASK (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_CTRL_ODR_SHIFT (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_FIFO_CTRL3_GYRO_DEC_SHIFT (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_FIFO_CTRL5_CONTINUOUS_MODE (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_FIFO_CTRL5_FIFO_ODR_SHIFT (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_PARAM_ACC_FIFO_DEC (macro definition) of file lsm6dsl_params.h is not documented.
|
||||
warning: Member LSM6DSL_PARAM_ACC_FS (macro definition) of file lsm6dsl_params.h is not documented.
|
||||
warning: Member LSM6DSL_PARAM_ACC_ODR (macro definition) of file lsm6dsl_params.h is not documented.
|
||||
warning: Member LSM6DSL_PARAM_ADDR (macro definition) of file board.h is not documented.
|
||||
warning: Member LSM6DSL_PARAM_ADDR (macro definition) of file lsm6dsl_params.h is not documented.
|
||||
warning: Member LSM6DSL_PARAM_GYRO_FIFO_DEC (macro definition) of file lsm6dsl_params.h is not documented.
|
||||
warning: Member LSM6DSL_PARAM_GYRO_FS (macro definition) of file lsm6dsl_params.h is not documented.
|
||||
warning: Member LSM6DSL_PARAM_GYRO_ODR (macro definition) of file lsm6dsl_params.h is not documented.
|
||||
warning: Member LSM6DSL_PARAM_I2C (macro definition) of file board.h is not documented.
|
||||
warning: Member LSM6DSL_PARAM_I2C (macro definition) of file lsm6dsl_params.h is not documented.
|
||||
warning: Member LSM6DSL_PARAMS (macro definition) of file lsm6dsl_params.h is not documented.
|
||||
warning: Member LSM6DSL_REG_CTRL10_C (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_CTRL1_XL (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_CTRL2_G (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_CTRL3_C (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_CTRL4_C (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_CTRL5_C (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_CTRL6_C (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_CTRL7_G (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_CTRL8_XL (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_CTRL9_XL (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_D6D_SRC (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_DRDY_PULSE_CFG_G (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_FIFO_CTRL1 (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_FIFO_CTRL2 (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_FIFO_CTRL3 (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_FIFO_CTRL4 (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_FIFO_CTRL5 (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_FIFO_DATA_OUT_H (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_FIFO_DATA_OUT_L (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_FIFO_STATUS1 (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_FIFO_STATUS2 (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_FIFO_STATUS3 (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_FIFO_STATUS4 (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_FREE_FALL (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_FUNC_CFG_ACCESS (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_FUNC_SRC_1 (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_FUNC_SRC_2 (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_INT1_CTRL (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_INT2_CTRL (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_INT_DUR2 (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_MASTER_CMD_CODE (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_MASTER_CONFIG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_MD1_CFG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_MD2_CFG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUT_MAG_RAW_X_H (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUT_MAG_RAW_X_L (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUT_MAG_RAW_Y_H (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUT_MAG_RAW_Y_L (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUT_MAG_RAW_Z_H (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUT_MAG_RAW_Z_L (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUT_TEMP_H (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUT_TEMP_L (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUTX_H_G (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUTX_H_XL (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUTX_L_G (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUTX_L_XL (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUTY_H_G (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUTY_H_XL (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUTY_L_G (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUTY_L_XL (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUTZ_H_G (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUTZ_H_XL (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUTZ_L_G (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_OUTZ_L_XL (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSORHUB10_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSORHUB11_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSORHUB12_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSORHUB13_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSORHUB14_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSORHUB15_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSORHUB16_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSORHUB17_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSORHUB18_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSORHUB1_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSORHUB2_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSORHUB3_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSORHUB4_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSORHUB5_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSORHUB6_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSORHUB7_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSORHUB8_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSORHUB9_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSOR_SYC_RES_RATIO (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENSOR_SYNC_TIME_FRAME (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_SENS_SYNC_SPI_ERR_CODE (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_STATUS_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_STEP_COUNTER_H (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_STEP_COUNTER_L (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_STEP_TIMESTAMP_H (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_STEP_TIMESTAMP_L (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_TAP_CFG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_TAP_SRC (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_TAP_THS_6D (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_TIMESTAMP0_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_TIMESTAMP1_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_TIMESTAMP2_REG (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_WAKE_UP_DUR (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_WAKE_UP_SRC (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_WAKE_UP_THS (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_WHO_AM_I (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_WRIST_TILT_IA (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_X_OFS_USR (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_Y_OFS_USR (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_REG_Z_OFS_USR (macro definition) of file lsm6dsl_internal.h is not documented.
|
||||
warning: Member LSM6DSL_SAUL_INFO (macro definition) of file lsm6dsl_params.h is not documented.
|
||||
warning: Member LTC4150_PARAM_FLAGS (macro definition) of file ltc4150_params.h is not documented.
|
||||
warning: Member LTC4150_PARAM_INT (macro definition) of file ltc4150_params.h is not documented.
|
||||
warning: Member LTC4150_PARAM_POL (macro definition) of file ltc4150_params.h is not documented.
|
||||
@ -8456,3 +8342,84 @@ warning: Member SCSI_SENSE_KEY_VENDOR_SPECIFIC (macro definition) of file scsi.h
|
||||
warning: Member SCSI_SENSE_KEY_ABORTED_COMMAND (macro definition) of file scsi.h is not documented.
|
||||
warning: Member SCSI_SENSE_KEY_VOLUME_OVERFLOW (macro definition) of file scsi.h is not documented.
|
||||
warning: Member SCSI_SENSE_KEY_MISCOMPARE (macro definition) of file scsi.h is not documented.
|
||||
warning: Member LSM6DSXX_PARAM_I2C (macro definition) of file board.h is not documented.
|
||||
warning: Member LSM6DSXX_PARAM_ADDR (macro definition) of file board.h is not documented.
|
||||
warning: Member LSM6DSXX_PARAM_I2C (macro definition) of file board.h is not documented.
|
||||
warning: Member LSM6DSXX_PARAM_ADDR (macro definition) of file board.h is not documented.
|
||||
warning: Member LSM6DSXX_CTRL_ODR_SHIFT (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_CTRL_ODR_MASK (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_CTRL_FS_SHIFT (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_CTRL_FS_MASK (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_CTRL3_C_BOOT (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_FIFO_CTRL5_CONTINUOUS_MODE (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_FIFO_CTRL5_FIFO_ODR_SHIFT (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_FIFO_CTRL3_GYRO_DEC_SHIFT (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_FUNC_CFG_ACCESS (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_FIFO_CTRL1 (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_FIFO_CTRL2 (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_FIFO_CTRL3 (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_FIFO_CTRL4 (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_FIFO_CTRL5 (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_INT1_CTRL (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_INT2_CTRL (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_WHO_AM_I (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_CTRL1_XL (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_CTRL2_G (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_CTRL3_C (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_CTRL4_C (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_CTRL5_C (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_CTRL6_C (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_CTRL7_G (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_CTRL8_XL (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_CTRL9_XL (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_CTRL10_C (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_WAKE_UP_SRC (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_TAP_SRC (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_D6D_SRC (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_STATUS_REG (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_OUT_TEMP_L (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_OUT_TEMP_H (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_OUTX_L_G (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_OUTX_H_G (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_OUTY_L_G (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_OUTY_H_G (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_OUTZ_L_G (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_OUTZ_H_G (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_OUTX_L_XL (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_OUTX_H_XL (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_OUTY_L_XL (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_OUTY_H_XL (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_OUTZ_L_XL (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_OUTZ_H_XL (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_FIFO_STATUS1 (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_FIFO_STATUS2 (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_FIFO_STATUS3 (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_FIFO_STATUS4 (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_FIFO_DATA_OUT_L (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_FIFO_DATA_OUT_H (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_TIMESTAMP0_REG (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_TIMESTAMP1_REG (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_TIMESTAMP2_REG (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_STEP_TIMESTAMP_L (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_STEP_TIMESTAMP_H (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_STEP_COUNTER_L (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_STEP_COUNTER_H (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_FUNC_SR_1 (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_TAP_CFG (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_TAP_THS_6D (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_INT_DUR2 (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_WAKE_UP_THS (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_WAKE_UP_DUR (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_FREE_FALL (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_MD1_CFG (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_REG_MD2_CFG (macro definition) of file lsm6dsxx_internal.h is not documented.
|
||||
warning: Member LSM6DSXX_PARAM_I2C (macro definition) of file lsm6dsxx_params.h is not documented.
|
||||
warning: Member LSM6DSXX_PARAM_ADDR (macro definition) of file lsm6dsxx_params.h is not documented.
|
||||
warning: Member LSM6DSXX_PARAM_ACC_ODR (macro definition) of file lsm6dsxx_params.h is not documented.
|
||||
warning: Member LSM6DSXX_PARAM_GYRO_ODR (macro definition) of file lsm6dsxx_params.h is not documented.
|
||||
warning: Member LSM6DSXX_PARAM_ACC_FS (macro definition) of file lsm6dsxx_params.h is not documented.
|
||||
warning: Member LSM6DSXX_PARAM_GYRO_FS (macro definition) of file lsm6dsxx_params.h is not documented.
|
||||
warning: Member LSM6DSXX_PARAM_ACC_FIFO_DEC (macro definition) of file lsm6dsxx_params.h is not documented.
|
||||
warning: Member LSM6DSXX_PARAM_GYRO_FIFO_DEC (macro definition) of file lsm6dsxx_params.h is not documented.
|
||||
warning: Member LSM6DSXX_PARAMS (macro definition) of file lsm6dsxx_params.h is not documented.
|
||||
warning: Member LSM6DSXX_SAUL_INFO (macro definition) of file lsm6dsxx_params.h is not documented.
|
||||
|
@ -105,7 +105,7 @@ rsource "lis3mdl/Kconfig"
|
||||
rsource "lm75/Kconfig"
|
||||
rsource "lpd8808/Kconfig"
|
||||
rsource "lpsxxx/Kconfig"
|
||||
rsource "lsm6dsl/Kconfig"
|
||||
rsource "lsm6dsxx/Kconfig"
|
||||
rsource "lsm303dlhc/Kconfig"
|
||||
rsource "lsm303agr/Kconfig"
|
||||
rsource "ltc4150/Kconfig"
|
||||
|
@ -96,6 +96,10 @@ ifneq (,$(filter lps331ap lps2%,$(USEMODULE)))
|
||||
USEMODULE += lpsxxx
|
||||
endif
|
||||
|
||||
ifneq (,$(filter lsm6ds%,$(USEMODULE)))
|
||||
USEMODULE += lsm6dsxx
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ltc4150_%,$(USEMODULE)))
|
||||
USEMODULE += ltc4150
|
||||
endif
|
||||
|
@ -8,24 +8,24 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup drivers_lsm6dsl LSM6DSL 3D accelerometer/gyroscope
|
||||
* @defgroup drivers_lsm6dsxx LSM6DSXX 3D accelerometer/gyroscope
|
||||
* @ingroup drivers_sensors
|
||||
* @ingroup drivers_saul
|
||||
* @brief Device driver for the LSM6DSL 3D accelerometer/gyroscope
|
||||
* @brief Device driver for the LSM6DSXX 3D accelerometer/gyroscope
|
||||
*
|
||||
* This driver provides @ref drivers_saul capabilities.
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Device driver interface for the LSM6DSL 3D accelerometer/gyroscope.
|
||||
* @brief Device driver interface for the LSM6DSXX 3D accelerometer/gyroscope.
|
||||
*
|
||||
* @author Vincent Dupont <vincent@otakeys.com>
|
||||
* @author Sebastian Meiling <s@mlng.net>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LSM6DSL_H
|
||||
#define LSM6DSL_H
|
||||
#ifndef LSM6DSXX_H
|
||||
#define LSM6DSXX_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -37,58 +37,58 @@ extern "C" {
|
||||
* @brief Data rate settings
|
||||
*/
|
||||
enum {
|
||||
LSM6DSL_DATA_RATE_POWER_DOWN = 0x0,
|
||||
LSM6DSL_DATA_RATE_1_6HZ = 0xB,
|
||||
LSM6DSL_DATA_RATE_12_5HZ = 0x1,
|
||||
LSM6DSL_DATA_RATE_26HZ = 0x2,
|
||||
LSM6DSL_DATA_RATE_52HZ = 0x3,
|
||||
LSM6DSL_DATA_RATE_104HZ = 0x4,
|
||||
LSM6DSL_DATA_RATE_208HZ = 0x5,
|
||||
LSM6DSL_DATA_RATE_416HZ = 0x6,
|
||||
LSM6DSL_DATA_RATE_833HZ = 0x7,
|
||||
LSM6DSL_DATA_RATE_1_66KHZ = 0x8,
|
||||
LSM6DSL_DATA_RATE_3_33KHZ = 0x9,
|
||||
LSM6DSL_DATA_RATE_6_66KHZ = 0xa,
|
||||
LSM6DSXX_DATA_RATE_POWER_DOWN = 0x0,
|
||||
LSM6DSXX_DATA_RATE_1_6HZ = 0xB,
|
||||
LSM6DSXX_DATA_RATE_12_5HZ = 0x1,
|
||||
LSM6DSXX_DATA_RATE_26HZ = 0x2,
|
||||
LSM6DSXX_DATA_RATE_52HZ = 0x3,
|
||||
LSM6DSXX_DATA_RATE_104HZ = 0x4,
|
||||
LSM6DSXX_DATA_RATE_208HZ = 0x5,
|
||||
LSM6DSXX_DATA_RATE_416HZ = 0x6,
|
||||
LSM6DSXX_DATA_RATE_833HZ = 0x7,
|
||||
LSM6DSXX_DATA_RATE_1_66KHZ = 0x8,
|
||||
LSM6DSXX_DATA_RATE_3_33KHZ = 0x9,
|
||||
LSM6DSXX_DATA_RATE_6_66KHZ = 0xa,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Decimation settings
|
||||
*/
|
||||
enum {
|
||||
LSM6DSL_DECIMATION_NOT_IN_FIFO = 0,
|
||||
LSM6DSL_DECIMATION_NO,
|
||||
LSM6DSL_DECIMATION_2,
|
||||
LSM6DSL_DECIMATION_3,
|
||||
LSM6DSL_DECIMATION_4,
|
||||
LSM6DSL_DECIMATION_8,
|
||||
LSM6DSL_DECIMATION_16,
|
||||
LSM6DSL_DECIMATION_32,
|
||||
LSM6DSXX_DECIMATION_NOT_IN_FIFO = 0,
|
||||
LSM6DSXX_DECIMATION_NO,
|
||||
LSM6DSXX_DECIMATION_2,
|
||||
LSM6DSXX_DECIMATION_3,
|
||||
LSM6DSXX_DECIMATION_4,
|
||||
LSM6DSXX_DECIMATION_8,
|
||||
LSM6DSXX_DECIMATION_16,
|
||||
LSM6DSXX_DECIMATION_32,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Accelerometer full scale
|
||||
*/
|
||||
enum {
|
||||
LSM6DSL_ACC_FS_2G = 0,
|
||||
LSM6DSL_ACC_FS_16G,
|
||||
LSM6DSL_ACC_FS_4G,
|
||||
LSM6DSL_ACC_FS_8G,
|
||||
LSM6DSL_ACC_FS_MAX,
|
||||
LSM6DSXX_ACC_FS_2G = 0,
|
||||
LSM6DSXX_ACC_FS_16G,
|
||||
LSM6DSXX_ACC_FS_4G,
|
||||
LSM6DSXX_ACC_FS_8G,
|
||||
LSM6DSXX_ACC_FS_MAX,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Gyroscope full scale
|
||||
*/
|
||||
enum {
|
||||
LSM6DSL_GYRO_FS_245DPS = 0,
|
||||
LSM6DSL_GYRO_FS_500DPS,
|
||||
LSM6DSL_GYRO_FS_1000DPS,
|
||||
LSM6DSL_GYRO_FS_2000DPS,
|
||||
LSM6DSL_GYRO_FS_MAX,
|
||||
LSM6DSXX_GYRO_FS_245DPS = 0,
|
||||
LSM6DSXX_GYRO_FS_500DPS,
|
||||
LSM6DSXX_GYRO_FS_1000DPS,
|
||||
LSM6DSXX_GYRO_FS_2000DPS,
|
||||
LSM6DSXX_GYRO_FS_MAX,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief LSM6DSL driver parameters
|
||||
* @brief LSM6DSXX driver parameters
|
||||
*/
|
||||
typedef struct {
|
||||
i2c_t i2c; /**< i2c bus */
|
||||
@ -99,14 +99,14 @@ typedef struct {
|
||||
uint8_t gyro_fs; /**< gyroscope full scale */
|
||||
uint8_t acc_decimation; /**< accelerometer decimation */
|
||||
uint8_t gyro_decimation; /**< gyroscope decimation */
|
||||
} lsm6dsl_params_t;
|
||||
} lsm6dsxx_params_t;
|
||||
|
||||
/**
|
||||
* @brief LSM6DSL device descriptor
|
||||
* @brief LSM6DSXX device descriptor
|
||||
*/
|
||||
typedef struct {
|
||||
lsm6dsl_params_t params; /**< driver parameters */
|
||||
} lsm6dsl_t;
|
||||
lsm6dsxx_params_t params; /**< driver parameters */
|
||||
} lsm6dsxx_t;
|
||||
|
||||
/**
|
||||
* @brief 3D output data
|
||||
@ -115,28 +115,28 @@ typedef struct {
|
||||
int16_t x; /**< X axis */
|
||||
int16_t y; /**< Y axis */
|
||||
int16_t z; /**< Z axis */
|
||||
} lsm6dsl_3d_data_t;
|
||||
} lsm6dsxx_3d_data_t;
|
||||
|
||||
/**
|
||||
* @brief Named return values
|
||||
*/
|
||||
enum {
|
||||
LSM6DSL_OK = 0, /**< all good */
|
||||
LSM6DSL_ERROR_BUS, /**< I2C bus error */
|
||||
LSM6DSL_ERROR_CNF, /**< Config error */
|
||||
LSM6DSL_ERROR_DEV, /**< device error */
|
||||
LSM6DSXX_OK = 0, /**< all good */
|
||||
LSM6DSXX_ERROR_BUS, /**< I2C bus error */
|
||||
LSM6DSXX_ERROR_CNF, /**< Config error */
|
||||
LSM6DSXX_ERROR_DEV, /**< device error */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Initialize a LSM6DSL device
|
||||
* @brief Initialize a LSM6DSXX device
|
||||
*
|
||||
* @param[out] dev device to initialize
|
||||
* @param[in] params driver parameters
|
||||
*
|
||||
* @return LSM6DSL_OK on success
|
||||
* @return LSM6DSXX_OK on success
|
||||
* @return < 0 on error
|
||||
*/
|
||||
int lsm6dsl_init(lsm6dsl_t *dev, const lsm6dsl_params_t *params);
|
||||
int lsm6dsxx_init(lsm6dsxx_t *dev, const lsm6dsxx_params_t *params);
|
||||
|
||||
/**
|
||||
* @brief Read accelerometer data
|
||||
@ -144,10 +144,10 @@ int lsm6dsl_init(lsm6dsl_t *dev, const lsm6dsl_params_t *params);
|
||||
* @param[in] dev device to read
|
||||
* @param[out] data accelerometer values
|
||||
*
|
||||
* @return LSM6DSL_OK on success
|
||||
* @return LSM6DSXX_OK on success
|
||||
* @return < 0 on error
|
||||
*/
|
||||
int lsm6dsl_read_acc(const lsm6dsl_t *dev, lsm6dsl_3d_data_t *data);
|
||||
int lsm6dsxx_read_acc(const lsm6dsxx_t *dev, lsm6dsxx_3d_data_t *data);
|
||||
|
||||
/**
|
||||
* @brief Read gyroscope data
|
||||
@ -155,10 +155,10 @@ int lsm6dsl_read_acc(const lsm6dsl_t *dev, lsm6dsl_3d_data_t *data);
|
||||
* @param[in] dev device to read
|
||||
* @param[out] data gyroscope values
|
||||
*
|
||||
* @return LSM6DSL_OK on success
|
||||
* @return LSM6DSXX_OK on success
|
||||
* @return < 0 on error
|
||||
*/
|
||||
int lsm6dsl_read_gyro(const lsm6dsl_t *dev, lsm6dsl_3d_data_t *data);
|
||||
int lsm6dsxx_read_gyro(const lsm6dsxx_t *dev, lsm6dsxx_3d_data_t *data);
|
||||
|
||||
/**
|
||||
* @brief Read temperature data
|
||||
@ -170,54 +170,54 @@ int lsm6dsl_read_gyro(const lsm6dsl_t *dev, lsm6dsl_3d_data_t *data);
|
||||
* @param[in] dev device to read
|
||||
* @param[out] data temperature value, in °C x 100
|
||||
*
|
||||
* @return LSM6DSL_OK on success
|
||||
* @return LSM6DSXX_OK on success
|
||||
* @return < 0 on error
|
||||
*/
|
||||
int lsm6dsl_read_temp(const lsm6dsl_t *dev, int16_t *data);
|
||||
int lsm6dsxx_read_temp(const lsm6dsxx_t *dev, int16_t *data);
|
||||
|
||||
/**
|
||||
* @brief Power down accelerometer
|
||||
*
|
||||
* @param[in] dev device to power down
|
||||
*
|
||||
* @return LSM6DSL_OK on success
|
||||
* @return LSM6DSXX_OK on success
|
||||
* @return < 0 on error
|
||||
*/
|
||||
int lsm6dsl_acc_power_down(const lsm6dsl_t *dev);
|
||||
int lsm6dsxx_acc_power_down(const lsm6dsxx_t *dev);
|
||||
|
||||
/**
|
||||
* @brief Power down gyroscope
|
||||
*
|
||||
* @param[in] dev device to power down
|
||||
*
|
||||
* @return LSM6DSL_OK on success
|
||||
* @return LSM6DSXX_OK on success
|
||||
* @return < 0 on error
|
||||
*/
|
||||
int lsm6dsl_gyro_power_down(const lsm6dsl_t *dev);
|
||||
int lsm6dsxx_gyro_power_down(const lsm6dsxx_t *dev);
|
||||
|
||||
/**
|
||||
* @brief Power up accelerometer
|
||||
*
|
||||
* @param[in] dev device to power up
|
||||
*
|
||||
* @return LSM6DSL_OK on success
|
||||
* @return LSM6DSXX_OK on success
|
||||
* @return < 0 on error
|
||||
*/
|
||||
int lsm6dsl_acc_power_up(const lsm6dsl_t *dev);
|
||||
int lsm6dsxx_acc_power_up(const lsm6dsxx_t *dev);
|
||||
|
||||
/**
|
||||
* @brief Power up gyroscope
|
||||
*
|
||||
* @param[in] dev device to power up
|
||||
*
|
||||
* @return LSM6DSL_OK on success
|
||||
* @return LSM6DSXX_OK on success
|
||||
* @return < 0 on error
|
||||
*/
|
||||
int lsm6dsl_gyro_power_up(const lsm6dsl_t *dev);
|
||||
int lsm6dsxx_gyro_power_up(const lsm6dsxx_t *dev);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LSM6DSL_H */
|
||||
#endif /* LSM6DSXX_H */
|
||||
/** @} */
|
@ -1,2 +0,0 @@
|
||||
USEMODULE_INCLUDES_lsm6dsl := $(LAST_MAKEFILEDIR)/include
|
||||
USEMODULE_INCLUDES += $(USEMODULE_INCLUDES_lsm6dsl)
|
@ -1,169 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 OTA keys S.A.
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup drivers_lsm6dsl
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Internal configuration for LSM6DSL devices
|
||||
*
|
||||
* @author Vincent Dupont <vincent@otakeys.com>
|
||||
* @author Sebastian Meiling <s@mlng.net>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LSM6DSL_INTERNAL_H
|
||||
#define LSM6DSL_INTERNAL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name LSM6DSL registers
|
||||
* @{
|
||||
*/
|
||||
#define LSM6DSL_REG_FUNC_CFG_ACCESS (0x01)
|
||||
#define LSM6DSL_REG_SENSOR_SYNC_TIME_FRAME (0x04)
|
||||
#define LSM6DSL_REG_SENSOR_SYC_RES_RATIO (0x05)
|
||||
#define LSM6DSL_REG_FIFO_CTRL1 (0x06)
|
||||
#define LSM6DSL_REG_FIFO_CTRL2 (0x07)
|
||||
#define LSM6DSL_REG_FIFO_CTRL3 (0x08)
|
||||
#define LSM6DSL_REG_FIFO_CTRL4 (0x09)
|
||||
#define LSM6DSL_REG_FIFO_CTRL5 (0x0A)
|
||||
#define LSM6DSL_REG_DRDY_PULSE_CFG_G (0x0B)
|
||||
#define LSM6DSL_REG_INT1_CTRL (0x0D)
|
||||
#define LSM6DSL_REG_INT2_CTRL (0x0E)
|
||||
#define LSM6DSL_REG_WHO_AM_I (0x0F)
|
||||
#define LSM6DSL_REG_CTRL1_XL (0x10)
|
||||
#define LSM6DSL_REG_CTRL2_G (0x11)
|
||||
#define LSM6DSL_REG_CTRL3_C (0x12)
|
||||
#define LSM6DSL_REG_CTRL4_C (0x13)
|
||||
#define LSM6DSL_REG_CTRL5_C (0x14)
|
||||
#define LSM6DSL_REG_CTRL6_C (0x15)
|
||||
#define LSM6DSL_REG_CTRL7_G (0x16)
|
||||
#define LSM6DSL_REG_CTRL8_XL (0x17)
|
||||
#define LSM6DSL_REG_CTRL9_XL (0x18)
|
||||
#define LSM6DSL_REG_CTRL10_C (0x19)
|
||||
#define LSM6DSL_REG_MASTER_CONFIG (0x1A)
|
||||
#define LSM6DSL_REG_WAKE_UP_SRC (0x1B)
|
||||
#define LSM6DSL_REG_TAP_SRC (0x1C)
|
||||
#define LSM6DSL_REG_D6D_SRC (0x1D)
|
||||
#define LSM6DSL_REG_STATUS_REG (0x1E)
|
||||
#define LSM6DSL_REG_OUT_TEMP_L (0x20)
|
||||
#define LSM6DSL_REG_OUT_TEMP_H (0x21)
|
||||
#define LSM6DSL_REG_OUTX_L_G (0x22)
|
||||
#define LSM6DSL_REG_OUTX_H_G (0x23)
|
||||
#define LSM6DSL_REG_OUTY_L_G (0x24)
|
||||
#define LSM6DSL_REG_OUTY_H_G (0x25)
|
||||
#define LSM6DSL_REG_OUTZ_L_G (0x26)
|
||||
#define LSM6DSL_REG_OUTZ_H_G (0x27)
|
||||
#define LSM6DSL_REG_OUTX_L_XL (0x28)
|
||||
#define LSM6DSL_REG_OUTX_H_XL (0x29)
|
||||
#define LSM6DSL_REG_OUTY_L_XL (0x2A)
|
||||
#define LSM6DSL_REG_OUTY_H_XL (0x2B)
|
||||
#define LSM6DSL_REG_OUTZ_L_XL (0x2C)
|
||||
#define LSM6DSL_REG_OUTZ_H_XL (0x2D)
|
||||
#define LSM6DSL_REG_SENSORHUB1_REG (0x2E)
|
||||
#define LSM6DSL_REG_SENSORHUB2_REG (0x2F)
|
||||
#define LSM6DSL_REG_SENSORHUB3_REG (0x30)
|
||||
#define LSM6DSL_REG_SENSORHUB4_REG (0x31)
|
||||
#define LSM6DSL_REG_SENSORHUB5_REG (0x32)
|
||||
#define LSM6DSL_REG_SENSORHUB6_REG (0x33)
|
||||
#define LSM6DSL_REG_SENSORHUB7_REG (0x34)
|
||||
#define LSM6DSL_REG_SENSORHUB8_REG (0x35)
|
||||
#define LSM6DSL_REG_SENSORHUB9_REG (0x36)
|
||||
#define LSM6DSL_REG_SENSORHUB10_REG (0x37)
|
||||
#define LSM6DSL_REG_SENSORHUB11_REG (0x38)
|
||||
#define LSM6DSL_REG_SENSORHUB12_REG (0x39)
|
||||
#define LSM6DSL_REG_FIFO_STATUS1 (0x3A)
|
||||
#define LSM6DSL_REG_FIFO_STATUS2 (0x3B)
|
||||
#define LSM6DSL_REG_FIFO_STATUS3 (0x3C)
|
||||
#define LSM6DSL_REG_FIFO_STATUS4 (0x3D)
|
||||
#define LSM6DSL_REG_FIFO_DATA_OUT_L (0x3E)
|
||||
#define LSM6DSL_REG_FIFO_DATA_OUT_H (0x3F)
|
||||
#define LSM6DSL_REG_TIMESTAMP0_REG (0x40)
|
||||
#define LSM6DSL_REG_TIMESTAMP1_REG (0x41)
|
||||
#define LSM6DSL_REG_TIMESTAMP2_REG (0x42)
|
||||
#define LSM6DSL_REG_STEP_TIMESTAMP_L (0x49)
|
||||
#define LSM6DSL_REG_STEP_TIMESTAMP_H (0x4A)
|
||||
#define LSM6DSL_REG_STEP_COUNTER_L (0x4B)
|
||||
#define LSM6DSL_REG_STEP_COUNTER_H (0x4C)
|
||||
#define LSM6DSL_REG_SENSORHUB13_REG (0x4D)
|
||||
#define LSM6DSL_REG_SENSORHUB14_REG (0x4E)
|
||||
#define LSM6DSL_REG_SENSORHUB15_REG (0x4F)
|
||||
#define LSM6DSL_REG_SENSORHUB16_REG (0x50)
|
||||
#define LSM6DSL_REG_SENSORHUB17_REG (0x51)
|
||||
#define LSM6DSL_REG_SENSORHUB18_REG (0x52)
|
||||
#define LSM6DSL_REG_FUNC_SRC_1 (0x53)
|
||||
#define LSM6DSL_REG_FUNC_SRC_2 (0x54)
|
||||
#define LSM6DSL_REG_WRIST_TILT_IA (0x55)
|
||||
#define LSM6DSL_REG_TAP_CFG (0x58)
|
||||
#define LSM6DSL_REG_TAP_THS_6D (0x59)
|
||||
#define LSM6DSL_REG_INT_DUR2 (0x5A)
|
||||
#define LSM6DSL_REG_WAKE_UP_THS (0x5B)
|
||||
#define LSM6DSL_REG_WAKE_UP_DUR (0x5C)
|
||||
#define LSM6DSL_REG_FREE_FALL (0x5D)
|
||||
#define LSM6DSL_REG_MD1_CFG (0x5E)
|
||||
#define LSM6DSL_REG_MD2_CFG (0x5F)
|
||||
#define LSM6DSL_REG_MASTER_CMD_CODE (0x60)
|
||||
#define LSM6DSL_REG_SENS_SYNC_SPI_ERR_CODE (0x61)
|
||||
#define LSM6DSL_REG_OUT_MAG_RAW_X_L (0x66)
|
||||
#define LSM6DSL_REG_OUT_MAG_RAW_X_H (0x67)
|
||||
#define LSM6DSL_REG_OUT_MAG_RAW_Y_L (0x68)
|
||||
#define LSM6DSL_REG_OUT_MAG_RAW_Y_H (0x69)
|
||||
#define LSM6DSL_REG_OUT_MAG_RAW_Z_L (0x6A)
|
||||
#define LSM6DSL_REG_OUT_MAG_RAW_Z_H (0x6B)
|
||||
#define LSM6DSL_REG_X_OFS_USR (0x73)
|
||||
#define LSM6DSL_REG_Y_OFS_USR (0x74)
|
||||
#define LSM6DSL_REG_Z_OFS_USR (0x75)
|
||||
/** @} */
|
||||
|
||||
/** WHO_AM_I value */
|
||||
#define LSM6DSL_WHO_AM_I (0b01101010)
|
||||
|
||||
/**
|
||||
* @name CTRL_x registers
|
||||
* @{
|
||||
*/
|
||||
#define LSM6DSL_CTRL_ODR_SHIFT (4)
|
||||
#define LSM6DSL_CTRL_ODR_MASK (0xF0)
|
||||
#define LSM6DSL_CTRL_FS_SHIFT (2)
|
||||
#define LSM6DSL_CTRL_FS_MASK (0x0C)
|
||||
|
||||
#define LSM6DSL_CTRL3_C_BOOT (0x80)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name FIFO_CTRL_x registers
|
||||
* @{
|
||||
*/
|
||||
#define LSM6DSL_FIFO_CTRL5_CONTINUOUS_MODE (0x6)
|
||||
#define LSM6DSL_FIFO_CTRL5_FIFO_ODR_SHIFT (3)
|
||||
|
||||
#define LSM6DSL_FIFO_CTRL3_GYRO_DEC_SHIFT (3)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Offset for temperature calculation
|
||||
*/
|
||||
#define LSM6DSL_TEMP_OFFSET (0x1900)
|
||||
|
||||
/**
|
||||
* @brief Reboot wait interval in ms (15ms)
|
||||
*/
|
||||
#define LSM6DSL_BOOT_WAIT_MS (15)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LSM6DSL_INTERNAL_H */
|
||||
/** @} */
|
@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 OTA keys S.A.
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup drivers_lsm6dsl
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Default configuration for LSM6DSL devices
|
||||
*
|
||||
* @author Vincent Dupont <vincent@otakeys.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LSM6DSL_PARAMS_H
|
||||
#define LSM6DSL_PARAMS_H
|
||||
|
||||
#include "board.h"
|
||||
#include "lsm6dsl.h"
|
||||
#include "saul_reg.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name Set default configuration parameters
|
||||
* @{
|
||||
*/
|
||||
#ifndef LSM6DSL_PARAM_I2C
|
||||
#define LSM6DSL_PARAM_I2C I2C_DEV(0)
|
||||
#endif
|
||||
#ifndef LSM6DSL_PARAM_ADDR
|
||||
#define LSM6DSL_PARAM_ADDR (0x6B) /* (0x6A) */
|
||||
#endif
|
||||
#ifndef LSM6DSL_PARAM_ACC_ODR
|
||||
#define LSM6DSL_PARAM_ACC_ODR (LSM6DSL_DATA_RATE_52HZ)
|
||||
#endif
|
||||
#ifndef LSM6DSL_PARAM_GYRO_ODR
|
||||
#define LSM6DSL_PARAM_GYRO_ODR (LSM6DSL_DATA_RATE_52HZ)
|
||||
#endif
|
||||
#ifndef LSM6DSL_PARAM_ACC_FS
|
||||
#define LSM6DSL_PARAM_ACC_FS (LSM6DSL_ACC_FS_2G)
|
||||
#endif
|
||||
#ifndef LSM6DSL_PARAM_GYRO_FS
|
||||
#define LSM6DSL_PARAM_GYRO_FS (LSM6DSL_GYRO_FS_245DPS)
|
||||
#endif
|
||||
#ifndef LSM6DSL_PARAM_ACC_FIFO_DEC
|
||||
#define LSM6DSL_PARAM_ACC_FIFO_DEC (LSM6DSL_DECIMATION_NO)
|
||||
#endif
|
||||
#ifndef LSM6DSL_PARAM_GYRO_FIFO_DEC
|
||||
#define LSM6DSL_PARAM_GYRO_FIFO_DEC (LSM6DSL_DECIMATION_NO)
|
||||
#endif
|
||||
|
||||
#ifndef LSM6DSL_PARAMS
|
||||
#define LSM6DSL_PARAMS { .i2c = LSM6DSL_PARAM_I2C, \
|
||||
.addr = LSM6DSL_PARAM_ADDR, \
|
||||
.acc_odr = LSM6DSL_PARAM_ACC_ODR, \
|
||||
.gyro_odr = LSM6DSL_PARAM_GYRO_ODR, \
|
||||
.acc_fs = LSM6DSL_PARAM_ACC_FS, \
|
||||
.gyro_fs = LSM6DSL_PARAM_GYRO_FS, \
|
||||
.acc_decimation = LSM6DSL_PARAM_ACC_FIFO_DEC, \
|
||||
.gyro_decimation = LSM6DSL_PARAM_GYRO_FIFO_DEC }
|
||||
#endif
|
||||
#ifndef LSM6DSL_SAUL_INFO
|
||||
#define LSM6DSL_SAUL_INFO { .name = "lsm6dsl" }
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Allocate some memory to store the actual configuration
|
||||
*/
|
||||
static const lsm6dsl_params_t lsm6dsl_params[] =
|
||||
{
|
||||
LSM6DSL_PARAMS
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Additional meta information to keep in the SAUL registry
|
||||
*/
|
||||
static const saul_reg_info_t lsm6dsl_saul_info[] =
|
||||
{
|
||||
LSM6DSL_SAUL_INFO
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LSM6DSL_PARAMS_H */
|
||||
/** @} */
|
@ -1,303 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 OTA keys S.A.
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup drivers_lsm6dsl
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Device driver implementation for the LSM6DSL 3D accelerometer/gyroscope.
|
||||
*
|
||||
* @author Vincent Dupont <vincent@otakeys.com>
|
||||
* @author Sebastian Meiling <s@mlng.net>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "ztimer.h"
|
||||
#include "macros/utils.h"
|
||||
|
||||
#include "lsm6dsl.h"
|
||||
#include "lsm6dsl_internal.h"
|
||||
|
||||
#define ENABLE_DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
#define BUS (dev->params.i2c)
|
||||
#define ADDR (dev->params.addr)
|
||||
|
||||
/**
|
||||
* order in array [0, 1, 2, 3] is
|
||||
* LSM6DSL_ACC_FS_2G, LSM6DSL_ACC_FS_16G, LSM6DSL_ACC_FS_4G, LSM6DSL_ACC_FS_8G
|
||||
*/
|
||||
static const int16_t range_acc[] = { 2000, 16000, 4000, 8000 };
|
||||
|
||||
/**
|
||||
* order in array [0, 1, 2, 3] is
|
||||
* LSM6DSL_GYRO_FS_245DPS, LSM6DSL_GYRO_FS_500DPS,
|
||||
* LSM6DSL_GYRO_FS_1000DPS, LSM6DSL_GYRO_FS_2000DPS
|
||||
*/
|
||||
static const int16_t range_gyro[] = { 2450, 5000, 10000, 20000 };
|
||||
|
||||
int lsm6dsl_init(lsm6dsl_t *dev, const lsm6dsl_params_t *params)
|
||||
{
|
||||
uint8_t tmp;
|
||||
int res;
|
||||
|
||||
assert(dev && params);
|
||||
|
||||
dev->params = *params;
|
||||
|
||||
i2c_acquire(BUS);
|
||||
|
||||
/* Reboot */
|
||||
i2c_write_reg(BUS, ADDR, LSM6DSL_REG_CTRL3_C, LSM6DSL_CTRL3_C_BOOT, 0);
|
||||
|
||||
ztimer_sleep(ZTIMER_MSEC, LSM6DSL_BOOT_WAIT_MS);
|
||||
|
||||
if (i2c_read_reg(BUS, ADDR, LSM6DSL_REG_WHO_AM_I, &tmp, 0) < 0) {
|
||||
i2c_release(BUS);
|
||||
DEBUG("[ERROR] lsm6dsl_init: i2c_read_reg LSM6DSL_REG_WHO_AM_I!\n");
|
||||
return -LSM6DSL_ERROR_BUS;
|
||||
}
|
||||
|
||||
if (tmp != LSM6DSL_WHO_AM_I) {
|
||||
DEBUG("[ERROR] lsm6dsl_init: WHO_AM_I\n");
|
||||
return -LSM6DSL_ERROR_DEV;
|
||||
}
|
||||
|
||||
/* Set acc odr / full scale */
|
||||
tmp = (dev->params.acc_odr << LSM6DSL_CTRL_ODR_SHIFT) |
|
||||
(dev->params.acc_fs << LSM6DSL_CTRL_FS_SHIFT);
|
||||
res = i2c_write_reg(BUS, ADDR, LSM6DSL_REG_CTRL1_XL, tmp, 0);
|
||||
/* Set gyro odr / full scale */
|
||||
tmp = (dev->params.gyro_odr << LSM6DSL_CTRL_ODR_SHIFT) |
|
||||
(dev->params.gyro_fs << LSM6DSL_CTRL_FS_SHIFT);
|
||||
res += i2c_write_reg(BUS, ADDR, LSM6DSL_REG_CTRL2_G, tmp, 0);
|
||||
/* Set continuous mode */
|
||||
uint8_t fifo_odr = MAX(dev->params.acc_odr, dev->params.gyro_odr);
|
||||
tmp = (fifo_odr << LSM6DSL_FIFO_CTRL5_FIFO_ODR_SHIFT) |
|
||||
LSM6DSL_FIFO_CTRL5_CONTINUOUS_MODE;
|
||||
res += i2c_write_reg(BUS, ADDR, LSM6DSL_REG_FIFO_CTRL5, tmp, 0);
|
||||
tmp = (dev->params.gyro_decimation << LSM6DSL_FIFO_CTRL3_GYRO_DEC_SHIFT) |
|
||||
dev->params.acc_decimation;
|
||||
res += i2c_write_reg(BUS, ADDR, LSM6DSL_REG_FIFO_CTRL3, tmp, 0);
|
||||
|
||||
i2c_release(BUS);
|
||||
|
||||
if (res < 0) {
|
||||
DEBUG("[ERROR] lsm6dsl_init: config\n");
|
||||
return -LSM6DSL_ERROR_CNF;
|
||||
}
|
||||
return LSM6DSL_OK;
|
||||
}
|
||||
|
||||
int lsm6dsl_read_acc(const lsm6dsl_t *dev, lsm6dsl_3d_data_t *data)
|
||||
{
|
||||
int res;
|
||||
uint8_t tmp;
|
||||
|
||||
i2c_acquire(BUS);
|
||||
i2c_read_reg(BUS, ADDR, LSM6DSL_REG_STATUS_REG, &tmp, 0);
|
||||
DEBUG("lsm6dsl status: %x\n", tmp);
|
||||
|
||||
res = i2c_read_reg(BUS, ADDR, LSM6DSL_REG_OUTX_L_XL, &tmp, 0);
|
||||
data->x = tmp;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSL_REG_OUTX_H_XL, &tmp, 0);
|
||||
data->x |= tmp << 8;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSL_REG_OUTY_L_XL, &tmp, 0);
|
||||
data->y = tmp;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSL_REG_OUTY_H_XL, &tmp, 0);
|
||||
data->y |= tmp << 8;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSL_REG_OUTZ_L_XL, &tmp, 0);
|
||||
data->z = tmp;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSL_REG_OUTZ_H_XL, &tmp, 0);
|
||||
data->z |= tmp << 8;
|
||||
i2c_release(BUS);
|
||||
|
||||
if (res < 0) {
|
||||
DEBUG("[ERROR] lsm6dsl_read_acc\n");
|
||||
return -LSM6DSL_ERROR_BUS;
|
||||
}
|
||||
|
||||
assert(dev->params.acc_fs < LSM6DSL_ACC_FS_MAX);
|
||||
data->x = ((int32_t)data->x * range_acc[dev->params.acc_fs]) / INT16_MAX;
|
||||
data->y = ((int32_t)data->y * range_acc[dev->params.acc_fs]) / INT16_MAX;
|
||||
data->z = ((int32_t)data->z * range_acc[dev->params.acc_fs]) / INT16_MAX;
|
||||
|
||||
return LSM6DSL_OK;
|
||||
}
|
||||
|
||||
int lsm6dsl_read_gyro(const lsm6dsl_t *dev, lsm6dsl_3d_data_t *data)
|
||||
{
|
||||
int res;
|
||||
uint8_t tmp;
|
||||
|
||||
i2c_acquire(BUS);
|
||||
i2c_read_reg(BUS, ADDR, LSM6DSL_REG_STATUS_REG, &tmp, 0);
|
||||
DEBUG("lsm6dsl status: %x\n", tmp);
|
||||
|
||||
res = i2c_read_reg(BUS, ADDR, LSM6DSL_REG_OUTX_L_G, &tmp, 0);
|
||||
data->x = tmp;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSL_REG_OUTX_H_G, &tmp, 0);
|
||||
data->x |= tmp << 8;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSL_REG_OUTY_L_G, &tmp, 0);
|
||||
data->y = tmp;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSL_REG_OUTY_H_G, &tmp, 0);
|
||||
data->y |= tmp << 8;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSL_REG_OUTZ_L_G, &tmp, 0);
|
||||
data->z = tmp;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSL_REG_OUTZ_H_G, &tmp, 0);
|
||||
data->z |= tmp << 8;
|
||||
i2c_release(BUS);
|
||||
|
||||
if (res < 0) {
|
||||
DEBUG("[ERROR] lsm6dsl_read_gyro\n");
|
||||
return -LSM6DSL_ERROR_BUS;
|
||||
}
|
||||
|
||||
assert(dev->params.gyro_fs < LSM6DSL_GYRO_FS_MAX);
|
||||
data->x = ((int32_t)data->x * range_gyro[dev->params.gyro_fs]) / INT16_MAX;
|
||||
data->y = ((int32_t)data->y * range_gyro[dev->params.gyro_fs]) / INT16_MAX;
|
||||
data->z = ((int32_t)data->z * range_gyro[dev->params.gyro_fs]) / INT16_MAX;
|
||||
|
||||
return LSM6DSL_OK;
|
||||
}
|
||||
|
||||
int lsm6dsl_read_temp(const lsm6dsl_t *dev, int16_t *data)
|
||||
{
|
||||
uint8_t tmp;
|
||||
uint16_t traw;
|
||||
/* read raw temperature */
|
||||
i2c_acquire(BUS);
|
||||
if (i2c_read_reg(BUS, ADDR, LSM6DSL_REG_OUT_TEMP_L, &tmp, 0) < 0) {
|
||||
i2c_release(BUS);
|
||||
return -LSM6DSL_ERROR_BUS;
|
||||
}
|
||||
traw = tmp;
|
||||
if (i2c_read_reg(BUS, ADDR, LSM6DSL_REG_OUT_TEMP_H, &tmp, 0) < 0) {
|
||||
i2c_release(BUS);
|
||||
return -LSM6DSL_ERROR_BUS;
|
||||
}
|
||||
traw |= (uint16_t)tmp << 8;
|
||||
i2c_release(BUS);
|
||||
/* convert temperature to degC x 100 */
|
||||
traw += LSM6DSL_TEMP_OFFSET;
|
||||
*data = (int16_t)(((int32_t)traw * 100) / 256);
|
||||
|
||||
return LSM6DSL_OK;
|
||||
}
|
||||
|
||||
int lsm6dsl_acc_power_down(const lsm6dsl_t *dev)
|
||||
{
|
||||
int res;
|
||||
uint8_t tmp;
|
||||
|
||||
i2c_acquire(BUS);
|
||||
res = i2c_read_reg(BUS, ADDR, LSM6DSL_REG_CTRL1_XL, &tmp, 0);
|
||||
if (res < 0) {
|
||||
i2c_release(BUS);
|
||||
DEBUG("[ERROR] lsm6dsl_acc_power_down\n");
|
||||
return -LSM6DSL_ERROR_BUS;
|
||||
}
|
||||
|
||||
tmp &= ~(LSM6DSL_CTRL_ODR_MASK);
|
||||
res = i2c_write_reg(BUS, ADDR, LSM6DSL_REG_CTRL1_XL, tmp, 0);
|
||||
|
||||
i2c_release(BUS);
|
||||
|
||||
if (res < 0) {
|
||||
DEBUG("[ERROR] lsm6dsl_acc_power_down\n");
|
||||
return -LSM6DSL_ERROR_BUS;
|
||||
}
|
||||
|
||||
return LSM6DSL_OK;
|
||||
}
|
||||
|
||||
int lsm6dsl_gyro_power_down(const lsm6dsl_t *dev)
|
||||
{
|
||||
int res;
|
||||
uint8_t tmp;
|
||||
|
||||
i2c_acquire(BUS);
|
||||
res = i2c_read_reg(BUS, ADDR, LSM6DSL_REG_CTRL2_G, &tmp, 0);
|
||||
if (res < 0) {
|
||||
i2c_release(BUS);
|
||||
DEBUG("[ERROR] lsm6dsl_gyro_power_down\n");
|
||||
return -LSM6DSL_ERROR_BUS;
|
||||
}
|
||||
|
||||
tmp &= ~(LSM6DSL_CTRL_ODR_MASK);
|
||||
res = i2c_write_reg(BUS, ADDR, LSM6DSL_REG_CTRL2_G, tmp, 0);
|
||||
|
||||
i2c_release(BUS);
|
||||
|
||||
if (res < 0) {
|
||||
DEBUG("[ERROR] lsm6dsl_gyro_power_down\n");
|
||||
return -LSM6DSL_ERROR_BUS;
|
||||
}
|
||||
|
||||
return LSM6DSL_OK;
|
||||
}
|
||||
|
||||
int lsm6dsl_acc_power_up(const lsm6dsl_t *dev)
|
||||
{
|
||||
int res;
|
||||
uint8_t tmp;
|
||||
|
||||
i2c_acquire(BUS);
|
||||
res = i2c_read_reg(BUS, ADDR, LSM6DSL_REG_CTRL1_XL, &tmp, 0);
|
||||
if (res < 0) {
|
||||
i2c_release(BUS);
|
||||
DEBUG("[ERROR] lsm6dsl_acc_power_up\n");
|
||||
return -LSM6DSL_ERROR_BUS;
|
||||
}
|
||||
|
||||
tmp &= ~(LSM6DSL_CTRL_ODR_MASK);
|
||||
tmp |= dev->params.acc_odr << LSM6DSL_CTRL_ODR_SHIFT;
|
||||
res = i2c_write_reg(BUS, ADDR, LSM6DSL_REG_CTRL1_XL, tmp, 0);
|
||||
|
||||
i2c_release(BUS);
|
||||
|
||||
if (res < 0) {
|
||||
DEBUG("[ERROR] lsm6dsl_acc_power_up\n");
|
||||
return -LSM6DSL_ERROR_BUS;
|
||||
}
|
||||
|
||||
return LSM6DSL_OK;
|
||||
}
|
||||
|
||||
int lsm6dsl_gyro_power_up(const lsm6dsl_t *dev)
|
||||
{
|
||||
int res;
|
||||
uint8_t tmp;
|
||||
|
||||
i2c_acquire(BUS);
|
||||
res = i2c_read_reg(BUS, ADDR, LSM6DSL_REG_CTRL2_G, &tmp, 0);
|
||||
if (res < 0) {
|
||||
i2c_release(BUS);
|
||||
DEBUG("[ERROR] lsm6dsl_gyro_power_up\n");
|
||||
return -LSM6DSL_ERROR_BUS;
|
||||
}
|
||||
|
||||
tmp &= ~(LSM6DSL_CTRL_ODR_MASK);
|
||||
tmp |= dev->params.gyro_odr << LSM6DSL_CTRL_ODR_SHIFT;
|
||||
res = i2c_write_reg(BUS, ADDR, LSM6DSL_REG_CTRL2_G, tmp, 0);
|
||||
|
||||
i2c_release(BUS);
|
||||
|
||||
if (res < 0) {
|
||||
DEBUG("[ERROR] lsm6dsl_gyro_power_up\n");
|
||||
return -LSM6DSL_ERROR_BUS;
|
||||
}
|
||||
|
||||
return LSM6DSL_OK;
|
||||
}
|
@ -5,17 +5,17 @@
|
||||
# directory for more details.
|
||||
#
|
||||
|
||||
config MODULE_LSM6DSL
|
||||
config MODULE_LSM6DSXX
|
||||
bool
|
||||
prompt "LSM6DSL 3D accelerometer/gyroscope" if !(MODULE_SAUL_DEFAULT && HAVE_LSM6DSL)
|
||||
default y if (MODULE_SAUL_DEFAULT && HAVE_LSM6DSL)
|
||||
prompt "LSM6DSXX 3D accelerometer/gyroscope" if !(MODULE_SAUL_DEFAULT && HAVE_LSM6DSXX)
|
||||
default y if (MODULE_SAUL_DEFAULT && HAVE_LSM6DSXX)
|
||||
depends on HAS_PERIPH_I2C
|
||||
depends on TEST_KCONFIG
|
||||
select MODULE_PERIPH_I2C
|
||||
select MODULE_ZTIMER
|
||||
select MODULE_ZTIMER_MSEC
|
||||
|
||||
config HAVE_LSM6DSL
|
||||
config HAVE_LSM6DSXX
|
||||
bool
|
||||
help
|
||||
Indicates that a lsm6dsl sensor is present.
|
||||
Indicates that a lsm6dsxx sensor is present.
|
6
drivers/lsm6dsxx/Makefile.include
Normal file
6
drivers/lsm6dsxx/Makefile.include
Normal file
@ -0,0 +1,6 @@
|
||||
#include variants of lsm6dsxx drivers as pseudo modules
|
||||
PSEUDOMODULES += lsm6dsl
|
||||
PSEUDOMODULES += lsm6ds33
|
||||
|
||||
USEMODULE_INCLUDES_lsm6dsxx := $(LAST_MAKEFILEDIR)/include
|
||||
USEMODULE_INCLUDES += $(USEMODULE_INCLUDES_lsm6dsxx)
|
198
drivers/lsm6dsxx/include/lsm6dsxx_internal.h
Normal file
198
drivers/lsm6dsxx/include/lsm6dsxx_internal.h
Normal file
@ -0,0 +1,198 @@
|
||||
/*
|
||||
* Copyright (C) 2017 OTA keys S.A.
|
||||
* Copyright (C) 2024 HAW Hamburg.
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup drivers_lsm6dsxx
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Internal configuration for LSM6DSXX devices
|
||||
*
|
||||
* @author Vincent Dupont <vincent@otakeys.com>
|
||||
* @author Sebastian Meiling <s@mlng.net>
|
||||
* @author Miquel Borrell <miquel.borrell@haw-hamburg.de>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LSM6DSXX_INTERNAL_H
|
||||
#define LSM6DSXX_INTERNAL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name LSM6DSXX registers
|
||||
* @{
|
||||
*/
|
||||
#define LSM6DSXX_REG_FUNC_CFG_ACCESS (0x01)
|
||||
#define LSM6DSXX_REG_FIFO_CTRL1 (0x06)
|
||||
#define LSM6DSXX_REG_FIFO_CTRL2 (0x07)
|
||||
#define LSM6DSXX_REG_FIFO_CTRL3 (0x08)
|
||||
#define LSM6DSXX_REG_FIFO_CTRL4 (0x09)
|
||||
#define LSM6DSXX_REG_FIFO_CTRL5 (0x0A)
|
||||
#define LSM6DSXX_REG_INT1_CTRL (0x0D)
|
||||
#define LSM6DSXX_REG_INT2_CTRL (0x0E)
|
||||
#define LSM6DSXX_REG_WHO_AM_I (0x0F)
|
||||
#define LSM6DSXX_REG_CTRL1_XL (0x10)
|
||||
#define LSM6DSXX_REG_CTRL2_G (0x11)
|
||||
#define LSM6DSXX_REG_CTRL3_C (0x12)
|
||||
#define LSM6DSXX_REG_CTRL4_C (0x13)
|
||||
#define LSM6DSXX_REG_CTRL5_C (0x14)
|
||||
#define LSM6DSXX_REG_CTRL6_C (0x15)
|
||||
#define LSM6DSXX_REG_CTRL7_G (0x16)
|
||||
#define LSM6DSXX_REG_CTRL8_XL (0x17)
|
||||
#define LSM6DSXX_REG_CTRL9_XL (0x18)
|
||||
#define LSM6DSXX_REG_CTRL10_C (0x19)
|
||||
#define LSM6DSXX_REG_WAKE_UP_SRC (0x1B)
|
||||
#define LSM6DSXX_REG_TAP_SRC (0x1C)
|
||||
#define LSM6DSXX_REG_D6D_SRC (0x1D)
|
||||
#define LSM6DSXX_REG_STATUS_REG (0x1E)
|
||||
#define LSM6DSXX_REG_OUT_TEMP_L (0x20)
|
||||
#define LSM6DSXX_REG_OUT_TEMP_H (0x21)
|
||||
#define LSM6DSXX_REG_OUTX_L_G (0x22)
|
||||
#define LSM6DSXX_REG_OUTX_H_G (0x23)
|
||||
#define LSM6DSXX_REG_OUTY_L_G (0x24)
|
||||
#define LSM6DSXX_REG_OUTY_H_G (0x25)
|
||||
#define LSM6DSXX_REG_OUTZ_L_G (0x26)
|
||||
#define LSM6DSXX_REG_OUTZ_H_G (0x27)
|
||||
#define LSM6DSXX_REG_OUTX_L_XL (0x28)
|
||||
#define LSM6DSXX_REG_OUTX_H_XL (0x29)
|
||||
#define LSM6DSXX_REG_OUTY_L_XL (0x2A)
|
||||
#define LSM6DSXX_REG_OUTY_H_XL (0x2B)
|
||||
#define LSM6DSXX_REG_OUTZ_L_XL (0x2C)
|
||||
#define LSM6DSXX_REG_OUTZ_H_XL (0x2D)
|
||||
#define LSM6DSXX_REG_FIFO_STATUS1 (0x3A)
|
||||
#define LSM6DSXX_REG_FIFO_STATUS2 (0x3B)
|
||||
#define LSM6DSXX_REG_FIFO_STATUS3 (0x3C)
|
||||
#define LSM6DSXX_REG_FIFO_STATUS4 (0x3D)
|
||||
#define LSM6DSXX_REG_FIFO_DATA_OUT_L (0x3E)
|
||||
#define LSM6DSXX_REG_FIFO_DATA_OUT_H (0x3F)
|
||||
#define LSM6DSXX_REG_TIMESTAMP0_REG (0x40)
|
||||
#define LSM6DSXX_REG_TIMESTAMP1_REG (0x41)
|
||||
#define LSM6DSXX_REG_TIMESTAMP2_REG (0x42)
|
||||
#define LSM6DSXX_REG_STEP_TIMESTAMP_L (0x49)
|
||||
#define LSM6DSXX_REG_STEP_TIMESTAMP_H (0x4A)
|
||||
#define LSM6DSXX_REG_STEP_COUNTER_L (0x4B)
|
||||
#define LSM6DSXX_REG_STEP_COUNTER_H (0x4C)
|
||||
#define LSM6DSXX_REG_FUNC_SR_1 (0x53)
|
||||
#define LSM6DSXX_REG_TAP_CFG (0x58)
|
||||
#define LSM6DSXX_REG_TAP_THS_6D (0x59)
|
||||
#define LSM6DSXX_REG_INT_DUR2 (0x5A)
|
||||
#define LSM6DSXX_REG_WAKE_UP_THS (0x5B)
|
||||
#define LSM6DSXX_REG_WAKE_UP_DUR (0x5C)
|
||||
#define LSM6DSXX_REG_FREE_FALL (0x5D)
|
||||
#define LSM6DSXX_REG_MD1_CFG (0x5E)
|
||||
#define LSM6DSXX_REG_MD2_CFG (0x5F)
|
||||
/** @} */
|
||||
|
||||
#if MODULE_LSM6DSL
|
||||
/**
|
||||
* @name LSM6DSL specific registers not used in implemnetation
|
||||
* @{
|
||||
*/
|
||||
#define LSM6DSXX_REG_SENSOR_SYNC_TIME_FRAME (0x04)
|
||||
#define LSM6DSXX_REG_SENSOR_SYC_RES_RATIO (0x05)
|
||||
#define LSM6DSXX_REG_DRDY_PULSE_CFG_G (0x0B)
|
||||
#define LSM6DSXX_REG_MASTER_CONFIG (0x1A)
|
||||
#define LSM6DSXX_REG_SENSORHUB1_REG (0x2E)
|
||||
#define LSM6DSXX_REG_SENSORHUB2_REG (0x2F)
|
||||
#define LSM6DSXX_REG_SENSORHUB3_REG (0x30)
|
||||
#define LSM6DSXX_REG_SENSORHUB4_REG (0x31)
|
||||
#define LSM6DSXX_REG_SENSORHUB5_REG (0x32)
|
||||
#define LSM6DSXX_REG_SENSORHUB6_REG (0x33)
|
||||
#define LSM6DSXX_REG_SENSORHUB7_REG (0x34)
|
||||
#define LSM6DSXX_REG_SENSORHUB8_REG (0x35)
|
||||
#define LSM6DSXX_REG_SENSORHUB9_REG (0x36)
|
||||
#define LSM6DSXX_REG_SENSORHUB10_REG (0x37)
|
||||
#define LSM6DSXX_REG_SENSORHUB11_REG (0x38)
|
||||
#define LSM6DSXX_REG_SENSORHUB12_REG (0x39)
|
||||
#define LSM6DSXX_REG_SENSORHUB13_REG (0x4D)
|
||||
#define LSM6DSXX_REG_SENSORHUB14_REG (0x4E)
|
||||
#define LSM6DSXX_REG_SENSORHUB15_REG (0x4F)
|
||||
#define LSM6DSXX_REG_SENSORHUB16_REG (0x50)
|
||||
#define LSM6DSXX_REG_SENSORHUB17_REG (0x51)
|
||||
#define LSM6DSXX_REG_SENSORHUB18_REG (0x52)
|
||||
#define LSM6DSXX_REG_FUNC_SRC_2 (0x54)
|
||||
#define LSM6DSXX_REG_WRIST_TILT_IA (0x55)
|
||||
#define LSM6DSXX_REG_MASTER_CMD_CODE (0x60)
|
||||
#define LSM6DSXX_REG_SENS_SYNC_SPI_ERR_CODE (0x61)
|
||||
#define LSM6DSXX_REG_OUT_MAG_RAW_X_L (0x66)
|
||||
#define LSM6DSXX_REG_OUT_MAG_RAW_X_H (0x67)
|
||||
#define LSM6DSXX_REG_OUT_MAG_RAW_Y_L (0x68)
|
||||
#define LSM6DSXX_REG_OUT_MAG_RAW_Y_H (0x69)
|
||||
#define LSM6DSXX_REG_OUT_MAG_RAW_Z_L (0x6A)
|
||||
#define LSM6DSXX_REG_OUT_MAG_RAW_Z_H (0x6B)
|
||||
#define LSM6DSXX_REG_X_OFS_USR (0x73)
|
||||
#define LSM6DSXX_REG_Y_OFS_USR (0x74)
|
||||
#define LSM6DSXX_REG_Z_OFS_USR (0x75)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief WHO_AM_I value for the LSM6DSL
|
||||
*/
|
||||
#define LSM6DSXX_WHO_AM_I (0b01101010)
|
||||
|
||||
|
||||
|
||||
#elif MODULE_LSM6DS33
|
||||
/**
|
||||
* @name LSM6DS33 specific registers not used in implementation
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define LSM6DSXX_REG_ORIENT_CFG_G (0x0B)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief WHO_AM_I value for the LSM6DS33
|
||||
*/
|
||||
#define LSM6DSXX_WHO_AM_I (0b01101001)
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name CTRL_x registers
|
||||
* @{
|
||||
*/
|
||||
#define LSM6DSXX_CTRL_ODR_SHIFT (4)
|
||||
#define LSM6DSXX_CTRL_ODR_MASK (0xF0)
|
||||
#define LSM6DSXX_CTRL_FS_SHIFT (2)
|
||||
#define LSM6DSXX_CTRL_FS_MASK (0x0C)
|
||||
|
||||
#define LSM6DSXX_CTRL3_C_BOOT (0x80)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name FIFO_CTRL_x registers
|
||||
* @{
|
||||
*/
|
||||
#define LSM6DSXX_FIFO_CTRL5_CONTINUOUS_MODE (0x6)
|
||||
#define LSM6DSXX_FIFO_CTRL5_FIFO_ODR_SHIFT (3)
|
||||
|
||||
#define LSM6DSXX_FIFO_CTRL3_GYRO_DEC_SHIFT (3)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Offset for temperature calculation
|
||||
*/
|
||||
#define LSM6DSXX_TEMP_OFFSET (0x1900)
|
||||
|
||||
/**
|
||||
* @brief Reboot wait interval in ms (15ms)
|
||||
*/
|
||||
#define LSM6DSXX_BOOT_WAIT_MS (15)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LSM6DSXX_INTERNAL_H */
|
||||
/** @} */
|
99
drivers/lsm6dsxx/include/lsm6dsxx_params.h
Normal file
99
drivers/lsm6dsxx/include/lsm6dsxx_params.h
Normal file
@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (C) 2017 OTA keys S.A.
|
||||
* Copyright (C) 2024 HAW Hamburg.
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup drivers_lsm6dsxx
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Default configuration for LSM6DSXX devices
|
||||
*
|
||||
* @author Vincent Dupont <vincent@otakeys.com>
|
||||
* @author Miquel Borrell <miquel.borrell@haw-hamburg.de>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LSM6DSXX_PARAMS_H
|
||||
#define LSM6DSXX_PARAMS_H
|
||||
|
||||
#include "board.h"
|
||||
#include "lsm6dsxx.h"
|
||||
#include "saul_reg.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name Set default configuration parameters
|
||||
* @{
|
||||
*/
|
||||
#ifndef LSM6DSXX_PARAM_I2C
|
||||
#define LSM6DSXX_PARAM_I2C I2C_DEV(0)
|
||||
#endif
|
||||
#ifndef LSM6DSXX_PARAM_ADDR
|
||||
#define LSM6DSXX_PARAM_ADDR (0x6B) /* (0x6A) */
|
||||
#endif
|
||||
#ifndef LSM6DSXX_PARAM_ACC_ODR
|
||||
#define LSM6DSXX_PARAM_ACC_ODR (LSM6DSXX_DATA_RATE_52HZ)
|
||||
#endif
|
||||
#ifndef LSM6DSXX_PARAM_GYRO_ODR
|
||||
#define LSM6DSXX_PARAM_GYRO_ODR (LSM6DSXX_DATA_RATE_52HZ)
|
||||
#endif
|
||||
#ifndef LSM6DSXX_PARAM_ACC_FS
|
||||
#define LSM6DSXX_PARAM_ACC_FS (LSM6DSXX_ACC_FS_2G)
|
||||
#endif
|
||||
#ifndef LSM6DSXX_PARAM_GYRO_FS
|
||||
#define LSM6DSXX_PARAM_GYRO_FS (LSM6DSXX_GYRO_FS_245DPS)
|
||||
#endif
|
||||
#ifndef LSM6DSXX_PARAM_ACC_FIFO_DEC
|
||||
#define LSM6DSXX_PARAM_ACC_FIFO_DEC (LSM6DSXX_DECIMATION_NO)
|
||||
#endif
|
||||
#ifndef LSM6DSXX_PARAM_GYRO_FIFO_DEC
|
||||
#define LSM6DSXX_PARAM_GYRO_FIFO_DEC (LSM6DSXX_DECIMATION_NO)
|
||||
#endif
|
||||
|
||||
#ifndef LSM6DSXX_PARAMS
|
||||
#define LSM6DSXX_PARAMS { .i2c = LSM6DSXX_PARAM_I2C, \
|
||||
.addr = LSM6DSXX_PARAM_ADDR, \
|
||||
.acc_odr = LSM6DSXX_PARAM_ACC_ODR, \
|
||||
.gyro_odr = LSM6DSXX_PARAM_GYRO_ODR, \
|
||||
.acc_fs = LSM6DSXX_PARAM_ACC_FS, \
|
||||
.gyro_fs = LSM6DSXX_PARAM_GYRO_FS, \
|
||||
.acc_decimation = LSM6DSXX_PARAM_ACC_FIFO_DEC, \
|
||||
.gyro_decimation = LSM6DSXX_PARAM_GYRO_FIFO_DEC }
|
||||
#endif
|
||||
#ifndef LSM6DSXX_SAUL_INFO
|
||||
#define LSM6DSXX_SAUL_INFO { .name = "lsm6dsxx" }
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Allocate some memory to store the actual configuration
|
||||
*/
|
||||
static const lsm6dsxx_params_t lsm6dsxx_params[] =
|
||||
{
|
||||
LSM6DSXX_PARAMS
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Additional meta information to keep in the SAUL registry
|
||||
*/
|
||||
static const saul_reg_info_t lsm6dsxx_saul_info[] =
|
||||
{
|
||||
LSM6DSXX_SAUL_INFO
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LSM6DSXX_PARAMS_H */
|
||||
/** @} */
|
305
drivers/lsm6dsxx/lsm6dsxx.c
Normal file
305
drivers/lsm6dsxx/lsm6dsxx.c
Normal file
@ -0,0 +1,305 @@
|
||||
/*
|
||||
* Copyright (C) 2017 OTA keys S.A.
|
||||
* Copyright (C) 2024 HAW Hamburg.
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup drivers_lsm6dsxx
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Device driver implementation for the LSM6DSXX 3D accelerometer/gyroscope.
|
||||
*
|
||||
* @author Vincent Dupont <vincent@otakeys.com>
|
||||
* @author Sebastian Meiling <s@mlng.net>
|
||||
* @author Miquel Borrell <miquel.borrell@haw-hamburg.de>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "ztimer.h"
|
||||
#include "macros/utils.h"
|
||||
|
||||
#include "lsm6dsxx.h"
|
||||
#include "lsm6dsxx_internal.h"
|
||||
|
||||
#define ENABLE_DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
#define BUS (dev->params.i2c)
|
||||
#define ADDR (dev->params.addr)
|
||||
|
||||
/**
|
||||
* order in array [0, 1, 2, 3] is
|
||||
* LSM6DSXX_ACC_FS_2G, LSM6DSXX_ACC_FS_16G, LSM6DSXX_ACC_FS_4G, LSM6DSXX_ACC_FS_8G
|
||||
*/
|
||||
static const int16_t range_acc[] = { 2000, 16000, 4000, 8000 };
|
||||
|
||||
/**
|
||||
* order in array [0, 1, 2, 3] is
|
||||
* LSM6DSXX_GYRO_FS_245DPS, LSM6DSXX_GYRO_FS_500DPS,
|
||||
* LSM6DSXX_GYRO_FS_1000DPS, LSM6DSXX_GYRO_FS_2000DPS
|
||||
*/
|
||||
static const int16_t range_gyro[] = { 2450, 5000, 10000, 20000 };
|
||||
|
||||
int lsm6dsxx_init(lsm6dsxx_t *dev, const lsm6dsxx_params_t *params)
|
||||
{
|
||||
uint8_t tmp;
|
||||
int res;
|
||||
|
||||
assert(dev && params);
|
||||
|
||||
dev->params = *params;
|
||||
|
||||
i2c_acquire(BUS);
|
||||
|
||||
/* Reboot */
|
||||
i2c_write_reg(BUS, ADDR, LSM6DSXX_REG_CTRL3_C, LSM6DSXX_CTRL3_C_BOOT, 0);
|
||||
|
||||
ztimer_sleep(ZTIMER_MSEC, LSM6DSXX_BOOT_WAIT_MS);
|
||||
|
||||
if (i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_WHO_AM_I, &tmp, 0) < 0) {
|
||||
i2c_release(BUS);
|
||||
DEBUG("[ERROR] lsm6dsxx_init: i2c_read_reg LSM6DSXX_REG_WHO_AM_I!\n");
|
||||
return -LSM6DSXX_ERROR_BUS;
|
||||
}
|
||||
|
||||
if (tmp != LSM6DSXX_WHO_AM_I) {
|
||||
DEBUG("[ERROR] lsm6dsxx_init: WHO_AM_I\n");
|
||||
return -LSM6DSXX_ERROR_DEV;
|
||||
}
|
||||
|
||||
/* Set acc odr / full scale */
|
||||
tmp = (dev->params.acc_odr << LSM6DSXX_CTRL_ODR_SHIFT) |
|
||||
(dev->params.acc_fs << LSM6DSXX_CTRL_FS_SHIFT);
|
||||
res = i2c_write_reg(BUS, ADDR, LSM6DSXX_REG_CTRL1_XL, tmp, 0);
|
||||
/* Set gyro odr / full scale */
|
||||
tmp = (dev->params.gyro_odr << LSM6DSXX_CTRL_ODR_SHIFT) |
|
||||
(dev->params.gyro_fs << LSM6DSXX_CTRL_FS_SHIFT);
|
||||
res += i2c_write_reg(BUS, ADDR, LSM6DSXX_REG_CTRL2_G, tmp, 0);
|
||||
/* Set continuous mode */
|
||||
uint8_t fifo_odr = MAX(dev->params.acc_odr, dev->params.gyro_odr);
|
||||
tmp = (fifo_odr << LSM6DSXX_FIFO_CTRL5_FIFO_ODR_SHIFT) |
|
||||
LSM6DSXX_FIFO_CTRL5_CONTINUOUS_MODE;
|
||||
res += i2c_write_reg(BUS, ADDR, LSM6DSXX_REG_FIFO_CTRL5, tmp, 0);
|
||||
tmp = (dev->params.gyro_decimation << LSM6DSXX_FIFO_CTRL3_GYRO_DEC_SHIFT) |
|
||||
dev->params.acc_decimation;
|
||||
res += i2c_write_reg(BUS, ADDR, LSM6DSXX_REG_FIFO_CTRL3, tmp, 0);
|
||||
|
||||
i2c_release(BUS);
|
||||
|
||||
if (res < 0) {
|
||||
DEBUG("[ERROR] lsm6dsxx_init: config\n");
|
||||
return -LSM6DSXX_ERROR_CNF;
|
||||
}
|
||||
return LSM6DSXX_OK;
|
||||
}
|
||||
|
||||
int lsm6dsxx_read_acc(const lsm6dsxx_t *dev, lsm6dsxx_3d_data_t *data)
|
||||
{
|
||||
int res;
|
||||
uint8_t tmp;
|
||||
|
||||
i2c_acquire(BUS);
|
||||
i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_STATUS_REG, &tmp, 0);
|
||||
DEBUG("lsm6dsxx status: %x\n", tmp);
|
||||
|
||||
res = i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_OUTX_L_XL, &tmp, 0);
|
||||
data->x = tmp;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_OUTX_H_XL, &tmp, 0);
|
||||
data->x |= tmp << 8;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_OUTY_L_XL, &tmp, 0);
|
||||
data->y = tmp;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_OUTY_H_XL, &tmp, 0);
|
||||
data->y |= tmp << 8;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_OUTZ_L_XL, &tmp, 0);
|
||||
data->z = tmp;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_OUTZ_H_XL, &tmp, 0);
|
||||
data->z |= tmp << 8;
|
||||
i2c_release(BUS);
|
||||
|
||||
if (res < 0) {
|
||||
DEBUG("[ERROR] lsm6dsxx_read_acc\n");
|
||||
return -LSM6DSXX_ERROR_BUS;
|
||||
}
|
||||
|
||||
assert(dev->params.acc_fs < LSM6DSXX_ACC_FS_MAX);
|
||||
data->x = ((int32_t)data->x * range_acc[dev->params.acc_fs]) / INT16_MAX;
|
||||
data->y = ((int32_t)data->y * range_acc[dev->params.acc_fs]) / INT16_MAX;
|
||||
data->z = ((int32_t)data->z * range_acc[dev->params.acc_fs]) / INT16_MAX;
|
||||
|
||||
return LSM6DSXX_OK;
|
||||
}
|
||||
|
||||
int lsm6dsxx_read_gyro(const lsm6dsxx_t *dev, lsm6dsxx_3d_data_t *data)
|
||||
{
|
||||
int res;
|
||||
uint8_t tmp;
|
||||
|
||||
i2c_acquire(BUS);
|
||||
i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_STATUS_REG, &tmp, 0);
|
||||
DEBUG("lsm6dsxx status: %x\n", tmp);
|
||||
|
||||
res = i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_OUTX_L_G, &tmp, 0);
|
||||
data->x = tmp;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_OUTX_H_G, &tmp, 0);
|
||||
data->x |= tmp << 8;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_OUTY_L_G, &tmp, 0);
|
||||
data->y = tmp;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_OUTY_H_G, &tmp, 0);
|
||||
data->y |= tmp << 8;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_OUTZ_L_G, &tmp, 0);
|
||||
data->z = tmp;
|
||||
res += i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_OUTZ_H_G, &tmp, 0);
|
||||
data->z |= tmp << 8;
|
||||
i2c_release(BUS);
|
||||
|
||||
if (res < 0) {
|
||||
DEBUG("[ERROR] lsm6dsxx_read_gyro\n");
|
||||
return -LSM6DSXX_ERROR_BUS;
|
||||
}
|
||||
|
||||
assert(dev->params.gyro_fs < LSM6DSXX_GYRO_FS_MAX);
|
||||
data->x = ((int32_t)data->x * range_gyro[dev->params.gyro_fs]) / INT16_MAX;
|
||||
data->y = ((int32_t)data->y * range_gyro[dev->params.gyro_fs]) / INT16_MAX;
|
||||
data->z = ((int32_t)data->z * range_gyro[dev->params.gyro_fs]) / INT16_MAX;
|
||||
|
||||
return LSM6DSXX_OK;
|
||||
}
|
||||
|
||||
int lsm6dsxx_read_temp(const lsm6dsxx_t *dev, int16_t *data)
|
||||
{
|
||||
uint8_t tmp;
|
||||
uint16_t traw;
|
||||
/* read raw temperature */
|
||||
i2c_acquire(BUS);
|
||||
if (i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_OUT_TEMP_L, &tmp, 0) < 0) {
|
||||
i2c_release(BUS);
|
||||
return -LSM6DSXX_ERROR_BUS;
|
||||
}
|
||||
traw = tmp;
|
||||
if (i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_OUT_TEMP_H, &tmp, 0) < 0) {
|
||||
i2c_release(BUS);
|
||||
return -LSM6DSXX_ERROR_BUS;
|
||||
}
|
||||
traw |= (uint16_t)tmp << 8;
|
||||
i2c_release(BUS);
|
||||
/* convert temperature to degC x 100 */
|
||||
traw += LSM6DSXX_TEMP_OFFSET;
|
||||
*data = (int16_t)(((int32_t)traw * 100) / 256);
|
||||
|
||||
return LSM6DSXX_OK;
|
||||
}
|
||||
|
||||
int lsm6dsxx_acc_power_down(const lsm6dsxx_t *dev)
|
||||
{
|
||||
int res;
|
||||
uint8_t tmp;
|
||||
|
||||
i2c_acquire(BUS);
|
||||
res = i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_CTRL1_XL, &tmp, 0);
|
||||
if (res < 0) {
|
||||
i2c_release(BUS);
|
||||
DEBUG("[ERROR] lsm6dsxx_acc_power_down\n");
|
||||
return -LSM6DSXX_ERROR_BUS;
|
||||
}
|
||||
|
||||
tmp &= ~(LSM6DSXX_CTRL_ODR_MASK);
|
||||
res = i2c_write_reg(BUS, ADDR, LSM6DSXX_REG_CTRL1_XL, tmp, 0);
|
||||
|
||||
i2c_release(BUS);
|
||||
|
||||
if (res < 0) {
|
||||
DEBUG("[ERROR] lsm6dsxx_acc_power_down\n");
|
||||
return -LSM6DSXX_ERROR_BUS;
|
||||
}
|
||||
|
||||
return LSM6DSXX_OK;
|
||||
}
|
||||
|
||||
int lsm6dsxx_gyro_power_down(const lsm6dsxx_t *dev)
|
||||
{
|
||||
int res;
|
||||
uint8_t tmp;
|
||||
|
||||
i2c_acquire(BUS);
|
||||
res = i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_CTRL2_G, &tmp, 0);
|
||||
if (res < 0) {
|
||||
i2c_release(BUS);
|
||||
DEBUG("[ERROR] lsm6dsxx_gyro_power_down\n");
|
||||
return -LSM6DSXX_ERROR_BUS;
|
||||
}
|
||||
|
||||
tmp &= ~(LSM6DSXX_CTRL_ODR_MASK);
|
||||
res = i2c_write_reg(BUS, ADDR, LSM6DSXX_REG_CTRL2_G, tmp, 0);
|
||||
|
||||
i2c_release(BUS);
|
||||
|
||||
if (res < 0) {
|
||||
DEBUG("[ERROR] lsm6dsxx_gyro_power_down\n");
|
||||
return -LSM6DSXX_ERROR_BUS;
|
||||
}
|
||||
|
||||
return LSM6DSXX_OK;
|
||||
}
|
||||
|
||||
int lsm6dsxx_acc_power_up(const lsm6dsxx_t *dev)
|
||||
{
|
||||
int res;
|
||||
uint8_t tmp;
|
||||
|
||||
i2c_acquire(BUS);
|
||||
res = i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_CTRL1_XL, &tmp, 0);
|
||||
if (res < 0) {
|
||||
i2c_release(BUS);
|
||||
DEBUG("[ERROR] lsm6dsxx_acc_power_up\n");
|
||||
return -LSM6DSXX_ERROR_BUS;
|
||||
}
|
||||
|
||||
tmp &= ~(LSM6DSXX_CTRL_ODR_MASK);
|
||||
tmp |= dev->params.acc_odr << LSM6DSXX_CTRL_ODR_SHIFT;
|
||||
res = i2c_write_reg(BUS, ADDR, LSM6DSXX_REG_CTRL1_XL, tmp, 0);
|
||||
|
||||
i2c_release(BUS);
|
||||
|
||||
if (res < 0) {
|
||||
DEBUG("[ERROR] lsm6dsxx_acc_power_up\n");
|
||||
return -LSM6DSXX_ERROR_BUS;
|
||||
}
|
||||
|
||||
return LSM6DSXX_OK;
|
||||
}
|
||||
|
||||
int lsm6dsxx_gyro_power_up(const lsm6dsxx_t *dev)
|
||||
{
|
||||
int res;
|
||||
uint8_t tmp;
|
||||
|
||||
i2c_acquire(BUS);
|
||||
res = i2c_read_reg(BUS, ADDR, LSM6DSXX_REG_CTRL2_G, &tmp, 0);
|
||||
if (res < 0) {
|
||||
i2c_release(BUS);
|
||||
DEBUG("[ERROR] lsm6dsxx_gyro_power_up\n");
|
||||
return -LSM6DSXX_ERROR_BUS;
|
||||
}
|
||||
|
||||
tmp &= ~(LSM6DSXX_CTRL_ODR_MASK);
|
||||
tmp |= dev->params.gyro_odr << LSM6DSXX_CTRL_ODR_SHIFT;
|
||||
res = i2c_write_reg(BUS, ADDR, LSM6DSXX_REG_CTRL2_G, tmp, 0);
|
||||
|
||||
i2c_release(BUS);
|
||||
|
||||
if (res < 0) {
|
||||
DEBUG("[ERROR] lsm6dsxx_gyro_power_up\n");
|
||||
return -LSM6DSXX_ERROR_BUS;
|
||||
}
|
||||
|
||||
return LSM6DSXX_OK;
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2017 OTA keys S.A.
|
||||
* Copyright (C) 2024 HAW Hamburg.
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
@ -8,24 +9,25 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup drivers_lsm6dsl
|
||||
* @ingroup drivers_lsm6dsxx
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief SAUL implementation for the LSM6DSL 3D accelerometer/gyroscope.
|
||||
* @brief SAUL implementation for the LSM6DSXX 3D accelerometer/gyroscope.
|
||||
*
|
||||
* @author Vincent Dupont <vincent@otakeys.com>
|
||||
* @author Sebastian Meiling <s@mlng.net>
|
||||
* @author Miquel Borrell <miquel.borrell@haw-hamburg.de>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "lsm6dsl.h"
|
||||
#include "lsm6dsxx.h"
|
||||
#include "saul.h"
|
||||
|
||||
static int read_acc(const void *dev, phydat_t *res)
|
||||
{
|
||||
int ret = lsm6dsl_read_acc((const lsm6dsl_t *)dev, (lsm6dsl_3d_data_t *)res->val);
|
||||
int ret = lsm6dsxx_read_acc((const lsm6dsxx_t *)dev, (lsm6dsxx_3d_data_t *)res->val);
|
||||
if (ret < 0) {
|
||||
return -ECANCELED;
|
||||
}
|
||||
@ -38,7 +40,7 @@ static int read_acc(const void *dev, phydat_t *res)
|
||||
|
||||
static int read_gyro(const void *dev, phydat_t *res)
|
||||
{
|
||||
int ret = lsm6dsl_read_gyro((const lsm6dsl_t *)dev, (lsm6dsl_3d_data_t *)res->val);
|
||||
int ret = lsm6dsxx_read_gyro((const lsm6dsxx_t *)dev, (lsm6dsxx_3d_data_t *)res->val);
|
||||
if (ret < 0) {
|
||||
return -ECANCELED;
|
||||
}
|
||||
@ -51,7 +53,7 @@ static int read_gyro(const void *dev, phydat_t *res)
|
||||
|
||||
static int read_temp(const void *dev, phydat_t *res)
|
||||
{
|
||||
if (lsm6dsl_read_temp((const lsm6dsl_t *)dev, &res->val[0]) < 0) {
|
||||
if (lsm6dsxx_read_temp((const lsm6dsxx_t *)dev, &res->val[0]) < 0) {
|
||||
return -ECANCELED;
|
||||
}
|
||||
res->scale = -2;
|
||||
@ -60,19 +62,19 @@ static int read_temp(const void *dev, phydat_t *res)
|
||||
return 1;
|
||||
}
|
||||
|
||||
const saul_driver_t lsm6dsl_saul_acc_driver = {
|
||||
const saul_driver_t lsm6dsxx_saul_acc_driver = {
|
||||
.read = read_acc,
|
||||
.write = saul_write_notsup,
|
||||
.type = SAUL_SENSE_ACCEL,
|
||||
};
|
||||
|
||||
const saul_driver_t lsm6dsl_saul_gyro_driver = {
|
||||
const saul_driver_t lsm6dsxx_saul_gyro_driver = {
|
||||
.read = read_gyro,
|
||||
.write = saul_write_notsup,
|
||||
.type = SAUL_SENSE_GYRO,
|
||||
};
|
||||
|
||||
const saul_driver_t lsm6dsl_saul_temp_driver = {
|
||||
const saul_driver_t lsm6dsxx_saul_temp_driver = {
|
||||
.read = read_temp,
|
||||
.write = saul_write_notsup,
|
||||
.type = SAUL_SENSE_TEMP,
|
@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 OTA keys S.A.
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* @ingroup sys_auto_init_saul
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Auto initialization of LSM6DSL accelerometer/gyroscope sensors
|
||||
*
|
||||
* @author Vincent Dupont <vincent@otakeys.com
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "assert.h"
|
||||
#include "log.h"
|
||||
#include "saul_reg.h"
|
||||
#include "lsm6dsl.h"
|
||||
#include "lsm6dsl_params.h"
|
||||
|
||||
/**
|
||||
* @brief Define the number of configured sensors
|
||||
*/
|
||||
#define LSM6DSL_NUM ARRAY_SIZE(lsm6dsl_params)
|
||||
|
||||
/**
|
||||
* @brief Allocate memory for the device descriptors
|
||||
*/
|
||||
static lsm6dsl_t lsm6dsl_devs[LSM6DSL_NUM];
|
||||
|
||||
/**
|
||||
* @brief Memory for the SAUL registry entries
|
||||
*/
|
||||
static saul_reg_t saul_entries[LSM6DSL_NUM * 3];
|
||||
|
||||
/**
|
||||
* @brief Define the number of saul info
|
||||
*/
|
||||
#define LSM6DSL_INFO_NUM ARRAY_SIZE(lsm6dsl_saul_info)
|
||||
|
||||
/**
|
||||
* @name Reference the driver structs
|
||||
* @{
|
||||
*/
|
||||
extern saul_driver_t lsm6dsl_saul_acc_driver;
|
||||
extern saul_driver_t lsm6dsl_saul_gyro_driver;
|
||||
extern saul_driver_t lsm6dsl_saul_temp_driver;
|
||||
/** @} */
|
||||
|
||||
void auto_init_lsm6dsl(void)
|
||||
{
|
||||
assert(LSM6DSL_NUM == LSM6DSL_INFO_NUM);
|
||||
|
||||
for (unsigned int i = 0; i < LSM6DSL_NUM; i++) {
|
||||
LOG_DEBUG("[auto_init_saul] initializing lsm6dsl #%u\n", i);
|
||||
|
||||
if (lsm6dsl_init(&lsm6dsl_devs[i], &lsm6dsl_params[i]) < 0) {
|
||||
LOG_ERROR("[auto_init_saul] error initializing lsm6dsl #%u\n", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
saul_entries[(i * 3)].dev = &(lsm6dsl_devs[i]);
|
||||
saul_entries[(i * 3)].name = lsm6dsl_saul_info[i].name;
|
||||
saul_entries[(i * 3)].driver = &lsm6dsl_saul_acc_driver;
|
||||
saul_reg_add(&(saul_entries[(i * 3)]));
|
||||
saul_entries[(i * 3) + 1].dev = &(lsm6dsl_devs[i]);
|
||||
saul_entries[(i * 3) + 1].name = lsm6dsl_saul_info[i].name;
|
||||
saul_entries[(i * 3) + 1].driver = &lsm6dsl_saul_gyro_driver;
|
||||
saul_reg_add(&(saul_entries[(i * 3) + 1]));
|
||||
saul_entries[(i * 3) + 2].dev = &(lsm6dsl_devs[i]);
|
||||
saul_entries[(i * 3) + 2].name = lsm6dsl_saul_info[i].name;
|
||||
saul_entries[(i * 3) + 2].driver = &lsm6dsl_saul_temp_driver;
|
||||
saul_reg_add(&(saul_entries[(i * 3) + 2]));
|
||||
}
|
||||
}
|
82
drivers/saul/init_devs/auto_init_lsm6dsxx.c
Normal file
82
drivers/saul/init_devs/auto_init_lsm6dsxx.c
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (C) 2017 OTA keys S.A.
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* @ingroup sys_auto_init_saul
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Auto initialization of LSM6DSXX accelerometer/gyroscope sensors
|
||||
*
|
||||
* @author Vincent Dupont <vincent@otakeys.com
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "assert.h"
|
||||
#include "log.h"
|
||||
#include "saul_reg.h"
|
||||
#include "lsm6dsxx.h"
|
||||
#include "lsm6dsxx_params.h"
|
||||
|
||||
/**
|
||||
* @brief Define the number of configured sensors
|
||||
*/
|
||||
#define LSM6DSXX_NUM ARRAY_SIZE(lsm6dsxx_params)
|
||||
|
||||
/**
|
||||
* @brief Allocate memory for the device descriptors
|
||||
*/
|
||||
static lsm6dsxx_t lsm6dsxx_devs[LSM6DSXX_NUM];
|
||||
|
||||
/**
|
||||
* @brief Memory for the SAUL registry entries
|
||||
*/
|
||||
static saul_reg_t saul_entries[LSM6DSXX_NUM * 3];
|
||||
|
||||
/**
|
||||
* @brief Define the number of saul info
|
||||
*/
|
||||
#define LSM6DSXX_INFO_NUM ARRAY_SIZE(lsm6dsxx_saul_info)
|
||||
|
||||
/**
|
||||
* @name Reference the driver structs
|
||||
* @{
|
||||
*/
|
||||
extern saul_driver_t lsm6dsxx_saul_acc_driver;
|
||||
extern saul_driver_t lsm6dsxx_saul_gyro_driver;
|
||||
extern saul_driver_t lsm6dsxx_saul_temp_driver;
|
||||
/** @} */
|
||||
|
||||
void auto_init_lsm6dsxx(void)
|
||||
{
|
||||
assert(LSM6DSXX_NUM == LSM6DSXX_INFO_NUM);
|
||||
|
||||
for (unsigned int i = 0; i < LSM6DSXX_NUM; i++) {
|
||||
LOG_DEBUG("[auto_init_saul] initializing lsm6dsxx #%u\n", i);
|
||||
|
||||
if (lsm6dsxx_init(&lsm6dsxx_devs[i], &lsm6dsxx_params[i]) < 0) {
|
||||
LOG_ERROR("[auto_init_saul] error initializing lsm6dsxx #%u\n", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
saul_entries[(i * 3)].dev = &(lsm6dsxx_devs[i]);
|
||||
saul_entries[(i * 3)].name = lsm6dsxx_saul_info[i].name;
|
||||
saul_entries[(i * 3)].driver = &lsm6dsxx_saul_acc_driver;
|
||||
saul_reg_add(&(saul_entries[(i * 3)]));
|
||||
saul_entries[(i * 3) + 1].dev = &(lsm6dsxx_devs[i]);
|
||||
saul_entries[(i * 3) + 1].name = lsm6dsxx_saul_info[i].name;
|
||||
saul_entries[(i * 3) + 1].driver = &lsm6dsxx_saul_gyro_driver;
|
||||
saul_reg_add(&(saul_entries[(i * 3) + 1]));
|
||||
saul_entries[(i * 3) + 2].dev = &(lsm6dsxx_devs[i]);
|
||||
saul_entries[(i * 3) + 2].name = lsm6dsxx_saul_info[i].name;
|
||||
saul_entries[(i * 3) + 2].driver = &lsm6dsxx_saul_temp_driver;
|
||||
saul_reg_add(&(saul_entries[(i * 3) + 2]));
|
||||
}
|
||||
}
|
@ -195,9 +195,9 @@ void saul_init_devs(void)
|
||||
extern void auto_init_lsm303dlhc(void);
|
||||
auto_init_lsm303dlhc();
|
||||
}
|
||||
if (IS_USED(MODULE_LSM6DSL)) {
|
||||
extern void auto_init_lsm6dsl(void);
|
||||
auto_init_lsm6dsl();
|
||||
if (IS_USED(MODULE_LSM6DSXX)) {
|
||||
extern void auto_init_lsm6dsxx(void);
|
||||
auto_init_lsm6dsxx();
|
||||
}
|
||||
if (IS_USED(MODULE_LTC4150)) {
|
||||
extern void auto_init_ltc4150(void);
|
||||
|
@ -1,6 +1,8 @@
|
||||
include ../Makefile.drivers_common
|
||||
|
||||
USEMODULE += lsm6dsl
|
||||
DRIVER ?= lsm6ds33
|
||||
|
||||
USEMODULE += $(DRIVER)
|
||||
USEMODULE += ztimer
|
||||
USEMODULE += ztimer_msec
|
||||
|
@ -1,5 +1,5 @@
|
||||
# About
|
||||
This is a manual test application for the ST LSM6DSL sensor driver.
|
||||
This is a manual test application for the ST LSM6DSXX sensor driver.
|
||||
|
||||
# Usage
|
||||
|
@ -1,5 +1,5 @@
|
||||
# this file enables modules defined in Kconfig. Do not use this file for
|
||||
# application configuration. This is only needed during migration.
|
||||
CONFIG_MODULE_LSM6DSL=y
|
||||
CONFIG_MODULE_LSM6DSXX=y
|
||||
CONFIG_MODULE_ZTIMER=y
|
||||
CONFIG_MODULE_ZTIMER_MSEC=y
|
@ -1,10 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2017 OTA keys S.A.
|
||||
* 2017 HAW Hamburg
|
||||
* Copyright (C) 2024 HAW Hamburg.
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -12,10 +13,11 @@
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Test application for the LSM6DSL accelerometer/gyroscope driver.
|
||||
* @brief Test application for the LSM6DSXX accelerometer/gyroscope driver.
|
||||
*
|
||||
* @author Vincent Dupont <vincent@otakeys.com>
|
||||
* @author Sebastian Meiling <s@mlng.net>
|
||||
* @author Miquel Borrell <miquel.borrell@haw-hamburg.de>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
@ -23,33 +25,33 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ztimer.h"
|
||||
#include "lsm6dsl.h"
|
||||
#include "lsm6dsl_params.h"
|
||||
#include "lsm6dsxx.h"
|
||||
#include "lsm6dsxx_params.h"
|
||||
|
||||
#define SLEEP_MSEC (500UL)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
lsm6dsl_t dev;
|
||||
lsm6dsxx_t dev;
|
||||
int16_t temp_value;
|
||||
lsm6dsl_3d_data_t mag_value;
|
||||
lsm6dsl_3d_data_t acc_value;
|
||||
lsm6dsxx_3d_data_t mag_value;
|
||||
lsm6dsxx_3d_data_t acc_value;
|
||||
|
||||
puts("LSM6DSL test application");
|
||||
printf("Initializing LSM6DSL sensor at I2C_%i... ", lsm6dsl_params->i2c);
|
||||
puts("LSM6DSXX test application");
|
||||
printf("Initializing LSM6DSXX sensor at I2C_%i... ", lsm6dsxx_params->i2c);
|
||||
|
||||
if (lsm6dsl_init(&dev, lsm6dsl_params) != LSM6DSL_OK) {
|
||||
if (lsm6dsxx_init(&dev, lsm6dsxx_params) != LSM6DSXX_OK) {
|
||||
puts("[ERROR]");
|
||||
return 1;
|
||||
}
|
||||
puts("[SUCCESS]\n");
|
||||
|
||||
puts("Powering down LSM6DSL sensor...");
|
||||
if (lsm6dsl_acc_power_down(&dev) != LSM6DSL_OK) {
|
||||
puts("Powering down LSM6DSXX sensor...");
|
||||
if (lsm6dsxx_acc_power_down(&dev) != LSM6DSXX_OK) {
|
||||
puts("[ERROR]");
|
||||
return 1;
|
||||
}
|
||||
if (lsm6dsl_gyro_power_down(&dev) != LSM6DSL_OK) {
|
||||
if (lsm6dsxx_gyro_power_down(&dev) != LSM6DSXX_OK) {
|
||||
puts("[ERROR]");
|
||||
return 1;
|
||||
}
|
||||
@ -57,19 +59,19 @@ int main(void)
|
||||
|
||||
ztimer_sleep(ZTIMER_MSEC, 1 * 1000);
|
||||
|
||||
puts("Powering up LSM6DSL sensor...");
|
||||
if (lsm6dsl_acc_power_up(&dev) != LSM6DSL_OK) {
|
||||
puts("Powering up LSM6DSXX sensor...");
|
||||
if (lsm6dsxx_acc_power_up(&dev) != LSM6DSXX_OK) {
|
||||
puts("[ERROR]");
|
||||
return 1;
|
||||
}
|
||||
if (lsm6dsl_gyro_power_up(&dev) != LSM6DSL_OK) {
|
||||
if (lsm6dsxx_gyro_power_up(&dev) != LSM6DSXX_OK) {
|
||||
puts("[ERROR]");
|
||||
return 1;
|
||||
}
|
||||
puts("[SUCCESS]\n");
|
||||
|
||||
while (1) {
|
||||
if (lsm6dsl_read_acc(&dev, &acc_value) == LSM6DSL_OK) {
|
||||
if (lsm6dsxx_read_acc(&dev, &acc_value) == LSM6DSXX_OK) {
|
||||
printf("Accelerometer x: %i y: %i z: %i\n", acc_value.x,
|
||||
acc_value.y,
|
||||
acc_value.z);
|
||||
@ -78,7 +80,7 @@ int main(void)
|
||||
puts("[ERROR] reading accelerometer!\n");
|
||||
}
|
||||
|
||||
if (lsm6dsl_read_gyro(&dev, &mag_value) == LSM6DSL_OK) {
|
||||
if (lsm6dsxx_read_gyro(&dev, &mag_value) == LSM6DSXX_OK) {
|
||||
printf("Gyroscope x: %i y: %i z: %i\n", mag_value.x,
|
||||
mag_value.y,
|
||||
mag_value.z);
|
||||
@ -87,7 +89,7 @@ int main(void)
|
||||
puts("[ERROR] reading gyroscope!\n");
|
||||
}
|
||||
|
||||
if (lsm6dsl_read_temp(&dev, &temp_value) == LSM6DSL_OK) {
|
||||
if (lsm6dsxx_read_temp(&dev, &temp_value) == LSM6DSXX_OK) {
|
||||
printf("Temperature [in °C x 100]: %i \n", temp_value);
|
||||
}
|
||||
else {
|
@ -28,6 +28,9 @@ endif
|
||||
ifneq (,$(filter lm75,$(DRIVERS)))
|
||||
USEMODULE += tmp1075
|
||||
endif
|
||||
ifneq (,$(filter lsm6dsxx,$(DRIVERS)))
|
||||
USEMODULE += lsm6dsl
|
||||
endif
|
||||
ifneq (,$(filter lpsxxx,$(DRIVERS)))
|
||||
USEMODULE += lps22hh
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user