59constexpr uint8_t
crc8(
const uint8_t* data, uint8_t len)
64 uint8_t inbyte{ *data++ };
65 for (uint8_t
i = 8;
i != 0; --
i)
67 const bool mix{ ((crc ^ inbyte) & 0x01) != 0 };
90 const int16_t x16{
static_cast< int16_t
>((msb << 8) | lsb) };
91 return static_cast< int16_t
>((x16 * 6) + (x16 >> 2));
103 if (
crc8(buf, 8) != buf[8])
131 const int delta{ reading - previous };
constexpr uint8_t WRITE_SCRATCH
constexpr uint8_t CONVERT_TEMPERATURE
constexpr int16_t TEMP_RANGE_LOW
constexpr int16_t DEVICE_DISCONNECTED_RAW
constexpr uint8_t READ_SCRATCHPAD
constexpr int16_t OUTOFRANGE_TEMPERATURE
constexpr bool isValidTemperature(int16_t temperature_x100)
Whether a temperature reading is valid, and so worth sending.
constexpr int16_t TEMP_RANGE_HIGH
constexpr uint8_t crc8(const uint8_t *data, uint8_t len)
The Dallas/Maxim CRC-8 (x^8 + x^5 + x^4 + 1), as OneWire::crc8.
constexpr int16_t skipPowerOnValue(int16_t reading, int16_t previous)
The reading to keep, the power-on value skipped.
constexpr int16_t decode(const ScratchPad &buf)
The reading of a scratchpad, its CRC checked.
constexpr int16_t POWER_ON_JUMP
constexpr int16_t POWER_ON_VALUE
constexpr int16_t toHundredths(uint8_t lsb, uint8_t msb)
The temperature of the register, in hundredths of °C.
uint8_t[9] ScratchPad
The scratchpad: temperature LSB and MSB, TH, TL, configuration, 3 reserved bytes, CRC.
The readings of one sensor, the power-on value skipped.
int16_t operator()(const int16_t reading)
The reading to keep.