ESPHome  2024.10.2
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 MCP3204Sensor::MCP3204Sensor(uint8_t pin) : pin_(pin) {}
11 
13 
15  LOG_SENSOR("", "MCP3204 Sensor", this);
16  ESP_LOGCONFIG(TAG, " Pin: %u", this->pin_);
17  LOG_UPDATE_INTERVAL(this);
18 }
19 float MCP3204Sensor::sample() { return this->parent_->read_data(this->pin_); }
20 void MCP3204Sensor::update() { this->publish_state(this->sample()); }
21 
22 } // namespace mcp3204
23 } // namespace esphome
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:19
float get_setup_priority() const override
void publish_state(float state)
Publish a new state to the front-end.
Definition: sensor.cpp:39
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7