ESPHome
2026.8.0-dev
Loading...
Searching...
No Matches
esphome
components
waveshare_io_ch32v003
sensor
waveshare_io_ch32v003_sensor.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/core/component.h
"
4
#include "
esphome/core/helpers.h
"
5
6
#include "
esphome/components/sensor/sensor.h
"
7
#include "
esphome/components/voltage_sampler/voltage_sampler.h
"
8
9
#include "
../waveshare_io_ch32v003.h
"
10
11
namespace
esphome::waveshare_io_ch32v003
{
12
13
class
WaveshareIOCH32V003Sensor
:
public
sensor::Sensor
,
14
public
PollingComponent
,
15
public
voltage_sampler::VoltageSampler
,
16
public
Parented
<WaveshareIOCH32V003Component> {
17
public
:
18
void
set_reference_voltage
(
float
reference_voltage) { this->
reference_voltage_
= reference_voltage; }
19
20
void
update
()
override
;
21
void
dump_config
()
override
;
22
float
get_setup_priority
()
const override
;
23
float
sample
()
override
;
24
25
protected
:
26
float
reference_voltage_
{9.9f};
// Default reference voltage for ADC calculations, can be overridden by user config
27
};
28
29
}
// namespace esphome::waveshare_io_ch32v003
esphome::Parented
Helper class to easily give an object a parent of type T.
Definition
helpers.h:1875
esphome::PollingComponent
This class simplifies creating components that periodically check a state.
Definition
component.h:510
esphome::sensor::Sensor
Base-class for all sensors.
Definition
sensor.h:47
esphome::voltage_sampler::VoltageSampler
Abstract interface for components to request voltage (usually ADC readings)
Definition
voltage_sampler.h:8
esphome::waveshare_io_ch32v003::WaveshareIOCH32V003Sensor
Definition
waveshare_io_ch32v003_sensor.h:16
esphome::waveshare_io_ch32v003::WaveshareIOCH32V003Sensor::sample
float sample() override
Definition
waveshare_io_ch32v003_sensor.cpp:18
esphome::waveshare_io_ch32v003::WaveshareIOCH32V003Sensor::get_setup_priority
float get_setup_priority() const override
Definition
waveshare_io_ch32v003_sensor.cpp:9
esphome::waveshare_io_ch32v003::WaveshareIOCH32V003Sensor::set_reference_voltage
void set_reference_voltage(float reference_voltage)
Definition
waveshare_io_ch32v003_sensor.h:18
esphome::waveshare_io_ch32v003::WaveshareIOCH32V003Sensor::dump_config
void dump_config() override
Definition
waveshare_io_ch32v003_sensor.cpp:11
esphome::waveshare_io_ch32v003::WaveshareIOCH32V003Sensor::reference_voltage_
float reference_voltage_
Definition
waveshare_io_ch32v003_sensor.h:26
esphome::waveshare_io_ch32v003::WaveshareIOCH32V003Sensor::update
void update() override
Definition
waveshare_io_ch32v003_sensor.cpp:25
component.h
helpers.h
esphome::waveshare_io_ch32v003
Definition
waveshare_io_ch32v003_output.cpp:5
sensor.h
voltage_sampler.h
waveshare_io_ch32v003.h
Generated by
1.12.0