/* Free-fall duration event. 1LSb = 1 / ODR.  */
int32_t lsm6dsl_ff_dur_get(stmdev_ctx_t *ctx, uint8_t *val)
/* Free-fall duration event. 1LSb = 1 / ODR.  */
int32_t lsm6dsl_ff_dur_get(stmdev_ctx_t *ctx, uint8_t *val)
{
  lsm6dsl_wake_up_dur_t wake_up_dur;
  lsm6dsl_free_fall_t free_fall;
  int32_t ret;
  ret = lsm6dsl_read_reg(ctx, LSM6DSL_WAKE_UP_DUR, (uint8_t*)&wake_up_dur, 1);
  if(ret == 0){
    ret = lsm6dsl_read_reg(ctx, LSM6DSL_FREE_FALL, (uint8_t*)&free_fall, 1);
  }
  *val = (wake_up_dur.ff_dur << 5) + free_fall.ff_dur;
  return ret;
}