/* This internal API puts the device to sleep mode.  */
static int8_t put_device_to_sleep(struct bme280_dev *dev)
/* This internal API puts the device to sleep mode.  */
static int8_t put_device_to_sleep(struct bme280_dev *dev)
{
    int8_t rslt;
    uint8_t reg_data[4];
    struct bme280_settings settings;
    rslt = bme280_get_regs(BME280_CTRL_HUM_ADDR, reg_data, 4, dev);
    if (rslt == BME280_OK)
    {
        parse_device_settings(reg_data, &settings);
        rslt = bme280_soft_reset(dev);
        if (rslt == BME280_OK)
        {
            rslt = reload_device_settings(&settings, dev);
        }
    }
    return rslt;
}