/* FSM long counter status register. Long counter value is an unsigned integer value (16-bit format)..  */
int32_t lsm6dso_long_cnt_set(stmdev_ctx_t *ctx, uint16_t val)
/* FSM long counter status register. Long counter value is an unsigned integer value (16-bit format)..  */
int32_t lsm6dso_long_cnt_set(stmdev_ctx_t *ctx, uint16_t val)
{
  uint8_t buff[2];
  int32_t ret;
  buff[1] = (uint8_t) (val / 256U);
  buff[0] = (uint8_t) (val - (buff[1] * 256U));
  ret = lsm6dso_mem_bank_set(ctx, LSM6DSO_EMBEDDED_FUNC_BANK);
  if (ret == 0) {
    ret = lsm6dso_write_reg(ctx, LSM6DSO_FSM_LONG_COUNTER_L, buff, 2);
  }
  if (ret == 0) {
    ret = lsm6dso_mem_bank_set(ctx, LSM6DSO_USER_BANK);
  }
  return ret;
}