ESPHome
2026.2.4
Loading...
Searching...
No Matches
esphome
components
mcp3204
sensor
mcp3204_sensor.cpp
Go to the documentation of this file.
1
#include "
mcp3204_sensor.h
"
2
3
#include "
esphome/core/log.h
"
4
5
namespace
esphome
{
6
namespace
mcp3204 {
7
8
static
const
char
*
const
TAG =
"mcp3204.sensor"
;
9
10
void
MCP3204Sensor::dump_config
() {
11
LOG_SENSOR(
""
,
"MCP3204 Sensor"
,
this
);
12
ESP_LOGCONFIG(TAG,
13
" Pin: %u\n"
14
" Differential Mode: %s"
,
15
this->
pin_
, YESNO(this->
differential_mode_
));
16
LOG_UPDATE_INTERVAL(
this
);
17
}
18
float
MCP3204Sensor::sample
() {
return
this->
parent_
->read_data(this->
pin_
, this->
differential_mode_
); }
19
void
MCP3204Sensor::update
() { this->
publish_state
(this->
sample
()); }
20
21
}
// namespace mcp3204
22
}
// namespace esphome
esphome::Parented< MCP3204 >::parent_
MCP3204 * parent_
Definition
helpers.h:1482
esphome::mcp3204::MCP3204Sensor::pin_
uint8_t pin_
Definition
mcp3204_sensor.h:25
esphome::mcp3204::MCP3204Sensor::differential_mode_
bool differential_mode_
Definition
mcp3204_sensor.h:26
esphome::mcp3204::MCP3204Sensor::dump_config
void dump_config() override
Definition
mcp3204_sensor.cpp:10
esphome::mcp3204::MCP3204Sensor::sample
float sample() override
Definition
mcp3204_sensor.cpp:18
esphome::mcp3204::MCP3204Sensor::update
void update() override
Definition
mcp3204_sensor.cpp:19
esphome::sensor::Sensor::publish_state
void publish_state(float state)
Publish a new state to the front-end.
Definition
sensor.cpp:65
log.h
mcp3204_sensor.h
esphome
Providing packet encoding functions for exchanging data with a remote host.
Definition
a01nyub.cpp:7
Generated by
1.12.0