ST LSM6DSOX driver developed using ESP-IDF V4.4 for ESP-IDF based on the LSM6DSOX Platform Indepdenent Driver provided by ST Engineering. Develompment only has basic features and is still in progress.
- Clone the repository and copy the components folder into project folder
- Initialise a i2c port. An example can be found in esp-idf's example repository: i2c_self_test.
- Create a
LSM_DriverConfig
struct and configure it with the i2c port, the scale and data rate of both the gyroscope and accelerometer. Then pass it as a pointer to various functions. For example
LSM_DriverConfig LSM_config = {
.i2c_port_num = 0,
.LSM_SA = 0,
.Acc_Data_Rate = LSM6DSOX_XL_ODR_26Hz,
.Gyr_Data_Rate = LSM6DSOX_GY_ODR_26Hz,
.Acc_Scale = LSM6DSOX_8g,
.Gyr_Scale = LSM6DSOX_1000dps
};
int ret = lsm_init(&LSM_config);
Note that main
is simply for testing and development. A example folder may be added in the future.
lsm_init(LSM_DriverConfig *sensor_cfg)
: Sensor (accel and gyro) initialisation with scale and data ratelsm_data_ready(LSM_DriverConfig *sensor_cfg)
,lsm_update_raw(LSM_DriverConfig *sensor_cfg)
,lsm_convert_raw(LSM_DriverConfig *sensor_cfg)
Checking if gyro and accel data is ready, before pulling data, and converting it from full scaleint16_t
tomg
andmdps