/* Software reset. Restore the default values in user registers..  */
int32_t iis2mdc_reset_set(stmdev_ctx_t *ctx, uint8_t val)
/* Software reset. Restore the default values in user registers..  */
int32_t iis2mdc_reset_set(stmdev_ctx_t *ctx, uint8_t val)
{
  iis2mdc_cfg_reg_a_t reg;
  int32_t ret;
  ret = iis2mdc_read_reg(ctx, IIS2MDC_CFG_REG_A, (uint8_t *) &reg, 1);
  if (ret == 0) {
    reg.soft_rst = val;
    ret = iis2mdc_write_reg(ctx, IIS2MDC_CFG_REG_A, (uint8_t *) &reg, 1);
  }
  return ret;
}