#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) /*************************************************************************************************/ #define ROTARY_BUTTON(CAPITAL_NAME, SMALL_NAME, FUNC_CODE, LED_FUNC_CODE) \ private: \ RotaryButton _ ## SMALL_NAME{FUNC_CODE, LED_FUNC_CODE}; \ public: \ void rotate ## CAPITAL_NAME(int value) \ { \ auto arr = _ ## SMALL_NAME.rotate(value); \ _dataSender->send(arr); \ } \ signals: \ void SMALL_NAME ## LedChanged(int value) /*************************************************************************************************/ #define ROTARY_BUTTON_NO_LED(CAPITAL_NAME, SMALL_NAME, FUNC_CODE) \ private: \ RotaryButton _ ## SMALL_NAME{FUNC_CODE}; \ public: \ void rotate ## CAPITAL_NAME(int value) \ { \ auto arr = _ ## SMALL_NAME.rotate(value); \ _dataSender->send(arr); \ } \ signals: \ void SMALL_NAME ## LedChanged(int value) #endif //BUTTONHELPER_H