ESPHome
2026.10.0-dev
Loading...
Searching...
No Matches
esphome
components
ds1603l
ds1603l.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <cstddef>
4
#include <cstdint>
5
6
#include "
esphome/components/sensor/sensor.h
"
7
#include "
esphome/components/uart/uart.h
"
8
#include "
esphome/core/component.h
"
9
10
namespace
esphome::ds1603l
{
11
12
class
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
esphome::Component
Definition
component.h:145
esphome::ds1603l::DS1603L
Definition
ds1603l.h:12
esphome::ds1603l::DS1603L::dump_config
void dump_config() override
Definition
ds1603l.cpp:35
esphome::ds1603l::DS1603L::rx_count_
size_t rx_count_
Definition
ds1603l.h:27
esphome::ds1603l::DS1603L::loop
void loop() override
Definition
ds1603l.cpp:12
esphome::ds1603l::DS1603L::resync_
void resync_()
Definition
ds1603l.cpp:56
esphome::ds1603l::DS1603L::rx_buffer_
uint8_t rx_buffer_[FRAME_SIZE]
Definition
ds1603l.h:26
esphome::ds1603l::DS1603L::HEADER_BYTE
static constexpr uint8_t HEADER_BYTE
Definition
ds1603l.h:18
esphome::ds1603l::DS1603L::FRAME_SIZE
static constexpr size_t FRAME_SIZE
Definition
ds1603l.h:19
esphome::ds1603l::DS1603L::parse_data_
bool parse_data_()
Definition
ds1603l.cpp:37
esphome::sensor::Sensor
Base-class for all sensors.
Definition
sensor.h:47
esphome::uart::UARTDevice
Definition
uart.h:12
component.h
esphome::ds1603l
Definition
ds1603l.cpp:8
sensor.h
uart.h
Generated by
1.12.0