lsm6dso sensor not work right in multithread mode
I am working with lsm6dso sensor for a watch. At the beginning, I am using the follwoing function to get steps in the register. It works in a while loop and can work rightly.
int32_t lsm6dso_number_of_steps_get(stmdev_ctx_t *ctx, uint8_t *buff)
{
int32_t ret;
ret = lsm6dso_mem_bank_set(ctx, LSM6DSO_EMBEDDED_FUNC_BANK);
if (ret == 0) {
ret = lsm6dso_read_reg(ctx, LSM6DSO_STEP_COUNTER_L, buff, 2);
}
if (ret == 0) {
ret = lsm6dso_mem_bank_set(ctx, LSM6DSO_USER_BANK);
}
return ret;
}Then I want to put this function in another thread. But it seems to work right. It works for a while at first, but after running for some time, the number of steps will automatically reset to zero.
I want to know under what condition will the sensor reset. Does the multithread affect its function?
