ESPHome  2024.4.0
mcp3008_sensor.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 #include "../mcp3008.h"
8 
9 namespace esphome {
10 namespace mcp3008 {
11 
13  public sensor::Sensor,
15  public Parented<MCP3008> {
16  public:
17  void set_reference_voltage(float reference_voltage) { this->reference_voltage_ = reference_voltage; }
18  void set_pin(uint8_t pin) { this->pin_ = pin; }
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  uint8_t pin_;
28 };
29 
30 } // namespace mcp3008
31 } // namespace esphome
Abstract interface for components to request voltage (usually ADC readings)
float get_setup_priority() const override
This class simplifies creating components that periodically check a state.
Definition: component.h:283
void set_reference_voltage(float reference_voltage)
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
Base-class for all sensors.
Definition: sensor.h:57
Helper class to easily give an object a parent of type T.
Definition: helpers.h:515