mirror of
https://github.com/esphome/esphome.git
synced 2025-11-19 16:25:50 +00:00
add SUB_BUTTON macro and ability to button schema to define the class (#4450)
* add ability to button schema to define the class * add SUB_BUTTON macro
This commit is contained in:
@@ -15,6 +15,13 @@ namespace button {
|
||||
} \
|
||||
}
|
||||
|
||||
#define SUB_BUTTON(name) \
|
||||
protected: \
|
||||
button::Button *name##_button_{nullptr}; \
|
||||
\
|
||||
public: \
|
||||
void set_##name##_button(button::Button *button) { this->name##_button_ = button; }
|
||||
|
||||
/** Base class for all buttons.
|
||||
*
|
||||
* A button is just a momentary switch that does not have a state, only a trigger.
|
||||
|
||||
Reference in New Issue
Block a user