ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
mcp4461_output.h
Go to the documentation of this file.
1#pragma once
2
3#include "../mcp4461.h"
7
8namespace esphome::mcp4461 {
9
10class Mcp4461Wiper final : public output::FloatOutput, public Parented<Mcp4461Component> {
11 public:
12 Mcp4461Wiper(Mcp4461Component *parent, Mcp4461WiperIdx wiper) : parent_(parent), wiper_(wiper) {}
15 void set_level(float state);
17 void turn_on() override;
19 void turn_off() override;
22 float read_state();
25 float update_state();
27 void increase_wiper();
29 void decrease_wiper();
32 void enable_terminal(char terminal);
35 void disable_terminal(char terminal);
37 void set_terminal(char terminal, bool enable) {
38 if (enable) {
39 this->enable_terminal(terminal);
40 } else {
41 this->disable_terminal(terminal);
42 }
43 }
46 void store_nonvolatile();
47
48 protected:
49 void write_state(float state) override;
52 float state_;
53};
54
55} // namespace esphome::mcp4461
Helper class to easily give an object a parent of type T.
Definition helpers.h:2073
void set_level(float state)
Set level of wiper.
void disable_terminal(char terminal)
Disable given terminal.
float update_state()
Update current output state using device wiper state.
void turn_on() override
Enables current output.
void set_terminal(char terminal, bool enable)
Enable or disable given terminal.
float read_state()
Read current device wiper state without updating internal output state.
void turn_off() override
Disables current output.
void decrease_wiper()
Decrease wiper by 1 tap.
Mcp4461Wiper(Mcp4461Component *parent, Mcp4461WiperIdx wiper)
void store_nonvolatile()
Immediately persist the current wiper level to the chip's nonvolatile register (independent of the de...
void write_state(float state) override
void increase_wiper()
Increase wiper by 1 tap.
void enable_terminal(char terminal)
Enable given terminal.
Base class for all output components that can output a variable level, like PWM.
bool state
Definition fan.h:2