/* This internal API writes the power mode in the sensor.  */
static int8_t write_power_mode(uint8_t sensor_mode, struct bme280_dev *dev)
/* This internal API writes the power mode in the sensor.  */
static int8_t write_power_mode(uint8_t sensor_mode, struct bme280_dev *dev)
{
    int8_t rslt;
    uint8_t reg_addr = BME280_PWR_CTRL_ADDR;
    uint8_t sensor_mode_reg_val;
    rslt = bme280_get_regs(reg_addr, &sensor_mode_reg_val, 1, dev);
    if (rslt == BME280_OK)
    {
        sensor_mode_reg_val = BME280_SET_BITS_POS_0(sensor_mode_reg_val, BME280_SENSOR_MODE, sensor_mode);
        rslt = bme280_set_regs(&reg_addr, &sensor_mode_reg_val, 1, dev);
    }
    return rslt;
}