ESPHome  2024.11.1
custom_output.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 #include <vector>
8 
9 namespace esphome {
10 namespace custom {
11 
13  public:
14  CustomBinaryOutputConstructor(const std::function<std::vector<output::BinaryOutput *>()> &init) {
15  this->outputs_ = init();
16  }
17 
18  output::BinaryOutput *get_output(int i) { return this->outputs_[i]; }
19 
20  protected:
21  std::vector<output::BinaryOutput *> outputs_;
22 };
23 
25  public:
26  CustomFloatOutputConstructor(const std::function<std::vector<output::FloatOutput *>()> &init) {
27  this->outputs_ = init();
28  }
29 
30  output::FloatOutput *get_output(int i) { return this->outputs_[i]; }
31 
32  protected:
33  std::vector<output::FloatOutput *> outputs_;
34 };
35 
36 } // namespace custom
37 } // namespace esphome
Base class for all output components that can output a variable level, like PWM.
Definition: float_output.h:31
output::FloatOutput * get_output(int i)
Definition: custom_output.h:30
CustomFloatOutputConstructor(const std::function< std::vector< output::FloatOutput *>()> &init)
Definition: custom_output.h:26
std::vector< output::FloatOutput * > outputs_
Definition: custom_output.h:33
output::BinaryOutput * get_output(int i)
Definition: custom_output.h:18
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
CustomBinaryOutputConstructor(const std::function< std::vector< output::BinaryOutput *>()> &init)
Definition: custom_output.h:14
void init()
Definition: core.cpp:80
std::vector< output::BinaryOutput * > outputs_
Definition: custom_output.h:21