/* Minimum threshold to detect a peak. Default is 10h..  */
int32_t lsm6dsl_pedo_threshold_set(stmdev_ctx_t *ctx, uint8_t val)
/* Minimum threshold to detect a peak. Default is 10h..  */
int32_t lsm6dsl_pedo_threshold_set(stmdev_ctx_t *ctx, uint8_t val)
{
  lsm6dsl_config_pedo_ths_min_t config_pedo_ths_min;
  int32_t ret;
  ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_BANK_A);
  if(ret == 0){
    ret = lsm6dsl_read_reg(ctx, LSM6DSL_CONFIG_PEDO_THS_MIN,
                           (uint8_t*)&config_pedo_ths_min, 1);
      if(ret == 0){
       config_pedo_ths_min.ths_min = val;
      ret = lsm6dsl_write_reg(ctx, LSM6DSL_CONFIG_PEDO_THS_MIN,
                              (uint8_t*)&config_pedo_ths_min, 1);
        if(ret == 0){
          ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_USER_BANK);
        }
      }
    }
  return ret;
}