ESPHome
2024.12.2
esphome
esphome
components
jsn_sr04t
jsn_sr04t.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <vector>
4
5
#include "
esphome/core/component.h
"
6
#include "
esphome/components/sensor/sensor.h
"
7
#include "
esphome/components/uart/uart.h
"
8
9
namespace
esphome
{
10
namespace
jsn_sr04t {
11
12
enum
Model
{
13
JSN_SR04T
,
14
AJ_SR04M
,
15
};
16
17
class
Jsnsr04tComponent
:
public
sensor::Sensor
,
public
PollingComponent
,
public
uart::UARTDevice
{
18
public
:
19
void
set_model
(
Model
model) { this->
model_
= model; }
20
21
// ========== INTERNAL METHODS ==========
22
void
update
()
override
;
23
void
loop
()
override
;
24
void
dump_config
()
override
;
25
26
protected
:
27
void
check_buffer_
();
28
Model
model_
;
29
30
std::vector<uint8_t>
buffer_
;
31
};
32
33
}
// namespace jsn_sr04t
34
}
// namespace esphome
uart.h
esphome::jsn_sr04t::JSN_SR04T
Definition:
jsn_sr04t.h:13
esphome::PollingComponent
This class simplifies creating components that periodically check a state.
Definition:
component.h:283
esphome::jsn_sr04t::Jsnsr04tComponent::loop
void loop() override
Definition:
jsn_sr04t.cpp:17
sensor.h
esphome::jsn_sr04t::Jsnsr04tComponent::dump_config
void dump_config() override
Definition:
jsn_sr04t.cpp:59
esphome::jsn_sr04t::Jsnsr04tComponent::buffer_
std::vector< uint8_t > buffer_
Definition:
jsn_sr04t.h:30
esphome::jsn_sr04t::Model
Model
Definition:
jsn_sr04t.h:12
esphome::jsn_sr04t::Jsnsr04tComponent::model_
Model model_
Definition:
jsn_sr04t.h:28
esphome::jsn_sr04t::Jsnsr04tComponent::check_buffer_
void check_buffer_()
Definition:
jsn_sr04t.cpp:33
esphome::uart::UARTDevice
Definition:
uart.h:12
esphome::jsn_sr04t::Jsnsr04tComponent
Definition:
jsn_sr04t.h:17
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
component.h
esphome::jsn_sr04t::Jsnsr04tComponent::set_model
void set_model(Model model)
Definition:
jsn_sr04t.h:19
esphome::sensor::Sensor
Base-class for all sensors.
Definition:
sensor.h:57
esphome::jsn_sr04t::Jsnsr04tComponent::update
void update() override
Definition:
jsn_sr04t.cpp:12
esphome::jsn_sr04t::AJ_SR04M
Definition:
jsn_sr04t.h:14
Generated by
1.8.13