/* Slave 0 write operation is performed only at the first sensor hub cycle..  */
int32_t lsm6dso_sh_write_mode_set(lsm6dso_ctx_t *ctx, lsm6dso_write_once_t val)
/* Slave 0 write operation is performed only at the first sensor hub cycle..  */
int32_t lsm6dso_sh_write_mode_set(lsm6dso_ctx_t *ctx, lsm6dso_write_once_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.write_once = (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;
}