Class Hdc1080
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
rawushortThe raw.
Returns
- float
The value the C ABI computes.
ConfigFromRegister(ushort)
Parses an HDC1080 configuration register value.
public static PamojaHdc1080Config ConfigFromRegister(ushort raw)
Parameters
rawushortThe 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
configPamojaHdc1080ConfigThe 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
configPamojaHdc1080ConfigThe 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
bitsbyteThe 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
milliPercentuintThe 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
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
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
rawushortThe 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
rawushortThe 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
bytesReadOnlySpan<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
rawushortThe 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
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
serialulongThe 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
bitsbyteThe 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
milliCelsiusintThe milli celsius.
Returns
- ushort
The value the C ABI computes.