Table of Contents

Class Hdc1080

Namespace
Pamoja.Sensors
Assembly
Pamoja.Sensors.dll

A Texas Instruments HDC1080 humidity and temperature sensor. Every call goes straight to the pamoja C ABI, which decodes exactly what the manufacturer's datasheet specifies.

public static class Hdc1080
Inheritance
Hdc1080
Inherited Members

Methods

Celsius(ushort)

Converts a raw HDC1080 temperature register to degrees Celsius.

public static float Celsius(ushort raw)

Parameters

raw ushort

The raw.

Returns

float

The value the C ABI computes.

ConfigFromRegister(ushort)

Parses an HDC1080 configuration register value.

public static PamojaHdc1080Config ConfigFromRegister(ushort raw)

Parameters

raw ushort

The raw.

Returns

PamojaHdc1080Config

The decoded value.

Exceptions

PamojaException

The device data is not valid.

ConfigToRegister(PamojaHdc1080Config)

Assembles an HDC1080 configuration register value.

public static ushort ConfigToRegister(PamojaHdc1080Config config)

Parameters

config PamojaHdc1080Config

The config.

Returns

ushort

The decoded value.

Exceptions

PamojaException

The device data is not valid.

ConversionTimeMicros(PamojaHdc1080Config)

Returns how long to wait after triggering an HDC1080 in a configuration.

public static uint ConversionTimeMicros(PamojaHdc1080Config config)

Parameters

config PamojaHdc1080Config

The config.

Returns

uint

The decoded value.

Exceptions

PamojaException

The device data is not valid.

HumidityConversionMicros(byte)

Returns how long an HDC1080 humidity conversion takes at a resolution.

public static uint HumidityConversionMicros(byte bits)

Parameters

bits byte

The bits.

Returns

uint

The decoded value.

Exceptions

PamojaException

The device data is not valid.

HumidityRegister(uint)

Builds the HDC1080 humidity register that decodes to a relative humidity.

public static ushort HumidityRegister(uint milliPercent)

Parameters

milliPercent uint

The milli percent.

Returns

ushort

The value the C ABI computes.

MeasurementBytes(ushort, ushort)

Builds the four bytes an HDC1080 sends for a pair of raw registers.

public static byte[] MeasurementBytes(ushort temperatureRaw, ushort humidityRaw)

Parameters

temperatureRaw ushort

The temperature raw.

humidityRaw ushort

The humidity raw.

Returns

byte[]

The decoded value.

Exceptions

PamojaException

The device data is not valid.

MeasurementFromPhysical(int, uint)

Builds the HDC1080 measurement a sensor reporting these physical values would send.

public static PamojaHdc1080Measurement MeasurementFromPhysical(int milliCelsius, uint milliPercent)

Parameters

milliCelsius int

The milli celsius.

milliPercent uint

The milli percent.

Returns

PamojaHdc1080Measurement

The decoded value.

Exceptions

PamojaException

The device data is not valid.

MilliCelsius(ushort)

Converts a raw HDC1080 temperature register to milli-degrees Celsius.

public static int MilliCelsius(ushort raw)

Parameters

raw ushort

The raw.

Returns

int

The value the C ABI computes.

MilliPercent(ushort)

Converts a raw HDC1080 humidity register to milli-percent.

public static uint MilliPercent(ushort raw)

Parameters

raw ushort

The raw.

Returns

uint

The value the C ABI computes.

ParseMeasurement(ReadOnlySpan<byte>)

Parses the four bytes an HDC1080 sequential read returns.

public static PamojaHdc1080Measurement ParseMeasurement(ReadOnlySpan<byte> bytes)

Parameters

bytes ReadOnlySpan<byte>

The bytes.

Returns

PamojaHdc1080Measurement

The decoded value.

Exceptions

PamojaException

The device data is not valid.

RelativeHumidity(ushort)

Converts a raw HDC1080 humidity register to a relative humidity percentage.

public static float RelativeHumidity(ushort raw)

Parameters

raw ushort

The raw.

Returns

float

The value the C ABI computes.

SerialId(ushort, ushort, ushort)

Joins the three HDC1080 serial-ID registers into the 40-bit serial number.

public static ulong SerialId(ushort high, ushort mid, ushort low)

Parameters

high ushort

The high.

mid ushort

The mid.

low ushort

The low.

Returns

ulong

The value the C ABI computes.

SerialIdRegisters(ulong)

Splits a serial number back into the three HDC1080 serial-ID registers.

public static ushort SerialIdRegisters(ulong serial)

Parameters

serial ulong

The serial.

Returns

ushort

The decoded value.

Exceptions

PamojaException

The device data is not valid.

TemperatureConversionMicros(byte)

Returns how long an HDC1080 temperature conversion takes at a resolution.

public static uint TemperatureConversionMicros(byte bits)

Parameters

bits byte

The bits.

Returns

uint

The decoded value.

Exceptions

PamojaException

The device data is not valid.

TemperatureRegister(int)

Builds the HDC1080 temperature register that decodes to a temperature.

public static ushort TemperatureRegister(int milliCelsius)

Parameters

milliCelsius int

The milli celsius.

Returns

ushort

The value the C ABI computes.