feat(menu): add menu class

This commit is contained in:
2026-04-28 19:54:32 +02:00
parent 2d2051e6c2
commit f2fbb9f205
2 changed files with 56 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
#pragma once
#define MENU_ITEM_COUNT 4
#include <Arduino.h>
#include "joystick.hpp"
typedef struct {
String name;
void (*action)();
} Item;
class Menu {
public:
Menu(Item* items);
void updateCurrentItem(JoystickDirection& direction);
void execute();
Item& getItemAt(size_t index);
size_t getCurrentItemIndex() const;
private:
Item items[MENU_ITEM_COUNT];
int currentItem;
};