/* This API reads the pressure, temperature and humidity data from the sensor, compensates the data and store it in the bme280_data structure instance passed by the user.  */
int8_t bme280_get_sensor_data(uint8_t sensor_comp, struct bme280_data *comp_data, struct bme280_dev *dev)
/* This API reads the pressure, temperature and humidity data from the sensor, compensates the data and store it in the bme280_data structure instance passed by the user.  */
int8_t bme280_get_sensor_data(uint8_t sensor_comp, struct bme280_data *comp_data, struct bme280_dev *dev)
{
    int8_t rslt;
    uint8_t reg_data[BME280_P_T_H_DATA_LEN] = { 0 };
    struct bme280_uncomp_data uncomp_data = { 0 };
    rslt = null_ptr_check(dev);
    if ((rslt == BME280_OK) && (comp_data != NULL))
    {
        rslt = bme280_get_regs(BME280_DATA_ADDR, reg_data, BME280_P_T_H_DATA_LEN, dev);
        if (rslt == BME280_OK)
        {
            bme280_parse_sensor_data(reg_data, &uncomp_data);
            rslt = bme280_compensate_data(sensor_comp, &uncomp_data, comp_data, &dev->calib_data);
        }
    }
    else
    {
        rslt = BME280_E_NULL_PTR;
    }
    return rslt;
}