/* The minimum duration (LSb = 1/ODR) of the Interrupt 1 event to be recognized ..  */
int32_t lis2dh12_int2_gen_duration_set(stmdev_ctx_t *ctx, uint8_t val)
/* The minimum duration (LSb = 1/ODR) of the Interrupt 1 event to be recognized ..  */
int32_t lis2dh12_int2_gen_duration_set(stmdev_ctx_t *ctx, uint8_t val)
{
  lis2dh12_int2_duration_t int2_duration;
  int32_t ret;
  ret = lis2dh12_read_reg(ctx, LIS2DH12_INT2_DURATION,
                          (uint8_t *)&int2_duration, 1);
  if (ret == 0)
  {
    int2_duration.d = val;
    ret = lis2dh12_write_reg(ctx, LIS2DH12_INT2_DURATION,
                             (uint8_t *)&int2_duration, 1);
  }
  return ret;
}