cancel
Showing results for 
Search instead for 
Did you mean: 

LSM6DSL_FROM_FS_2g_TO_mg/LSM6DSL_FROM_LSB_TO_degC error from github code

louiey
Associate II

Hi.

I'm trying to use LSM6DSL sample code from "https://github.com/STMicroelectronics/STMems_Standard_C_drivers/tree/master/lsm6dsl_STdC/example/read_data_simple.c" which is official url from ST.

I build code and got error due to missing of "LSM6DSL_FROM_FS_2g_TO_mg/LSM6DSL_FROM_LSB_TO_degC" definition.

I couldn't find any from this git code.

Actually "LSM6DSL_FROM_FS_2000dps_TO_mdps" definition is also missing and I could find in this forum but couldn't find rest of two.

Can you let me know where I can find these?

BR.

Louiey

1 ACCEPTED SOLUTION

Accepted Solutions
Eleon BORLINI
ST Employee

hi Louiey, actually the LSB to physical conversion are defined inside the lsm6dsl_STdC/driver/lsm6dsl_reg.h as follows:

#define LSM6DSL_FROM_FS_2g_TO_mg(lsb)    (float)(lsb *  61.0f) / 1000.0f
#define LSM6DSL_FROM_FS_4g_TO_mg(lsb)    (float)(lsb * 122.0f) / 1000.0f
#define LSM6DSL_FROM_FS_8g_TO_mg(lsb)    (float)(lsb * 244.0f) / 1000.0f
#define LSM6DSL_FROM_FS_16g_TO_mg(lsb)   (float)(lsb * 488.0f) / 1000.0f
 
#define LSM6DSL_FROM_FS_125dps_TO_mdps(lsb)  (float)(lsb *  4375.0f ) / 1000.0f
#define LSM6DSL_FROM_FS_250dps_TO_mdps(lsb)  (float)(lsb *  8750.0f ) / 1000.0f
#define LSM6DSL_FROM_FS_500dps_TO_mdps(lsb)  (float)(lsb * 17500.0f ) / 1000.0f
#define LSM6DSL_FROM_FS_1000dps_TO_mdps(lsb) (float)(lsb *     35.0f)
#define LSM6DSL_FROM_FS_2000dps_TO_mdps(lsb) (float)(lsb *     70.0f)

Are you facing errors during compiling phase? Regards

View solution in original post

3 REPLIES 3
Eleon BORLINI
ST Employee

hi Louiey, actually the LSB to physical conversion are defined inside the lsm6dsl_STdC/driver/lsm6dsl_reg.h as follows:

#define LSM6DSL_FROM_FS_2g_TO_mg(lsb)    (float)(lsb *  61.0f) / 1000.0f
#define LSM6DSL_FROM_FS_4g_TO_mg(lsb)    (float)(lsb * 122.0f) / 1000.0f
#define LSM6DSL_FROM_FS_8g_TO_mg(lsb)    (float)(lsb * 244.0f) / 1000.0f
#define LSM6DSL_FROM_FS_16g_TO_mg(lsb)   (float)(lsb * 488.0f) / 1000.0f
 
#define LSM6DSL_FROM_FS_125dps_TO_mdps(lsb)  (float)(lsb *  4375.0f ) / 1000.0f
#define LSM6DSL_FROM_FS_250dps_TO_mdps(lsb)  (float)(lsb *  8750.0f ) / 1000.0f
#define LSM6DSL_FROM_FS_500dps_TO_mdps(lsb)  (float)(lsb * 17500.0f ) / 1000.0f
#define LSM6DSL_FROM_FS_1000dps_TO_mdps(lsb) (float)(lsb *     35.0f)
#define LSM6DSL_FROM_FS_2000dps_TO_mdps(lsb) (float)(lsb *     70.0f)

Are you facing errors during compiling phase? Regards

louiey
Associate II

Yes, thank you for "define".

Still I couldn't find ehse info from "https://github.com/STMicroelectronics/STMems_Standard_C_drivers/blob/master/lsm6dsl_STdC/driver/lsm6dsl_reg.h".

Anyway I could go head.

Thanks.

Yes, thank you for "define".

Still I couldn't find ehse info from "https://github.com/STMicroelectronics/STMems_Standard_C_drivers/blob/master/lsm6dsl_STdC/driver/lsm6dsl_reg.h".

Anyway I could go head.

Thanks.