Hi @IKhan.1 ,
I believe that the problem can be divided into two step.
The first step is data acquisition process. For this purpose, especially if you are using a custom application processor, you can refer to the C drivers (lsm6dsl_reg.c) and the C example on Github (lsm6dsl_read_data_polling.c). If you instead are using an STM32, there a re a lot of project /examples
The second step is the algorithm implementation. If you want to calculate the speed and the distance from the raw data, you should use more complex libraries, and take care of the periodic calibration of the sensors. There are some examples available for STM32 in the X-CUBE-MEMS1 firmware function pack (such as the MotionPE real-time pose estimation or the MotionFX sensor fusion library). You could start from these examples (although the source code of these libraries is not open source) and build up your own code.
-Eleon