/* Decimation of read operation on Slave 0 starting from the sensor hub trigger..  */
int32_t lsm6dsl_sh_slave_0_dec_set(stmdev_ctx_t *ctx, lsm6dsl_slave0_rate_t val)
/* Decimation of read operation on Slave 0 starting from the sensor hub trigger..  */
int32_t lsm6dsl_sh_slave_0_dec_set(stmdev_ctx_t *ctx, lsm6dsl_slave0_rate_t val)
{
  lsm6dsl_slave0_config_t slave0_config;
  int32_t ret;
  ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_BANK_A);
  if(ret == 0){
    ret = lsm6dsl_read_reg(ctx, LSM6DSL_SLAVE0_CONFIG,
                           (uint8_t*)&slave0_config, 1);
    if(ret == 0){
      slave0_config.slave0_rate = (uint8_t) val;
      ret = lsm6dsl_write_reg(ctx, LSM6DSL_SLAVE0_CONFIG,
                              (uint8_t*)&slave0_config, 1);
      if(ret == 0){
        ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_USER_BANK);
      }
    }
  }
  return ret;
}