/* Magnetometer Z-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation)..  */
int32_t lsm6dso_mag_z_orient_set(lsm6dso_ctx_t *ctx, lsm6dso_mag_z_axis_t val)
/* Magnetometer Z-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation)..  */
int32_t lsm6dso_mag_z_orient_set(lsm6dso_ctx_t *ctx, lsm6dso_mag_z_axis_t val)
{
  lsm6dso_mag_cfg_a_t reg;
  int32_t ret;
  ret = lsm6dso_ln_pg_read_byte(ctx, LSM6DSO_MAG_CFG_A, (uint8_t*)&reg);
  if (ret == 0) {
    reg.mag_z_axis = (uint8_t) val;
    ret = lsm6dso_ln_pg_write_byte(ctx, LSM6DSO_MAG_CFG_A, (uint8_t*)&reg);
  }
  return ret;
}