Class Bmxx80Base
Represents the core functionality of the Bmxx80 family.
public abstract class Bmxx80Base
- Inheritance
-
Bmxx80Base
- Derived
Constructors
Bmxx80Base(byte, I2cDevice)
Initializes a new instance of the Bmxx80Base class.
protected Bmxx80Base(byte deviceId, I2cDevice i2cDevice)
Parameters
Exceptions
- ArgumentNullException
Thrown when the given I2cDevice is null.
- IOException
Thrown when the device cannot be found on the bus.
Properties
CommunicationProtocol1
Gets or sets chosen communication protocol.
protected Bmxx80Base.CommunicationProtocol CommunicationProtocol1 { get; set; }
Property Value
ControlRegister
Gets or sets control register of the sensor.
protected byte ControlRegister { get; set; }
Property Value
I2cDevice
Gets or sets I2C device used to communicate with the device.
protected I2cDevice I2cDevice { get; set; }
Property Value
PressureSampling
Gets or sets the pressure sampling.
public Sampling PressureSampling { get; set; }
Property Value
Exceptions
- ArgumentOutOfRangeException
Thrown when the Sampling is set to an undefined mode.
TempCalibrationFactor
The temperature calibration factor.
protected virtual int TempCalibrationFactor { get; }
Property Value
TemperatureFine
Gets or sets TemperatureFine carries a fine resolution temperature value over to the pressure compensation formula and could be implemented as a global variable.
protected double TemperatureFine { get; set; }
Property Value
TemperatureSampling
Gets or sets the temperature sampling.
public Sampling TemperatureSampling { get; set; }
Property Value
Exceptions
- ArgumentOutOfRangeException
Thrown when the Sampling is set to an undefined mode.
Methods
ByteToSampling(byte)
Converts byte to Sampling.
protected Sampling ByteToSampling(byte value)
Parameters
value
byteValue to convert.
Returns
CompensateTemperature(int)
Compensates the temperature.
protected Temperature CompensateTemperature(int adcTemperature)
Parameters
adcTemperature
intThe temperature value read from the device.
Returns
- Temperature
The Temperature.
Dispose()
Cleanup.
public void Dispose()
Dispose(bool)
Releases the unmanaged resources used by the Bmxx80 and optionally releases the managed resources.
protected virtual void Dispose(bool disposing)
Parameters
disposing
boolTrue to release both managed and unmanaged resources; false to release only unmanaged resources.
Read16BitsFromRegister(byte, Endianness)
Reads a 16 bit value over I2C.
protected ushort Read16BitsFromRegister(byte register, Bmxx80Base.Endianness endianness = Endianness.LittleEndian)
Parameters
register
byteRegister to read from.
endianness
Bmxx80Base.EndiannessInterpretation of the bytes (big or little endian).
Returns
- ushort
Value from register.
Read24BitsFromRegister(byte, Endianness)
Reads a 24 bit value over I2C.
protected uint Read24BitsFromRegister(byte register, Bmxx80Base.Endianness endianness = Endianness.LittleEndian)
Parameters
register
byteRegister to read from.
endianness
Bmxx80Base.EndiannessInterpretation of the bytes (big or little endian).
Returns
- uint
Value from register.
Read8BitsFromRegister(byte)
Reads an 8 bit value from a register.
protected byte Read8BitsFromRegister(byte register)
Parameters
register
byteRegister to read from.
Returns
- byte
Value from register.
Reset()
When called, the device is reset using the complete power-on-reset procedure. The device will reset to the default configuration.
public void Reset()
SetDefaultConfiguration()
Sets the default configuration for the sensor.
protected virtual void SetDefaultConfiguration()
TryReadPressure(out Pressure)
Reads the pressure. A return value indicates whether the reading succeeded.
public abstract bool TryReadPressure(out Pressure pressure)
Parameters
pressure
PressureContains the measured pressure if the PressureSampling was not set to Skipped. Contains NaN otherwise.
Returns
- bool
if measurement was not skipped, otherwisetrue
.false
TryReadTemperature(out Temperature)
Reads the temperature. A return value indicates whether the reading succeeded.
public abstract bool TryReadTemperature(out Temperature temperature)
Parameters
temperature
TemperatureContains the measured temperature if the TemperatureSampling was not set to Skipped. Contains NaN otherwise.
Returns
- bool
if measurement was not skipped, otherwisetrue
.false