Syntax
public abstract class Bme68x : PollingSensorBase<(Units.Temperature? Temperature, RelativeHumidity? Humidity, Pressure? Pressure, Resistance? GasResistance)>, ISamplingSensor<(Units.Temperature? Temperature, RelativeHumidity? Humidity, Pressure? Pressure, Resistance? GasResistance)>, ISamplingSensor<(Units.Temperature? Temperature, RelativeHumidity? Humidity, Pressure? Pressure, Resistance? GasResistance)>, ITemperatureSensor, IHumiditySensor, IBarometricPressureSensor
Constructors
Bme68x(II2cBus, Byte)
Creates a new instance of the BME68x class
Declaration
protected Bme68x(II2cBus i2cBus, byte address = null)
Parameters
Type | Name | Description |
---|---|---|
II2cBus | i2cBus | I2C Bus to use for communicating with the sensor |
System.Byte | address | I2C address of the sensor. |
Bme68x(ISpiBus, IDigitalOutputPort, Bme68x.Configuration)
Creates a new instance of the BME68x class
Declaration
protected Bme68x(ISpiBus spiBus, IDigitalOutputPort chipSelectPort, Bme68x.Configuration configuration = null)
Parameters
Type | Name | Description |
---|---|---|
ISpiBus | spiBus | The SPI bus connected to the device |
IDigitalOutputPort | chipSelectPort | The chip select pin |
Bme68x.Configuration | configuration | The BMP68x configuration (optional) |
Bme68x(ISpiBus, IPin)
Creates a new instance of the BME68x class
Declaration
protected Bme68x(ISpiBus spiBus, IPin chipSelectPin)
Parameters
Type | Name | Description |
---|---|---|
ISpiBus | spiBus | The SPI bus connected to the device |
IPin | chipSelectPin | The chip select pin |
Properties
FilterMode
Gets / sets the filtering mode to be used for measurements
Declaration
public Bme68x.FilteringMode FilterMode { get; set; }
Property Value
Type | Description |
---|---|
Bme68x.FilteringMode |
GasConversionIsEnabled
Enable / disable gas conversions
Declaration
public bool GasConversionIsEnabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
GasResistance
The current gas resistance
Declaration
public Resistance? GasResistance { get; }
Property Value
Type | Description |
---|---|
System.Nullable<Resistance> |
HeaterIsEnabled
Enable / disable the sensor heater
Declaration
public bool HeaterIsEnabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
HeaterProfile
Gets / sets the heater profile to be used for measurements
Declaration
public Bme68x.HeaterProfileType HeaterProfile { get; set; }
Property Value
Type | Description |
---|---|
Bme68x.HeaterProfileType |
Humidity
The current humidity, in percent relative humidity
Declaration
public RelativeHumidity? Humidity { get; }
Property Value
Type | Description |
---|---|
System.Nullable<RelativeHumidity> |
HumidityOversampleMode
The humidity oversampling mode
Declaration
public Bme68x.Oversample HumidityOversampleMode { get; set; }
Property Value
Type | Description |
---|---|
Bme68x.Oversample |
Pressure
The current pressure
Declaration
public Pressure? Pressure { get; }
Property Value
Type | Description |
---|---|
System.Nullable<Pressure> |
PressureOversampleMode
The pressure oversampling mode
Declaration
public Bme68x.Oversample PressureOversampleMode { get; set; }
Property Value
Type | Description |
---|---|
Bme68x.Oversample |
Temperature
The current temperature
Declaration
public Units.Temperature? Temperature { get; }
Property Value
Type | Description |
---|---|
System.Nullable<Units.Temperature> |
TemperatureOversampleMode
The temperature oversampling mode
Declaration
public Bme68x.Oversample TemperatureOversampleMode { get; set; }
Property Value
Type | Description |
---|---|
Bme68x.Oversample |
Methods
CompensateTemperature(Int32)
Compensates the temperature
Declaration
protected Units.Temperature CompensateTemperature(int rawTemperature)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rawTemperature | The temperature value read from the device |
Returns
Type | Description |
---|---|
Units.Temperature | The temperature |
ConfigureHeatingProfile(Bme68x.HeaterProfileType, Units.Temperature, TimeSpan, Units.Temperature)
Configures a heater profile, making it ready for use.
Declaration
public void ConfigureHeatingProfile(Bme68x.HeaterProfileType profile, Units.Temperature targetTemperature, TimeSpan duration, Units.Temperature ambientTemperature)
Parameters
Type | Name | Description |
---|---|---|
Bme68x.HeaterProfileType | profile | The heater profile to configure |
Units.Temperature | targetTemperature | The target temperature (0-400 C) |
TimeSpan | duration | The measurement duration (0-4032ms) |
Units.Temperature | ambientTemperature | The ambient temperature |
GetMeasurementDuration(Bme68x.HeaterProfileType)
Gets the required time in to perform a measurement. The duration of the gas measurement is not considered if GasConversionIsEnabled is set to false or the chosen HeaterProfile is not configured. The precision of this duration is within 1ms of the actual measurement time.
Declaration
public TimeSpan GetMeasurementDuration(Bme68x.HeaterProfileType profile)
Parameters
Type | Name | Description |
---|---|---|
Bme68x.HeaterProfileType | profile | The used HeaterProfile. |
Returns
Type | Description |
---|---|
TimeSpan |
GetPowerMode()
Get the current power mode
Declaration
public Bme68x.PowerMode GetPowerMode()
Returns
Type | Description |
---|---|
Bme68x.PowerMode | The power mode |
Initialize()
Initialize the sensor
Declaration
protected void Initialize()
RaiseEventsAndNotify(IChangeResult<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity, Nullable<Pressure> Pressure, Nullable<Resistance> GasResistance)>)
Raise events for subcribers and notify of value changes
Declaration
protected override void RaiseEventsAndNotify(IChangeResult<(Units.Temperature? Temperature, RelativeHumidity? Humidity, Pressure? Pressure, Resistance? GasResistance)> changeResult)
Parameters
Type | Name | Description |
---|---|---|
IChangeResult<System.ValueTuple<System.Nullable<Units.Temperature>, System.Nullable<RelativeHumidity>, System.Nullable<Pressure>, System.Nullable<Resistance>>> | changeResult | The updated sensor data |
ReadSensor()
Reads data from the sensor
Declaration
protected override Task<(Units.Temperature? Temperature, RelativeHumidity? Humidity, Pressure? Pressure, Resistance? GasResistance)> ReadSensor()
Returns
Type | Description |
---|---|
Task<System.ValueTuple<System.Nullable<Units.Temperature>, System.Nullable<RelativeHumidity>, System.Nullable<Pressure>, System.Nullable<Resistance>>> | The latest sensor reading |
Overrides
Reset()
Perform a complete power-on-reset
Declaration
public void Reset()
SetPowerMode(Bme68x.PowerMode)
Sets the power mode to the given mode
Declaration
public void SetPowerMode(Bme68x.PowerMode powerMode)
Parameters
Type | Name | Description |
---|---|---|
Bme68x.PowerMode | powerMode | The Bme68x.PowerMode to set. |
Events
GasResistanceUpdated
Raised when the gas resistance value changes
Declaration
public event EventHandler<IChangeResult<Resistance>> GasResistanceUpdated
Event Type
Type | Description |
---|---|
EventHandler<IChangeResult<Resistance>> |
HumidityUpdated
Raised when the humidity value changes
Declaration
public event EventHandler<IChangeResult<RelativeHumidity>> HumidityUpdated
Event Type
Type | Description |
---|---|
EventHandler<IChangeResult<RelativeHumidity>> |
PressureUpdated
Raised when the pressure value changes
Declaration
public event EventHandler<IChangeResult<Pressure>> PressureUpdated
Event Type
Type | Description |
---|---|
EventHandler<IChangeResult<Pressure>> |
TemperatureUpdated
Raised when the temperature value changes
Declaration
public event EventHandler<IChangeResult<Units.Temperature>> TemperatureUpdated
Event Type
Type | Description |
---|---|
EventHandler<IChangeResult<Units.Temperature>> |