ESPHome 2025.5.0
Loading...
Searching...
No Matches
sigma_delta_output.h
Go to the documentation of this file.
1#pragma once
4#include "esphome/core/hal.h"
6
7namespace esphome {
8namespace sigma_delta_output {
9
11 public:
13 if (!this->turn_on_trigger_)
14 this->turn_on_trigger_ = make_unique<Trigger<>>();
15 return this->turn_on_trigger_.get();
16 }
18 if (!this->turn_off_trigger_)
19 this->turn_off_trigger_ = make_unique<Trigger<>>();
20 return this->turn_off_trigger_.get();
21 }
22
24 if (!this->state_change_trigger_)
25 this->state_change_trigger_ = make_unique<Trigger<bool>>();
26 return this->state_change_trigger_.get();
27 }
28
29 void set_pin(GPIOPin *pin) { this->pin_ = pin; };
30 void write_state(float state) override { this->state_ = state; }
31 void setup() override;
32 void dump_config() override;
33 void update() override;
34
35 protected:
36 GPIOPin *pin_{nullptr};
37
38 std::unique_ptr<Trigger<>> turn_on_trigger_{nullptr};
39 std::unique_ptr<Trigger<>> turn_off_trigger_{nullptr};
40 std::unique_ptr<Trigger<bool>> state_change_trigger_{nullptr};
41
42 float accum_{0};
43 float state_{0.};
44 bool value_{false};
45};
46} // namespace sigma_delta_output
47} // namespace esphome
This class simplifies creating components that periodically check a state.
Definition component.h:301
Base class for all output components that can output a variable level, like PWM.
std::unique_ptr< Trigger< bool > > state_change_trigger_
bool state
Definition fan.h:0
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7