Merge pull request #11198 from SteveCEvans/sce_rc2
[betaflight.git] / src / main / cms / cms.h
blobb05de43173b1f0b2101c33cd84d084a854d9a45c
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #pragma once
23 #include "drivers/display.h"
25 #include "common/time.h"
27 #include "cms/cms_types.h"
29 typedef enum {
30 CMS_KEY_NONE,
31 CMS_KEY_UP,
32 CMS_KEY_DOWN,
33 CMS_KEY_LEFT,
34 CMS_KEY_RIGHT,
35 CMS_KEY_ESC,
36 CMS_KEY_MENU,
37 CMS_KEY_SAVEMENU,
38 } cms_key_e;
40 extern bool cmsInMenu;
42 // Device management
43 bool cmsDisplayPortRegister(displayPort_t *pDisplay);
45 extern displayPort_t *pCurrentDisplay;
47 // For main.c and scheduler
48 void cmsInit(void);
49 void cmsHandler(timeUs_t currentTimeUs);
51 bool cmsDisplayPortSelect(displayPort_t *instance);
52 void cmsMenuOpen(void);
53 const void *cmsMenuChange(displayPort_t *pPort, const void *ptr);
54 const void *cmsMenuExit(displayPort_t *pPort, const void *ptr);
55 void cmsSetExternKey(cms_key_e extKey);
56 void inhibitSaveMenu(void);
57 void cmsAddMenuEntry(OSD_Entry *menuEntry, char *text, uint16_t flags, CMSEntryFuncPtr func, void *data);
59 #define CMS_STARTUP_HELP_TEXT1 "MENU:THR MID"
60 #define CMS_STARTUP_HELP_TEXT2 "+ YAW LEFT"
61 #define CMS_STARTUP_HELP_TEXT3 "+ PITCH UP"
63 // cmsMenuExit special ptr values
64 #define CMS_EXIT (0)
65 #define CMS_EXIT_SAVE (1)
66 #define CMS_EXIT_SAVEREBOOT (2)
67 #define CMS_POPUP_SAVE (3)
68 #define CMS_POPUP_SAVEREBOOT (4)
69 #define CMS_POPUP_EXITREBOOT (5)