flamerten / esp-idf_LSM6DSOX_Driver

LSM6DSOX Driver for ESP-IDF based on ST's LSM6DSOX PID Driver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LSM6DSOX Driver for ESP-IDF

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.

Instructions for use

  1. Clone the repository and copy the components folder into project folder
  2. Initialise a i2c port. An example can be found in esp-idf's example repository: i2c_self_test.
  3. 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.

Current Features

  • lsm_init(LSM_DriverConfig *sensor_cfg): Sensor (accel and gyro) initialisation with scale and data rate
  • lsm_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 scale int16_t to mg and mdps

About

LSM6DSOX Driver for ESP-IDF based on ST's LSM6DSOX PID Driver


Languages

Language:C 99.9%Language:CMake 0.1%Language:Makefile 0.0%