forked from Sepanta/console-emulator
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.0 KiB
40 lines
1.0 KiB
3 years ago
|
#ifndef BUTTONHELPER_H
|
||
|
#define BUTTONHELPER_H
|
||
|
|
||
|
#define PUSH_BUTTON(CAPITAL_NAME, SMALL_NAME, FUNC_CODE, LED_FUNC_CODE) \
|
||
|
private: \
|
||
|
PushButton _ ## SMALL_NAME{FUNC_CODE, LED_FUNC_CODE}; \
|
||
|
public: \
|
||
|
void press ## CAPITAL_NAME() \
|
||
|
{ \
|
||
|
auto arr = _ ## SMALL_NAME.press(); \
|
||
|
_dataSender->send(arr); \
|
||
|
} \
|
||
|
void release ## CAPITAL_NAME() \
|
||
|
{ \
|
||
|
auto arr = _ ## SMALL_NAME.release(); \
|
||
|
_dataSender->send(arr); \
|
||
|
} \
|
||
|
signals: \
|
||
|
void SMALL_NAME ## LedChanged(int value)
|
||
|
|
||
|
/*************************************************************************************************/
|
||
|
#define PUSH_BUTTON_NO_LED(CAPITAL_NAME, SMALL_NAME, FUNC_CODE) \
|
||
|
private: \
|
||
|
PushButton _ ## SMALL_NAME{FUNC_CODE}; \
|
||
|
public: \
|
||
|
void press ## CAPITAL_NAME() \
|
||
|
{ \
|
||
|
auto arr = _ ## SMALL_NAME.press(); \
|
||
|
_dataSender->send(arr); \
|
||
|
} \
|
||
|
void release ## CAPITAL_NAME() \
|
||
|
{ \
|
||
|
auto arr = _ ## SMALL_NAME.release(); \
|
||
|
_dataSender->send(arr); \
|
||
|
} \
|
||
|
signals: \
|
||
|
void SMALL_NAME ## LedChanged(int value)
|
||
|
|
||
|
#endif //BUTTONHELPER_H
|