|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
Sensirion SHT3x temperature / humidity sensor codec (PROTOCORE_ENABLE_SHT3X). More...
#include "protocore_config.h"Go to the source code of this file.
Sensirion SHT3x temperature / humidity sensor codec (PROTOCORE_ENABLE_SHT3X).
The SHT3x (SHT30 / SHT31 / SHT35) answers a single-shot measurement command with six bytes: a 16-bit temperature word + its CRC-8, then a 16-bit humidity word + its CRC-8. The CRC is the Sensirion CRC-8 (polynomial 0x31, init 0xFF, no reflection, no final XOR; the datasheet check value is 0xBEEF -> 0x92). Raw ticks convert linearly: T[C] = -45 + 175 * raw / 65535 RH[%] = 100 * raw / 65535
To stay heap- and float-printf-free, the results are returned as signed integer milli-units (milli-degrees C, milli-percent RH). The CRC check and the conversion are pure and host-tested; only the command write / data read touches I2C.
A cheap solder-and-bench-test breakout (GY-SHT31 etc.): read it, bridge the reading onto the network as telemetry.
Definition in file sht3x.h.