Class Bmxx80Base
Represents the core functionality of the Bmxx80 family.
Namespace: Iot.Device.Bmxx80
Assembly: Iot.Device.Bmxx80.dll
Syntax
public abstract class Bmxx80Base
Constructors
Bmxx80Base(byte, I2cDevice)
Initializes a new instance of the Bmxx80Base class.
Declaration
protected Bmxx80Base(byte deviceId, I2cDevice i2cDevice)
Parameters
Type | Name | Description |
---|---|---|
byte | deviceId | The ID of the device. |
I2cDevice | i2cDevice | The I2cDevice to create with. |
Exceptions
Type | Condition |
---|---|
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.
Declaration
protected Bmxx80Base.CommunicationProtocol CommunicationProtocol1 { get; set; }
Property Value
Type | Description |
---|---|
Bmxx80Base.CommunicationProtocol |
ControlRegister
Gets or sets control register of the sensor.
Declaration
protected byte ControlRegister { get; set; }
Property Value
Type | Description |
---|---|
byte |
I2cDevice
Gets or sets I2C device used to communicate with the device.
Declaration
protected I2cDevice I2cDevice { get; set; }
Property Value
Type | Description |
---|---|
I2cDevice |
PressureSampling
Gets or sets the pressure sampling.
Declaration
public Sampling PressureSampling { get; set; }
Property Value
Type | Description |
---|---|
Sampling |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown when the Sampling is set to an undefined mode. |
TempCalibrationFactor
The temperature calibration factor.
Declaration
protected virtual int TempCalibrationFactor { get; }
Property Value
Type | Description |
---|---|
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.
Declaration
protected double TemperatureFine { get; set; }
Property Value
Type | Description |
---|---|
double |
TemperatureSampling
Gets or sets the temperature sampling.
Declaration
public Sampling TemperatureSampling { get; set; }
Property Value
Type | Description |
---|---|
Sampling |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown when the Sampling is set to an undefined mode. |
Methods
ByteToSampling(byte)
Converts byte to Sampling.
Declaration
protected Sampling ByteToSampling(byte value)
Parameters
Type | Name | Description |
---|---|---|
byte | value | Value to convert. |
Returns
Type | Description |
---|---|
Sampling |
CompensateTemperature(int)
Compensates the temperature.
Declaration
protected Temperature CompensateTemperature(int adcTemperature)
Parameters
Type | Name | Description |
---|---|---|
int | adcTemperature | The temperature value read from the device. |
Returns
Type | Description |
---|---|
Temperature | The Temperature. |
Dispose()
Cleanup.
Declaration
public void Dispose()
Dispose(bool)
Releases the unmanaged resources used by the Bmxx80 and optionally releases the managed resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | True to release both managed and unmanaged resources; false to release only unmanaged resources. |
Read16BitsFromRegister(byte, Endianness)
Reads a 16 bit value over I2C.
Declaration
protected ushort Read16BitsFromRegister(byte register, Bmxx80Base.Endianness endianness = Endianness.LittleEndian)
Parameters
Type | Name | Description |
---|---|---|
byte | register | Register to read from. |
Bmxx80Base.Endianness | endianness | Interpretation of the bytes (big or little endian). |
Returns
Type | Description |
---|---|
ushort | Value from register. |
Read24BitsFromRegister(byte, Endianness)
Reads a 24 bit value over I2C.
Declaration
protected uint Read24BitsFromRegister(byte register, Bmxx80Base.Endianness endianness = Endianness.LittleEndian)
Parameters
Type | Name | Description |
---|---|---|
byte | register | Register to read from. |
Bmxx80Base.Endianness | endianness | Interpretation of the bytes (big or little endian). |
Returns
Type | Description |
---|---|
uint | Value from register. |
Read8BitsFromRegister(byte)
Reads an 8 bit value from a register.
Declaration
protected byte Read8BitsFromRegister(byte register)
Parameters
Type | Name | Description |
---|---|---|
byte | register | Register to read from. |
Returns
Type | Description |
---|---|
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.
Declaration
public void Reset()
SetDefaultConfiguration()
Sets the default configuration for the sensor.
Declaration
protected virtual void SetDefaultConfiguration()
TryReadPressure(out Pressure)
Reads the pressure. A return value indicates whether the reading succeeded.
Declaration
public abstract bool TryReadPressure(out Pressure pressure)
Parameters
Type | Name | Description |
---|---|---|
Pressure | pressure | Contains the measured pressure if the PressureSampling was not set to Skipped. Contains NaN otherwise. |
Returns
Type | Description |
---|---|
bool |
if measurement was not skipped, otherwise .
|
TryReadTemperature(out Temperature)
Reads the temperature. A return value indicates whether the reading succeeded.
Declaration
public abstract bool TryReadTemperature(out Temperature temperature)
Parameters
Type | Name | Description |
---|---|---|
Temperature | temperature | Contains the measured temperature if the TemperatureSampling was not set to Skipped. Contains NaN otherwise. |
Returns
Type | Description |
---|---|
bool |
if measurement was not skipped, otherwise .
|