Table of Contents

Class Bmxx80Base

Namespace
Iot.Device.Bmxx80
Assembly
Iot.Device.Bmxx80.dll

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

deviceId byte

The ID of the device.

i2cDevice I2cDevice

The I2cDevice to create with.

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

Bmxx80Base.CommunicationProtocol

ControlRegister

Gets or sets control register of the sensor.

protected byte ControlRegister { get; set; }

Property Value

byte

I2cDevice

Gets or sets I2C device used to communicate with the device.

protected I2cDevice I2cDevice { get; set; }

Property Value

I2cDevice

PressureSampling

Gets or sets the pressure sampling.

public Sampling PressureSampling { get; set; }

Property Value

Sampling

Exceptions

ArgumentOutOfRangeException

Thrown when the Sampling is set to an undefined mode.

TempCalibrationFactor

The temperature calibration factor.

protected virtual int TempCalibrationFactor { get; }

Property Value

int

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

double

TemperatureSampling

Gets or sets the temperature sampling.

public Sampling TemperatureSampling { get; set; }

Property Value

Sampling

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 byte

Value to convert.

Returns

Sampling

Sampling

CompensateTemperature(int)

Compensates the temperature.

protected Temperature CompensateTemperature(int adcTemperature)

Parameters

adcTemperature int

The 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 bool

True 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 byte

Register to read from.

endianness Bmxx80Base.Endianness

Interpretation 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 byte

Register to read from.

endianness Bmxx80Base.Endianness

Interpretation 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 byte

Register 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 Pressure

Contains the measured pressure if the PressureSampling was not set to Skipped. Contains NaN otherwise.

Returns

bool
true
if measurement was not skipped, otherwise
false
.

TryReadTemperature(out Temperature)

Reads the temperature. A return value indicates whether the reading succeeded.

public abstract bool TryReadTemperature(out Temperature temperature)

Parameters

temperature Temperature

Contains the measured temperature if the TemperatureSampling was not set to Skipped. Contains NaN otherwise.

Returns

bool
true
if measurement was not skipped, otherwise
false
.