ESPHome 2026.8.0b4
Loading...
Searching...
No Matches
automation.h
Go to the documentation of this file.
1#pragma once
2
4#include "mcp4461_output.h"
5
6namespace esphome::mcp4461 {
7
8template<typename... Ts> class WiperIncreaseAction : public Action<Ts...> {
9 public:
10 explicit WiperIncreaseAction(Mcp4461Wiper *wiper) : wiper_(wiper) {}
11 void play(Ts... x) override { this->wiper_->increase_wiper(); }
12
13 protected:
15};
16
17template<typename... Ts> class WiperDecreaseAction : public Action<Ts...> {
18 public:
19 explicit WiperDecreaseAction(Mcp4461Wiper *wiper) : wiper_(wiper) {}
20 void play(Ts... x) override { this->wiper_->decrease_wiper(); }
21
22 protected:
24};
25
26// Persist the current level to the chip's nonvolatile register immediately — useful with
27// nonvolatile: false to persist only at deliberate moments (e.g. on a button press), or to
28// bypass the stability delay of the automatic mirroring.
29template<typename... Ts> class WiperStoreNonvolatileAction : public Action<Ts...> {
30 public:
31 explicit WiperStoreNonvolatileAction(Mcp4461Wiper *wiper) : wiper_(wiper) {}
32 void play(Ts... x) override { this->wiper_->store_nonvolatile(); }
33
34 protected:
36};
37
38template<typename... Ts> class WiperSetTerminalAction : public Action<Ts...> {
39 public:
40 WiperSetTerminalAction(Mcp4461Wiper *wiper, char terminal, bool enable)
41 : wiper_(wiper), terminal_(terminal), enable_(enable) {}
42 void play(Ts... x) override {
43 if (this->enable_) {
44 this->wiper_->enable_terminal(this->terminal_);
45 } else {
46 this->wiper_->disable_terminal(this->terminal_);
47 }
48 }
49
50 protected:
53 bool enable_;
54};
55
56} // namespace esphome::mcp4461
void disable_terminal(char terminal)
Disable given terminal.
void decrease_wiper()
Decrease wiper by 1 tap.
void store_nonvolatile()
Immediately persist the current wiper level to the chip's nonvolatile register (independent of the de...
void increase_wiper()
Increase wiper by 1 tap.
void enable_terminal(char terminal)
Enable given terminal.
WiperDecreaseAction(Mcp4461Wiper *wiper)
Definition automation.h:19
WiperIncreaseAction(Mcp4461Wiper *wiper)
Definition automation.h:10
WiperSetTerminalAction(Mcp4461Wiper *wiper, char terminal, bool enable)
Definition automation.h:40
uint16_t x
Definition tt21100.cpp:5