optimized and commented code

Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
2025-06-14 19:02:51 +02:00
parent 4aa3e2cbeb
commit 52a49363eb
10 changed files with 494 additions and 134 deletions

View File

@@ -1,20 +1,33 @@
// Prevents multiple inclusions of this header file
#pragma once
// Standard libraries for function objects and smart pointers
#include <functional>
#include <memory>
// Project-specific headers
#include "common/Widget.h"
#include "u8g2.h"
class Widget;
// Structure for menu options and callback functions
typedef struct
{
// Pointer to u8g2 display object for graphics output
u8g2_t *u8g2;
// Callback function to set the current screen
// Parameter: Smart pointer to a Widget object
std::function<void(std::shared_ptr<Widget>)> setScreen;
// Callback function to add a new screen to the stack
// Parameter: Smart pointer to a Widget object
std::function<void(std::shared_ptr<Widget>)> pushScreen;
// Callback function to remove the top screen from the stack
// No parameters required
std::function<void()> popScreen;
// Callback function to handle button presses
// Parameter: 8-bit button ID/status
std::function<void(uint8_t button)> onButtonClicked;
} menu_options_t;
} menu_options_t;