|
| constexpr uint8_t | DS18B20::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 | DS18B20::decode (const ScratchPad &buf) |
| | The reading of a scratchpad, its CRC checked.
|
| |
| constexpr bool | isValidTemperature (int16_t temperature_x100) |
| | Whether a temperature reading is valid, and so worth sending.
|
| |
| constexpr int16_t | DS18B20::skipPowerOnValue (int16_t reading, int16_t previous) |
| | The reading to keep, the power-on value skipped.
|
| |
| constexpr int16_t | DS18B20::toHundredths (uint8_t lsb, uint8_t msb) |
| | The temperature of the register, in hundredths of °C.
|
| |
The checks of a DS18B20 reading: CRC, conversion to hundredths of °C, range, power-on value.
- Author
- Frédéric Metrich (frede.nosp@m.ric..nosp@m.metri.nosp@m.ch@l.nosp@m.ive.f.nosp@m.r)
- Version
- 0.1
- Date
- 2026-11-21
- Copyright
- Copyright (c) 2026-2026 SPDX-License-Identifier: GPL-3.0-or-later
The bus I/O stays in utils_temp.h. Here, what is done with the 9 bytes of the scratchpad once read, and with the reading once converted:
- the CRC of the scratchpad (Dallas/Maxim CRC-8, the one of the OneWire library),
- the temperature, x16 in the sensor, x100 here,
- the range of the sensor (-55 to +125 °C),
- the power-on value (85.00 °C), skipped after a jump,
- which values are not a temperature, and so are not sent.
No Arduino dependency: the native tests run it (test/native/test_ds18b20).
Definition in file ds18b20.h.