ESPHome 2026.10.0-dev
Loading...
Searching...
No Matches
ds1603l.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <cstdint>
5
9
10namespace esphome::ds1603l {
11
12class DS1603L final : public sensor::Sensor, public Component, public uart::UARTDevice {
13 public:
14 void loop() override;
15 void dump_config() override;
16
17 protected:
18 static constexpr uint8_t HEADER_BYTE = 0xFF;
19 static constexpr size_t FRAME_SIZE = 4;
20
21 // Validates the checksum of the frame in rx_buffer_ and publishes it. Returns false if the frame is invalid.
22 bool parse_data_();
23 // Drops the first buffered byte and realigns the buffer on the next possible header byte.
24 void resync_();
25
26 uint8_t rx_buffer_[FRAME_SIZE]; // Buffer for the frame being assembled
27 size_t rx_count_{0}; // Number of bytes currently in rx_buffer_
28};
29
30} // namespace esphome::ds1603l
void dump_config() override
Definition ds1603l.cpp:35
void loop() override
Definition ds1603l.cpp:12
uint8_t rx_buffer_[FRAME_SIZE]
Definition ds1603l.h:26
static constexpr uint8_t HEADER_BYTE
Definition ds1603l.h:18
static constexpr size_t FRAME_SIZE
Definition ds1603l.h:19
Base-class for all sensors.
Definition sensor.h:47