/* Free-fall duration event. 1LSb = 1 / ODR.  */
int32_t lsm6dso_ff_dur_get(lsm6dso_ctx_t *ctx, uint8_t *val)
/* Free-fall duration event. 1LSb = 1 / ODR.  */
int32_t lsm6dso_ff_dur_get(lsm6dso_ctx_t *ctx, uint8_t *val)
{
  lsm6dso_wake_up_dur_t wake_up_dur;
  lsm6dso_free_fall_t free_fall;
  int32_t ret;
  ret = lsm6dso_read_reg(ctx, LSM6DSO_WAKE_UP_DUR, (uint8_t*)&wake_up_dur, 1);
  if (ret == 0) {
    ret = lsm6dso_read_reg(ctx, LSM6DSO_FREE_FALL, (uint8_t*)&free_fall, 1);
    *val = (wake_up_dur.ff_dur << 5) + free_fall.ff_dur;
  }
  return ret;
}