ESPHome 2025.12.1
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 {
6namespace mcp3204 {
7
8static const char *const TAG = "mcp3204.sensor";
9
11
13 LOG_SENSOR("", "MCP3204 Sensor", this);
14 ESP_LOGCONFIG(TAG, " Pin: %u", this->pin_);
15 ESP_LOGCONFIG(TAG, " Differential Mode: %s", YESNO(this->differential_mode_));
16 LOG_UPDATE_INTERVAL(this);
17}
18float MCP3204Sensor::sample() { return this->parent_->read_data(this->pin_, this->differential_mode_); }
19void MCP3204Sensor::update() { this->publish_state(this->sample()); }
20
21} // namespace mcp3204
22} // namespace esphome
float get_setup_priority() const override
void publish_state(float state)
Publish a new state to the front-end.
Definition sensor.cpp:77
const float DATA
For components that import data from directly connected sensors like DHT.
Definition component.cpp:81
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7