2025-05-14 12:57:39 -05:00
|
|
|
/*
|
|
|
|
|
* menu.h
|
|
|
|
|
*
|
|
|
|
|
* Created on: Mar 8, 2022
|
|
|
|
|
* Author: Brian.Bailey
|
|
|
|
|
*
|
|
|
|
|
* Each menu has two functions: XMenu() and DisplayXMenu(), where X is the menu type
|
|
|
|
|
* XMenu() handles key presses
|
|
|
|
|
* DisplayXMenu(line) draws the menu using the arg as the selected menu line
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef MENU_MENU_H_
|
|
|
|
|
#define MENU_MENU_H_
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
|
|
//Menu Setup
|
|
|
|
|
#define MENU_SYS_INFO_NUM 3 //System info and diagnostics
|
|
|
|
|
|
|
|
|
|
#define MAIN_MENU_NUM_TX10 4 //Tx10
|
|
|
|
|
#define MAIN_MENU_NUM_TX25 6 //Tx25 has Link Radio and Regulatory menus
|
|
|
|
|
#define LINK_MENU_NUM 3
|
|
|
|
|
#define LANG_MENU_NUM 4 //This can use LANG_NUM enum
|
|
|
|
|
|
|
|
|
|
//Menu scrolling
|
|
|
|
|
#define MENU_MAX_LINES_DISPLAYED 6
|
|
|
|
|
#define MENU_KEY_HOLD_SCROLL_DELAY 10 //increments of DelayTicks
|
|
|
|
|
|
|
|
|
|
#define MENU_LINE_HEIGHT 21
|
|
|
|
|
|
|
|
|
|
//Main Menu drawing locations
|
|
|
|
|
#define MENU_MAIN_BMP_X 0 //bitmap x
|
|
|
|
|
#define MENU_MAIN_BMP_Y 0 //bitmap y
|
|
|
|
|
#define MENU_MAIN_TEXT_X 5 //main text x
|
|
|
|
|
#define MENU_MAIN_TEXT_Y_START 0 //main text y starting value (start + n*lines)
|
|
|
|
|
#define MENU_MAIN_STATUS_X 160 //x location of text describing status of the menu item
|
|
|
|
|
#define MENU_MAIN_STATUS_Y_OFF 4 //y offset for menu status icons
|
|
|
|
|
|
|
|
|
|
//Submenu drawing locations - NOT USED
|
|
|
|
|
#define MENU_SUB_TEXT_X 5 //submenu text x
|
|
|
|
|
#define MENU_SUB_TEXT_Y_START 0 //submenu text y starting value (start + n*lines)
|
|
|
|
|
#define MENU_SUB_STATUS_X 160 //x location of text describing status of the menu item
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define MENU_MAX_STRING_LENGTH 20
|
|
|
|
|
|
|
|
|
|
#define MENU_FONT font12Bold
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Selection Rectangle
|
|
|
|
|
#define MENU_SEL_RECT_X0 0
|
|
|
|
|
#define MENU_SEL_RECT_X1 239
|
|
|
|
|
#define MENU_SEL_RECT_X1A 200
|
|
|
|
|
|
|
|
|
|
#define MENU_SEL_RECT_RADIUS 5
|
|
|
|
|
|
2025-05-16 17:11:59 -05:00
|
|
|
#define MENU_STACK_SIZE 4
|
2025-06-11 10:55:00 -05:00
|
|
|
//#define MENU_ITEM_SIZE 10
|
2025-05-16 17:11:59 -05:00
|
|
|
|
|
|
|
|
typedef struct Menu_s Menu_t;
|
|
|
|
|
typedef int (*MenuHandler_t)(Menu_t *menu);
|
|
|
|
|
|
2025-05-16 07:56:18 -05:00
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
MENU_ID_NONE = 0,
|
|
|
|
|
MENU_ID_AUTOSHUTDOWN,
|
|
|
|
|
MENU_ID_FREQUENCIES,
|
|
|
|
|
MENU_ID_SYSINFO,
|
|
|
|
|
MENU_ID_LANGUAGE,
|
2025-06-11 10:55:00 -05:00
|
|
|
MENU_ID_FREQUENCY,
|
2025-05-16 07:56:18 -05:00
|
|
|
|
|
|
|
|
} MenuItemId_t;
|
|
|
|
|
|
|
|
|
|
typedef struct MENU_ITEM_s
|
|
|
|
|
{
|
|
|
|
|
uint32_t * pMonoIcon; // bitmap
|
|
|
|
|
char text[MENU_MAX_STRING_LENGTH];
|
|
|
|
|
MenuItemId_t id;
|
2025-05-16 17:11:59 -05:00
|
|
|
int (*handler)(Menu_t *menu);
|
2025-06-11 10:55:00 -05:00
|
|
|
void *data;
|
2025-05-16 17:11:59 -05:00
|
|
|
|
|
|
|
|
} MenuItem_t;
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
MENU_OK = 0,
|
|
|
|
|
MENU_HOME,
|
|
|
|
|
MENU_EXIT
|
|
|
|
|
} MenuExitCode_t;
|
|
|
|
|
|
|
|
|
|
struct Menu_s
|
|
|
|
|
{
|
|
|
|
|
MenuHandler_t handler;
|
|
|
|
|
bool init;
|
|
|
|
|
bool draw;
|
|
|
|
|
int selected;
|
2025-06-11 10:55:00 -05:00
|
|
|
MenuItem_t *items;
|
2025-05-16 17:11:59 -05:00
|
|
|
int itemCount;
|
|
|
|
|
int displayIndex;
|
|
|
|
|
int exitCode;
|
|
|
|
|
int nextRepeat;
|
|
|
|
|
uint32_t longPress;
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef struct MenuData_s
|
|
|
|
|
{
|
|
|
|
|
int stackCount;
|
|
|
|
|
Menu_t menuStack[MENU_STACK_SIZE];
|
|
|
|
|
Menu_t *currentMenu;
|
|
|
|
|
|
|
|
|
|
} MenuData_t;
|
|
|
|
|
|
2025-05-14 12:57:39 -05:00
|
|
|
|
2025-05-16 17:11:59 -05:00
|
|
|
typedef struct {
|
|
|
|
|
bool exitToMainScreen;
|
|
|
|
|
} MENU_t;
|
2025-05-14 12:57:39 -05:00
|
|
|
|
|
|
|
|
|
2025-05-16 07:56:18 -05:00
|
|
|
void Menu_init(void);
|
|
|
|
|
void Menu_mainMenu(void);
|
|
|
|
|
void Menu_service(void);
|
2025-05-14 12:57:39 -05:00
|
|
|
|
|
|
|
|
void MENU_Init(void);
|
|
|
|
|
void MENU_Main(void);
|
|
|
|
|
void MENU_DisplayMain(uint32_t selected);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* MENU_MENU_H_ */
|