/* These registers comprise a 3 group of 16-bit number and represent hard-iron offset in order to compensate environmental effects. Data format is the same of output data raw: two’s complement with 1LSb = 1.5mG. These values act on the magnetic output data value in order to delete the environmental offset..  */
int32_t iis2mdc_mag_user_offset_get(stmdev_ctx_t *ctx, int16_t *val)
/* These registers comprise a 3 group of 16-bit number and represent hard-iron offset in order to compensate environmental effects. Data format is the same of output data raw: two’s complement with 1LSb = 1.5mG. These values act on the magnetic output data value in order to delete the environmental offset..  */
int32_t iis2mdc_mag_user_offset_get(stmdev_ctx_t *ctx, int16_t *val)
{
  uint8_t buff[6];
  int32_t ret;
  ret =  iis2mdc_read_reg(ctx, IIS2MDC_OFFSET_X_REG_L, buff, 6);
  val[0] = (int16_t)buff[1];
  val[0] = (val[0] * 256) + (int16_t)buff[0];
  val[1] = (int16_t)buff[3];
  val[1] = (val[1] * 256) + (int16_t)buff[2];
  val[2] = (int16_t)buff[5];
  val[2] = (val[2] * 256) + (int16_t)buff[4];
  return ret;
}