42 MockOneWire() =
default;
44 void begin(uint8_t) {}
53 void select(
const uint8_t*) {}
55 void write(uint8_t) {}
62 void write_bit(uint8_t) {}
147 info(F(
"Temperature sensors found on pin "));
155 constexpr uint8_t MAX_LISTED{ 16 };
156 static_assert(MAX_LISTED == 16,
"update the message below");
157 while (search.next(found.
addr))
159 if (MAX_LISTED == count)
162 infoln(F(
"\t... more than 16: noise on the bus? Check the wiring"));
167 for (uint8_t
i = 0;
i != 8; ++
i)
170 if (found.
addr[
i] < 0x10)
184 infoln(F(
" CRC error: check the wiring"));
193 infoln(F(
"\tnone: check the wiring and the pull-up resistor"));
303 template< u
int8_t IDX >
306 static_assert(IDX < N,
"Sensor index out of bounds! Check your sensor configuration.");
343 for (uint8_t idx = 0; idx != N; ++idx)
The successive searches of a 1-Wire bus, one device each.
Implements temperature sensing functionality for multiple sensors.
bool isConfigured(const DeviceAddress &device) const
Whether config.h lists this sensor.
int16_t readTemperature() const
Read temperature from a specific sensor (compile-time bounds checking).
void initTemperatureSensors() const
Initialize the Dallas temperature sensors.
void requestTemperatures() const
Request temperature conversion for all sensors.
static constexpr uint8_t MATCH_ROM
int16_t readTemperature(const uint8_t idx) const
Reads the temperature of a specific sensor (runtime bounds checking).
void readScratchpad(const uint8_t idx) const
READ, the second transaction: the second half of the ROM code, Read Scratchpad, the 9 bytes of the sc...
int16_t endRead() const
CLOSE, the last transaction: a reset (the sensor still there?), the reading decoded.
constexpr TempSensors(const TemperatureSensing< N > &sensors)
The sensors of config.h.
void printSensorsOnBus() const
Lists the sensors on the bus, with their ROM codes as config.h takes them.
static constexpr uint8_t ROM_HALF
static OneWireType oneWire
bool startRead(const uint8_t idx) const
ADDRESS, the first transaction of a sensor's read: reset, Match ROM, the first half of its ROM code.
static DS18B20::ScratchPad scratchPad
The temperature sensors, as in config.h: the pin of the bus and the address of each sensor.
constexpr TemperatureSensing()=delete
const DeviceAddress sensorAddrs[N]
typename conditional< Condition, TrueType, FalseType >::type conditional_t
Router configuration: loads, relays, control pins and features.
constexpr bool CALIBRATION_MODE
constexpr bool TEMP_SENSOR_PRESENT
The text output: informational messages (info) and debug messages (debug)
void infoln(const Args &... args)
Print an informational message and a line end, as Serial.println() does.
void info(const Args &... args)
Print an informational message, as Serial.print() does.
The checks of a DS18B20 reading: CRC, conversion to hundredths of °C, range, power-on value.
constexpr uint8_t CONVERT_TEMPERATURE
constexpr int16_t DEVICE_DISCONNECTED_RAW
constexpr uint8_t READ_SCRATCHPAD
void begin()
Starts counting: from the last instruction on, one count per CPU cycle.
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 decode(const ScratchPad &buf)
The reading of a scratchpad, its CRC checked.
uint8_t[9] ScratchPad
The scratchpad: temperature LSB and MSB, TH, TL, configuration, 3 reserved bytes, CRC.
The ROM search of a 1-Wire bus, on the bit primitives of the bus.
Structure representing the address of a device.
conditional_t< TEMP_SENSOR_PRESENT, OneWire, MockOneWire > OneWireType
TempSensors(const TemperatureSensing< N > &) -> TempSensors< N >
Deduction guide: N from the sensors of config.h.