/* Number of external sensors to be read by the sensor hub..  */
int32_t lsm6dso_sh_slave_connected_set(stmdev_ctx_t *ctx, lsm6dso_aux_sens_on_t val)
/* Number of external sensors to be read by the sensor hub..  */
int32_t lsm6dso_sh_slave_connected_set(stmdev_ctx_t *ctx, lsm6dso_aux_sens_on_t val)
{
  lsm6dso_master_config_t reg;
  int32_t ret;
  ret = lsm6dso_mem_bank_set(ctx, LSM6DSO_SENSOR_HUB_BANK);
  if (ret == 0) {
    ret = lsm6dso_read_reg(ctx, LSM6DSO_MASTER_CONFIG, (uint8_t *)&reg,
                           1);
  }
  if (ret == 0) {
    reg.aux_sens_on = (uint8_t)val;
    ret = lsm6dso_write_reg(ctx, LSM6DSO_MASTER_CONFIG, (uint8_t *)&reg,
                            1);
  }
  if (ret == 0) {
    ret = lsm6dso_mem_bank_set(ctx, LSM6DSO_USER_BANK);
  }
  return ret;
}