/* This API is used to compensate the pressure and/or temperature and/or humidity data according to the component selected by the user.  */
int8_t bme280_compensate_data(uint8_t sensor_comp, const struct bme280_uncomp_data *uncomp_data, struct bme280_data *comp_data, struct bme280_calib_data *calib_data)
/* This API is used to compensate the pressure and/or temperature and/or humidity data according to the component selected by the user.  */
int8_t bme280_compensate_data(uint8_t sensor_comp, const struct bme280_uncomp_data *uncomp_data, struct bme280_data *comp_data, struct bme280_calib_data *calib_data)
{
    int8_t rslt = BME280_OK;
    if ((uncomp_data != NULL) && (comp_data != NULL) && (calib_data != NULL))
    {
        comp_data->temperature = 0;
        comp_data->pressure = 0;
        comp_data->humidity = 0;
        if (sensor_comp & (BME280_PRESS | BME280_TEMP | BME280_HUM))
        {
            comp_data->temperature = compensate_temperature(uncomp_data, calib_data);
        }
        if (sensor_comp & BME280_PRESS)
        {
            comp_data->pressure = compensate_pressure(uncomp_data, calib_data);
        }
        if (sensor_comp & BME280_HUM)
        {
            comp_data->humidity = compensate_humidity(uncomp_data, calib_data);
        }
    }
    else
    {
        rslt = BME280_E_NULL_PTR;
    }
    return rslt;
}