jonny_jr9 fc5aad0c14 Add menu (display + encoder) functional - wip
Added functional menu using display and encoder:
    - a menu item is defined in one struct
    - scroll in a list of defined items
    - select option
    - modify value
    - save value, return to list
Currently only menu is run (button and status display disabled)

- Add menu.cpp/hpp
- Add encoder.cpp/hpp mostly from previous test in board-control
- display.cpp: only run new handleMenu() function
- main.cpp: initialize encoder at startup, disable button task for testing
2024-02-13 19:36:06 +01:00

32 lines
928 B
C++

#pragma once
#include "display.hpp"
//--- menuState_t ---
// modes the menu can be in
typedef enum {
MAIN_MENU = 0,
SET_VALUE
} menuState_t;
//--- menuItem_t ---
// struct describes one menu element (all defined in menu.cpp)
typedef struct {
void (*action)(int); // pointer to function run when confirmed
int (*currentValue)(); // pointer to function to get currently configured value
int valueMin; // min allowed value
int valueMax; // max allowed value
int valueIncrement; // amount changed at one encoder tick (+/-)
const char title[17]; // shown in list
const char line1[17]; // above value
const char line2[17]; // above value
const char line4[17]; // below value *
const char line5[17]; // below value *
const char line6[17]; // below value
const char line7[17]; // below value
} menuItem_t;
void handleMenu(SSD1306_t * display);