@Test public void readTemperatureAndPressure() throws IOException { Bmx280 bmx280 = new Bmx280(mI2c); bmx280.setTemperatureOversampling(Bmx280.OVERSAMPLING_1X); bmx280.setPressureOversampling(Bmx280.OVERSAMPLING_1X); bmx280.readTemperatureAndPressure(); Mockito.verify(mI2c).readRegBuffer(eq(0xFA), any(byte[].class), eq(3)); Mockito.verify(mI2c).readRegBuffer(eq(0xF7), any(byte[].class), eq(3)); }
public float[] readTemperatureAndPressure() throws IOException, IllegalStateException { if (mTemperatureOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("temperature oversampling is skipped"); } if (mPressureOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("pressure oversampling is skipped"); } int rawTemp = readSample(BMX280_REG_TEMP); float[] temperatures = compensateTemperature(rawTemp, mTempCalibrationData); int rawPressure = readSample(BMX280_REG_PRESS); float pressure = compensatePressure(rawPressure, temperatures[1], mPressureCalibrationData); return new float[]{temperatures[0], pressure}; }
Bmx280 implements AutoCloseable { public float[] readTemperatureAndPressure() throws IOException, IllegalStateException { if (mTemperatureOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("temperature oversampling is skipped"); } if (mPressureOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("pressure oversampling is skipped"); } int rawTemp = readSample(BMX280_REG_TEMP); float[] temperatures = compensateTemperature(rawTemp, mTempCalibrationData); int rawPressure = readSample(BMX280_REG_PRESS); float pressure = compensatePressure(rawPressure, temperatures[1], mPressureCalibrationData); return new float[]{temperatures[0], pressure}; } }
Bmx280 implements AutoCloseable { public float[] readTemperatureAndPressure() throws IOException, IllegalStateException { if (mTemperatureOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("temperature oversampling is skipped"); } if (mPressureOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("pressure oversampling is skipped"); } int rawTemp = readSample(BMX280_REG_TEMP); float[] temperatures = compensateTemperature(rawTemp, mTempCalibrationData); int rawPressure = readSample(BMX280_REG_PRESS); float pressure = compensatePressure(rawPressure, temperatures[1], mPressureCalibrationData); return new float[]{temperatures[0], pressure}; } Bmx280(String bus);  Bmx280(String bus, int address);   Bmx280(I2cDevice device); }
Bmx280 implements AutoCloseable { public float[] readTemperatureAndPressure() throws IOException, IllegalStateException { if (mTemperatureOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("temperature oversampling is skipped"); } if (mPressureOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("pressure oversampling is skipped"); } int rawTemp = readSample(BMX280_REG_TEMP); float[] temperatures = compensateTemperature(rawTemp, mTempCalibrationData); int rawPressure = readSample(BMX280_REG_PRESS); float pressure = compensatePressure(rawPressure, temperatures[1], mPressureCalibrationData); return new float[]{temperatures[0], pressure}; } Bmx280(String bus);  Bmx280(String bus, int address);   Bmx280(I2cDevice device); void setMode(@Mode int mode); void setTemperatureOversampling(@Oversampling int oversampling); void setPressureOversampling(@Oversampling int oversampling); void setHumidityOversampling(@Oversampling int oversampling); @Oversampling int getTemperatureOversampling(); @Oversampling int getPressureOversampling(); @Oversampling int getHumidityOversampling(); @Override void close(); int getChipId(); boolean hasHumiditySensor(); float readTemperature(); float readPressure(); float readHumidity(); float[] readTemperatureAndPressure(); }
Bmx280 implements AutoCloseable { public float[] readTemperatureAndPressure() throws IOException, IllegalStateException { if (mTemperatureOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("temperature oversampling is skipped"); } if (mPressureOversampling == OVERSAMPLING_SKIPPED) { throw new IllegalStateException("pressure oversampling is skipped"); } int rawTemp = readSample(BMX280_REG_TEMP); float[] temperatures = compensateTemperature(rawTemp, mTempCalibrationData); int rawPressure = readSample(BMX280_REG_PRESS); float pressure = compensatePressure(rawPressure, temperatures[1], mPressureCalibrationData); return new float[]{temperatures[0], pressure}; } Bmx280(String bus);  Bmx280(String bus, int address);   Bmx280(I2cDevice device); void setMode(@Mode int mode); void setTemperatureOversampling(@Oversampling int oversampling); void setPressureOversampling(@Oversampling int oversampling); void setHumidityOversampling(@Oversampling int oversampling); @Oversampling int getTemperatureOversampling(); @Oversampling int getPressureOversampling(); @Oversampling int getHumidityOversampling(); @Override void close(); int getChipId(); boolean hasHumiditySensor(); float readTemperature(); float readPressure(); float readHumidity(); float[] readTemperatureAndPressure(); static final int CHIP_ID_BMP280; static final int CHIP_ID_BME280; static final int DEFAULT_I2C_ADDRESS; @Deprecated
    static final int I2C_ADDRESS; static final float MIN_TEMP_C; static final float MAX_TEMP_C; static final float MIN_PRESSURE_HPA; static final float MAX_PRESSURE_HPA; static final float MIN_HUM_RH; static final float MAX_HUM_RH; static final float MAX_POWER_CONSUMPTION_TEMP_UA; static final float MAX_POWER_CONSUMPTION_PRESSURE_UA; static final float MAX_POWER_CONSUMPTION_HUMIDITY_UA; static final float MAX_FREQ_HZ; static final float MIN_FREQ_HZ; static final int MODE_SLEEP; static final int MODE_FORCED; static final int MODE_NORMAL; static final int OVERSAMPLING_SKIPPED; static final int OVERSAMPLING_1X; }