ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
mcp3204_sensor.cpp
Go to the documentation of this file.
1#include "mcp3204_sensor.h"
2
3#include "esphome/core/log.h"
4
5namespace esphome::mcp3204 {
6
7static const char *const TAG = "mcp3204.sensor";
8
10 LOG_SENSOR("", "MCP3204 Sensor", this);
11 ESP_LOGCONFIG(TAG,
12 " Pin: %u\n"
13 " Differential Mode: %s",
14 this->pin_, YESNO(this->differential_mode_));
15 LOG_UPDATE_INTERVAL(this);
16}
17float MCP3204Sensor::sample() { return this->parent_->read_data(this->pin_, this->differential_mode_); }
18void MCP3204Sensor::update() { this->publish_state(this->sample()); }
19
20} // namespace esphome::mcp3204
void publish_state(float state)
Publish a new state to the front-end.
Definition sensor.cpp:68