-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubmenu.c
71 lines (50 loc) · 1.5 KB
/
submenu.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/***
* HC-11 wireless modem emulator for the Flipper Zero
* Version: 1.1
*
* Submenu
***/
/*** Includes ***/
#include "common.h"
#include "submenu.h"
/*** Routines ***/
/** Handle submenu views switching **/
void submenu_callback(void *ctx, uint32_t idx) {
App *app = (App *)ctx;
switch(idx) {
/* Switch to the configuration view */
case submenu_config:
view_dispatcher_switch_to_view(app->view_dispatcher, view_config);
app->config.sitem = submenu_config;
FURI_LOG_D(TAG, "Switch to configuration view");
break;
/* Switch to the USB serial passthrough view */
case submenu_passthru:
view_dispatcher_switch_to_view(app->view_dispatcher, view_passthru);
app->config.sitem = submenu_passthru;
FURI_LOG_D(TAG, "Switch to USB serial passthrough view");
break;
/* Switch to the about view */
case submenu_about:
view_dispatcher_switch_to_view(app->view_dispatcher, view_about);
app->config.sitem = submenu_about;
FURI_LOG_D(TAG, "Switch to about view");
break;
default:
break;
}
}
/** Callback to return to the submenu **/
uint32_t return_to_submenu_callback(void *ctx) {
UNUSED(ctx);
/* Switch back to the submenu */
FURI_LOG_D(TAG, "Switch back to submenu");
return view_submenu;
}
/* Callback to exit the submenu and the app altogether */
uint32_t submenu_exit_callback(void *ctx) {
UNUSED(ctx);
/* Set the view to VIEW_NONE to exit */
FURI_LOG_D(TAG, "Exit");
return VIEW_NONE;
}