ESPHome  2024.11.0
ads1118_sensor.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "esphome/core/helpers.h"
5 
8 
9 #include "../ads1118.h"
10 
11 namespace esphome {
12 namespace ads1118 {
13 
15  public sensor::Sensor,
17  public Parented<ADS1118> {
18  public:
19  void update() override;
20 
21  void set_multiplexer(ADS1118Multiplexer multiplexer) { this->multiplexer_ = multiplexer; }
22  void set_gain(ADS1118Gain gain) { this->gain_ = gain; }
23  void set_temperature_mode(bool temp) { this->temperature_mode_ = temp; }
24 
25  float sample() override;
26 
27  void dump_config() override;
28 
29  protected:
33 };
34 
35 } // namespace ads1118
36 } // namespace esphome
void set_multiplexer(ADS1118Multiplexer multiplexer)
ADS1118Multiplexer multiplexer_
Abstract interface for components to request voltage (usually ADC readings)
This class simplifies creating components that periodically check a state.
Definition: component.h:283
void set_gain(ADS1118Gain gain)
AlsGain501 gain
void set_temperature_mode(bool temp)
Implementation of SPI Controller mode.
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:522