mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
add SUB_SWITCH macro (#4898)
This commit is contained in:
parent
57023457ee
commit
7dcdf80f49
1 changed files with 7 additions and 0 deletions
|
@ -8,6 +8,13 @@
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace switch_ {
|
namespace switch_ {
|
||||||
|
|
||||||
|
#define SUB_SWITCH(name) \
|
||||||
|
protected: \
|
||||||
|
switch_::Switch *name##_switch_{nullptr}; \
|
||||||
|
\
|
||||||
|
public: \
|
||||||
|
void set_##name##_switch(switch_::Switch *s) { this->name##_switch_ = s; }
|
||||||
|
|
||||||
// bit0: on/off. bit1: persistent. bit2: inverted. bit3: disabled
|
// bit0: on/off. bit1: persistent. bit2: inverted. bit3: disabled
|
||||||
const int RESTORE_MODE_ON_MASK = 0x01;
|
const int RESTORE_MODE_ON_MASK = 0x01;
|
||||||
const int RESTORE_MODE_PERSISTENT_MASK = 0x02;
|
const int RESTORE_MODE_PERSISTENT_MASK = 0x02;
|
||||||
|
|
Loading…
Reference in a new issue