Package com.diozero.devices
Class BME68x
java.lang.Object
com.diozero.devices.BME68x
- All Implemented Interfaces:
DeviceInterface
,BarometerInterface
,HygrometerInterface
,SensorInterface
,ThermometerInterface
,AutoCloseable
public class BME68x extends Object implements BarometerInterface, ThermometerInterface, HygrometerInterface
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BME68x.Data
static class
BME68x.HeaterConfig
static class
BME68x.HeaterProfile
Gas heater profile.static class
BME68x.IirFilterCoefficient
Infinite Impulse Response (IIR) filter.static class
BME68x.ODR
Operating (Output?) Data Rate (ODR) - standby time.static class
BME68x.OperatingMode
Operating mode.static class
BME68x.OversamplingMultiplier
Oversampling multiplier. -
Field Summary
Fields Modifier and Type Field Description static int
ALT_DEVICE_ADDRESS
static int
DEVICE_ADDRESS
static int
GAS_WAIT_SHARED_MS
static int
MAX_HUMIDITY_PERCENT
static int
MAX_PRESSURE_HPA
static int
MAX_TEMPERATURE_CELSIUS
static int
MIN_HUMIDITY_PERCENT
static int
MIN_PRESSURE_HPA
static int
MIN_TEMPERATURE_CELSIUS
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description void
close()
Close the driver and the underlying device.byte
getChipId()
Get the chip id.float
getGasResistance()
BME68x.OversamplingMultiplier
getHumidityOversample()
Get humidity oversampling modeBME68x.IirFilterCoefficient
getIirFilterConfig()
Get the IIR filter configurationBME68x.ODR
getOdr()
BME68x.OperatingMode
getOperatingMode()
Get the operating mode.float
getPressure()
Get the pressure in kPaBME68x.OversamplingMultiplier
getPressureOversample()
Get pressure oversampling modefloat
getRelativeHumidity()
Get the relative humidity in percent.int
getRemainingMeasureDuration(BME68x.OperatingMode targetOperatingMode)
Get the remaining duration in microseconds that can be used for heating using the currently configured humidity, temperature and pressure oversampling modes.BME68x.Data[]
getSensorData()
Read the pressure, temperature and humidity and gas data from the sensor, compensates the data and store it in the bme68x_data structure instance passed by the user.BME68x.Data[]
getSensorData(BME68x.OperatingMode operatingMode)
Read the pressure, temperature and humidity and gas data from the sensor, compensates the data and store it in the bme68x_data structure instance passed by the user.float
getTemperature()
Get temperature in degrees celsiusBME68x.OversamplingMultiplier
getTemperatureOversample()
Get temperature oversampling modebyte
getUniqueId()
Get the chip's identifier.byte
getVariantId()
Get the chip variant id.void
initialise()
Initialise the device.void
lowGasSelfTestCheck()
Self-test of low gas variant of BME68X (i.e.void
setConfiguration(BME68x.OversamplingMultiplier humidityOversampling, BME68x.OversamplingMultiplier temperatureOversampling, BME68x.OversamplingMultiplier pressureOversampling, BME68x.IirFilterCoefficient filter, BME68x.ODR odr)
Set the oversampling, filter and odr configuration.void
setHeaterConfiguration(BME68x.OperatingMode targetOpMode, BME68x.HeaterConfig heaterConfig)
Set the gas configuration of the sensor.void
setOperatingMode(BME68x.OperatingMode mode)
Set the operating mode.void
softReset()
Initiate a soft reset.
-
Field Details
-
MIN_TEMPERATURE_CELSIUS
public static int MIN_TEMPERATURE_CELSIUS -
MAX_TEMPERATURE_CELSIUS
public static int MAX_TEMPERATURE_CELSIUS -
MIN_PRESSURE_HPA
public static int MIN_PRESSURE_HPA -
MAX_PRESSURE_HPA
public static int MAX_PRESSURE_HPA -
MIN_HUMIDITY_PERCENT
public static int MIN_HUMIDITY_PERCENT -
MAX_HUMIDITY_PERCENT
public static int MAX_HUMIDITY_PERCENT -
GAS_WAIT_SHARED_MS
public static final int GAS_WAIT_SHARED_MS- See Also:
- Constant Field Values
-
DEVICE_ADDRESS
public static final int DEVICE_ADDRESS- See Also:
- Constant Field Values
-
ALT_DEVICE_ADDRESS
public static final int ALT_DEVICE_ADDRESS- See Also:
- Constant Field Values
-
-
Constructor Details
-
BME68x
public BME68x() -
BME68x
public BME68x(int controller)Create a new BME680 sensor driver connected on the given bus.- Parameters:
controller
- I2C bus the sensor is connected to.
-
BME68x
public BME68x(int controller, int address)Create a new BME680 sensor driver connected on the given bus and address.- Parameters:
controller
- I2C bus the sensor is connected to.address
- I2C address of the sensor.
-
-
Method Details
-
close
public void close()Close the driver and the underlying device.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceDeviceInterface
-
initialise
public void initialise()Initialise the device. bme68x_init -
softReset
public void softReset()Initiate a soft reset. bme68x_soft_reset -
getChipId
public byte getChipId()Get the chip id. read_chip_id- Returns:
- chip identifier
-
getVariantId
public byte getVariantId()Get the chip variant id. read_variant_id- Returns:
- chip variant identifier
-
getUniqueId
public byte getUniqueId()Get the chip's identifier. Note not documented.- Returns:
- chip unique id
-
getOperatingMode
Get the operating mode. bme68x_get_op_mode- Returns:
- Current operating mode
-
setOperatingMode
Set the operating mode. bme68x_set_op_mode- Parameters:
mode
- Target operating mode
-
setConfiguration
public void setConfiguration(BME68x.OversamplingMultiplier humidityOversampling, BME68x.OversamplingMultiplier temperatureOversampling, BME68x.OversamplingMultiplier pressureOversampling, BME68x.IirFilterCoefficient filter, BME68x.ODR odr)Set the oversampling, filter and odr configuration. bme68x_set_conf- Parameters:
humidityOversampling
- Humidity oversampling modetemperatureOversampling
- Temperature oversampling modepressureOversampling
- Pressure oversampling modefilter
- IIR Filter coefficientodr
- Standby time between sequential mode measurement profiles (BME688 only).
-
getHumidityOversample
Get humidity oversampling mode- Returns:
- Current humidity oversampling mode
-
getTemperatureOversample
Get temperature oversampling mode- Returns:
- Current temperature oversampling mode
-
getPressureOversample
Get pressure oversampling mode- Returns:
- Current pressure oversampling mode
-
getIirFilterConfig
Get the IIR filter configuration- Returns:
- IIR filter configuration
-
getOdr
-
getRemainingMeasureDuration
Get the remaining duration in microseconds that can be used for heating using the currently configured humidity, temperature and pressure oversampling modes. bme68x_get_meas_dur- Returns:
- remaining duration in microseconds
-
getSensorData
Read the pressure, temperature and humidity and gas data from the sensor, compensates the data and store it in the bme68x_data structure instance passed by the user. bme68x_get_data- Returns:
- Sensor data
-
getSensorData
Read the pressure, temperature and humidity and gas data from the sensor, compensates the data and store it in the bme68x_data structure instance passed by the user. bme68x_get_data- Parameters:
operatingMode
- Device operating mode- Returns:
- Sensor data
-
getTemperature
public float getTemperature()Description copied from interface:ThermometerInterface
Get temperature in degrees celsius- Specified by:
getTemperature
in interfaceThermometerInterface
- Returns:
- Temperature (deg C)
-
getPressure
public float getPressure()Description copied from interface:BarometerInterface
Get the pressure in kPa- Specified by:
getPressure
in interfaceBarometerInterface
- Returns:
- pressure in kPa
-
getRelativeHumidity
public float getRelativeHumidity()Description copied from interface:HygrometerInterface
Get the relative humidity in percent.- Specified by:
getRelativeHumidity
in interfaceHygrometerInterface
- Returns:
- The relative humidity in percent.
-
getGasResistance
public float getGasResistance() -
setHeaterConfiguration
public void setHeaterConfiguration(BME68x.OperatingMode targetOpMode, BME68x.HeaterConfig heaterConfig)Set the gas configuration of the sensor. bme68x_set_heatr_conf -
lowGasSelfTestCheck
public void lowGasSelfTestCheck()Self-test of low gas variant of BME68X (i.e. the BME680) bme68x_low_gas_selftest_check
-