@Test public void setMode() throws IOException { Bmx280 bmx280 = new Bmx280(mI2c); bmx280.setMode(Bmx280.MODE_NORMAL); Mockito.verify(mI2c).writeRegByte(eq(Bmx280.BMX280_REG_CTRL), byteThat(hasBitsSet((byte) (Bmx280.MODE_NORMAL)))); Mockito.reset(mI2c); bmx280.setMode(Bmx280.MODE_SLEEP); Mockito.verify(mI2c).writeRegByte(eq(Bmx280.BMX280_REG_CTRL), byteThat(hasBitsSet((byte) (Bmx280.MODE_SLEEP)))); }
public void setMode(@Mode int mode) throws IOException { if (mDevice == null) { throw new IllegalStateException("I2C device not open"); } int regCtrl = mDevice.readRegByte(BMX280_REG_CTRL) & 0xff; if (mode == MODE_SLEEP) { regCtrl &= ~BMX280_POWER_MODE_MASK; } else { regCtrl |= BMX280_POWER_MODE_NORMAL; } mDevice.writeRegByte(BMX280_REG_CTRL, (byte)(regCtrl)); mMode = mode; }
Bmx280 implements AutoCloseable { public void setMode(@Mode int mode) throws IOException { if (mDevice == null) { throw new IllegalStateException("I2C device not open"); } int regCtrl = mDevice.readRegByte(BMX280_REG_CTRL) & 0xff; if (mode == MODE_SLEEP) { regCtrl &= ~BMX280_POWER_MODE_MASK; } else { regCtrl |= BMX280_POWER_MODE_NORMAL; } mDevice.writeRegByte(BMX280_REG_CTRL, (byte)(regCtrl)); mMode = mode; } }
Bmx280 implements AutoCloseable { public void setMode(@Mode int mode) throws IOException { if (mDevice == null) { throw new IllegalStateException("I2C device not open"); } int regCtrl = mDevice.readRegByte(BMX280_REG_CTRL) & 0xff; if (mode == MODE_SLEEP) { regCtrl &= ~BMX280_POWER_MODE_MASK; } else { regCtrl |= BMX280_POWER_MODE_NORMAL; } mDevice.writeRegByte(BMX280_REG_CTRL, (byte)(regCtrl)); mMode = mode; } Bmx280(String bus);  Bmx280(String bus, int address);   Bmx280(I2cDevice device); }
Bmx280 implements AutoCloseable { public void setMode(@Mode int mode) throws IOException { if (mDevice == null) { throw new IllegalStateException("I2C device not open"); } int regCtrl = mDevice.readRegByte(BMX280_REG_CTRL) & 0xff; if (mode == MODE_SLEEP) { regCtrl &= ~BMX280_POWER_MODE_MASK; } else { regCtrl |= BMX280_POWER_MODE_NORMAL; } mDevice.writeRegByte(BMX280_REG_CTRL, (byte)(regCtrl)); mMode = mode; } 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 void setMode(@Mode int mode) throws IOException { if (mDevice == null) { throw new IllegalStateException("I2C device not open"); } int regCtrl = mDevice.readRegByte(BMX280_REG_CTRL) & 0xff; if (mode == MODE_SLEEP) { regCtrl &= ~BMX280_POWER_MODE_MASK; } else { regCtrl |= BMX280_POWER_MODE_NORMAL; } mDevice.writeRegByte(BMX280_REG_CTRL, (byte)(regCtrl)); mMode = mode; } 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; }