diff --git a/Platformio/src/devices/AVreceiver/device_yamahaAmp/gui_yamahaAmp.cpp b/Platformio/src/devices/AVreceiver/device_yamahaAmp/gui_yamahaAmp.cpp new file mode 100644 index 0000000..0d35762 --- /dev/null +++ b/Platformio/src/devices/AVreceiver/device_yamahaAmp/gui_yamahaAmp.cpp @@ -0,0 +1,46 @@ +#include +#include "applicationInternal/gui/guiBase.h" +#include "applicationInternal/gui/guiRegistry.h" +#include "applicationInternal/commandHandler.h" +#include "devices/AVreceiver/device_yamahaAmp/device_yamahaAmp.h" +#include "devices/AVreceiver/device_yamahaAmp/gui_yamahaAmp.h" + +static void button_clicked_event_cb(lv_event_t* e) { + int user_data = (intptr_t)(e->user_data); + + if (user_data == 0) { + executeCommand(YAMAHA_STANDARD); + } + +} + +void create_tab_content_yamahaAmp(lv_obj_t* tab) { + + // Add content to the sceneSelection tab + + lv_obj_set_layout(tab, LV_LAYOUT_FLEX); + lv_obj_set_flex_flow(tab, LV_FLEX_FLOW_COLUMN); + lv_obj_set_scrollbar_mode(tab, LV_SCROLLBAR_MODE_ACTIVE); + + // -- create a button for "standard" ---------------------------------------- + lv_obj_t* button = lv_btn_create(tab); + lv_obj_set_size(button, 80, 40); + lv_obj_set_style_radius(button, 10, LV_PART_MAIN); + lv_obj_set_style_bg_color(button, color_primary, LV_PART_MAIN); + lv_obj_add_event_cb(button, button_clicked_event_cb, LV_EVENT_CLICKED, (void *)(intptr_t) 0); + + lv_obj_t* label = lv_label_create(button); + lv_label_set_text(label, "Standard"); + lv_obj_center(label); + +} + +void notify_tab_before_delete_yamahaAmp(void) { + // remember to set all pointers to lvgl objects to NULL if they might be accessed from outside. + // They must check if object is NULL and must not use it if so + +} + +void register_gui_yamahaAmp(void){ + register_gui(std::string(tabName_yamahaAmp), & create_tab_content_yamahaAmp, & notify_tab_before_delete_yamahaAmp); +} diff --git a/Platformio/src/devices/AVreceiver/device_yamahaAmp/gui_yamahaAmp.h b/Platformio/src/devices/AVreceiver/device_yamahaAmp/gui_yamahaAmp.h new file mode 100644 index 0000000..776653c --- /dev/null +++ b/Platformio/src/devices/AVreceiver/device_yamahaAmp/gui_yamahaAmp.h @@ -0,0 +1,4 @@ +#pragma once + +const char * const tabName_yamahaAmp = "Yamaha Amp"; +void register_gui_yamahaAmp(void); diff --git a/Platformio/src/main.cpp b/Platformio/src/main.cpp index 0037358..f39b5ab 100644 --- a/Platformio/src/main.cpp +++ b/Platformio/src/main.cpp @@ -31,6 +31,7 @@ #include "guis/gui_irReceiver.h" #include "guis/gui_settings.h" #include "guis/gui_numpad.h" +#include "devices/AVreceiver/device_yamahaAmp/gui_yamahaAmp.h" #include "devices/mediaPlayer/device_appleTV/gui_appleTV.h" #include "devices/misc/device_smarthome/gui_smarthome.h" #include "applicationInternal/keys.h" @@ -110,9 +111,10 @@ int main(int argc, char *argv[]) { register_gui_appleTV(); register_gui_numpad(); register_gui_smarthome(); + register_gui_yamahaAmp(); // Only show these GUIs in the main gui list. If you don't set this explicitely, by default all registered guis are shown. #if (USE_SCENE_SPECIFIC_GUI_LIST != 0) - main_gui_list = {tabName_sceneSelection, tabName_smarthome, tabName_settings, tabName_irReceiver}; + main_gui_list = {tabName_yamahaAmp, tabName_sceneSelection, tabName_smarthome, tabName_settings, tabName_irReceiver}; #endif // register the scenes and their key_commands_*