/* Slave 0 write operation is performed only at the first sensor hub cycle. This is effective if the Aux_sens_on field in SLAVE0_CONFIG(04h) is set to a value other than 00..  */
int32_t lsm6dsl_sh_write_mode_get(stmdev_ctx_t *ctx, lsm6dsl_write_once_t *val)
/* Slave 0 write operation is performed only at the first sensor hub cycle. This is effective if the Aux_sens_on field in SLAVE0_CONFIG(04h) is set to a value other than 00..  */
int32_t lsm6dsl_sh_write_mode_get(stmdev_ctx_t *ctx, lsm6dsl_write_once_t *val)
{
  lsm6dsl_slave1_config_t slave1_config;
  int32_t ret;
  ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_BANK_A);
  if(ret == 0){
    ret = lsm6dsl_read_reg(ctx, LSM6DSL_SLAVE1_CONFIG, 
                           (uint8_t*)&slave1_config, 1);
    if(ret == 0){
      switch (slave1_config.write_once) {
        case LSM6DSL_EACH_SH_CYCLE:
          *val = LSM6DSL_EACH_SH_CYCLE;
          break;
        case LSM6DSL_ONLY_FIRST_CYCLE:
          *val = LSM6DSL_ONLY_FIRST_CYCLE;
          break;
        default:
          *val = LSM6DSL_SH_WR_MODE_ND;
          break;
      }
      ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_USER_BANK);
    }
  }
  return ret;
}