Files
TX/source/menu.h

85 lines
2.1 KiB
C

/*
* 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
typedef struct {
bool exitToMainScreen;
}MENU_t;
//Menu Item Struct
//contains pointers to both mono and color bitmaps. mono bitmap requires a color.
//each item may have a mono bitmap, a color bitmap, or no bitmap.
typedef struct {
uint16_t * pMonoIcon; // bitmap
char text[MENU_MAX_STRING_LENGTH];
}MENU_ITEM_t;
void MENU_Init(void);
void MENU_Main(void);
void MENU_DisplayMain(uint32_t selected);
#endif /* MENU_MENU_H_ */