/* User-defined threshold value for xl interrupt event on generator. Data format is the same of output data raw: two’s complement with 1LSb = 1.5mG..  */
int32_t iis2mdc_int_gen_treshold_set(stmdev_ctx_t *ctx, int16_t val)
/* User-defined threshold value for xl interrupt event on generator. Data format is the same of output data raw: two’s complement with 1LSb = 1.5mG..  */
int32_t iis2mdc_int_gen_treshold_set(stmdev_ctx_t *ctx, int16_t val)
{
  uint8_t buff[2];
  int32_t ret;
  buff[1] = (uint8_t) ((uint16_t)val / 256U);
  buff[0] = (uint8_t) ((uint16_t)val - (buff[1] * 256U));
  ret =  iis2mdc_write_reg(ctx, IIS2MDC_INT_THS_L_REG, buff, 2);
  return ret;
}