/* This API sets the pressure and/or temperature oversampling settings in the sensor according to the settings selected by the user.  */
static int8_t set_osr_press_temp_settings(uint8_t desired_settings, const struct bme280_settings *settings, struct bme280_dev *dev)
/* This API sets the pressure and/or temperature oversampling settings in the sensor according to the settings selected by the user.  */
static int8_t set_osr_press_temp_settings(uint8_t desired_settings, const struct bme280_settings *settings, struct bme280_dev *dev)
{
    int8_t rslt;
    uint8_t reg_addr = BME280_CTRL_MEAS_ADDR;
    uint8_t reg_data;
    rslt = bme280_get_regs(reg_addr, &reg_data, 1, dev);
    if (rslt == BME280_OK)
    {
        if (desired_settings & BME280_OSR_PRESS_SEL)
        {
            fill_osr_press_settings(&reg_data, settings);
        }
        if (desired_settings & BME280_OSR_TEMP_SEL)
        {
            fill_osr_temp_settings(&reg_data, settings);
        }
        rslt = bme280_set_regs(&reg_addr, &reg_data, 1, dev);
    }
    return rslt;
}