Select one of the symbols to view example projects that use it.
 
Outline
Includes
#include "main.h"
Private variables
USBDISKPath
Menu_Init()
DS_MenuProcess()
HAL_GPIO_EXTI_Callback(uint16_t)
Files
loading...
CodeScopeSTM32 Libraries and SamplesDynamicSwitch_StandaloneSrc/menu.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file USB_Host/DynamicSwitch_Standalone/Src/menu.c * @author MCD Application Team * @brief This file implements Menu Functions ****************************************************************************** * @attention * * Copyright (c) 2017 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** *//* ... */ /* Includes ------------------------------------------------------------------ */ #include "main.h" Includes /* Private typedef ----------------------------------------------------------- */ /* Private define ------------------------------------------------------------ */ /* Private macro ------------------------------------------------------------- */ /* Private variables --------------------------------------------------------- */ extern char SD_Path[4]; /* SD logical drive path */ char USBDISKPath[4]; /* USB Host logical drive path */ Private variables /* Private function prototypes ----------------------------------------------- */ /* Private functions --------------------------------------------------------- */ /** * @brief Demo state machine. * @param None * @retval None *//* ... */ void Menu_Init(void) { msc_demo.state = MSC_DEMO_IDLE; hid_demo.state = HID_DEMO_IDLE; audio_demo.state = AUDIO_DEMO_IDLE; }{ ... } /** * @brief Manages DS Menu Process. * @param None * @retval None *//* ... */ void DS_MenuProcess(void) { switch (Appli_state) { case APPLICATION_IDLE: break; case APPLICATION_IDLE: case APPLICATION_MSC: MSC_MenuProcess(); break; case APPLICATION_MSC: case APPLICATION_AUDIO: AUDIO_MenuProcess(); break; case APPLICATION_AUDIO: case APPLICATION_HID: HID_MenuProcess(); break; case APPLICATION_HID: default: break;default }switch (Appli_state) { ... } if (Appli_state == APPLICATION_DISCONNECT) { Appli_state = APPLICATION_IDLE; Menu_Init(); /* Unlink the micro SD disk I/O driver */ FATFS_UnLinkDriver(SD_Path); /* Unlink the USB disk I/O driver */ FATFS_UnLinkDriver(USBDISKPath); }if (Appli_state == APPLICATION_DISCONNECT) { ... } }{ ... } /** * @brief EXTI line detection callbacks. * @param GPIO_Pin: Specifies the pins connected EXTI line * @retval None *//* ... */ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { static JOYState_TypeDef JoyState = JOY_NONE; static uint32_t debounce_time = 0; if (GPIO_Pin == GPIO_PIN_8) { /* Get the Joystick State */ JoyState = BSP_JOY_GetState(); /* Clear joystick interrupt pending bits */ BSP_IO_ITClear(); if (Appli_state == APPLICATION_MSC) { MSC_DEMO_ProbeKey(JoyState); }if (Appli_state == APPLICATION_MSC) { ... } else if (Appli_state == APPLICATION_HID) { HID_DEMO_ProbeKey(JoyState); }else if (Appli_state == APPLICATION_HID) { ... } else if (Appli_state == APPLICATION_AUDIO) { if (audio_select_mode == AUDIO_SELECT_MENU) { AUDIO_MenuProbeKey(JoyState); }if (audio_select_mode == AUDIO_SELECT_MENU) { ... } else if (audio_select_mode == AUDIO_PLAYBACK_CONTROL) { AUDIO_PlaybackProbeKey(JoyState); }else if (audio_select_mode == AUDIO_PLAYBACK_CONTROL) { ... } }else if (Appli_state == APPLICATION_AUDIO) { ... } switch (JoyState) { case JOY_LEFT: LCD_LOG_ScrollBack(); break; case JOY_LEFT: case JOY_RIGHT: LCD_LOG_ScrollForward(); break; case JOY_RIGHT: default: break;default }switch (JoyState) { ... } }if (GPIO_Pin == GPIO_PIN_8) { ... } if (audio_demo.state == AUDIO_DEMO_PLAYBACK) { if (GPIO_Pin == KEY_BUTTON_PIN) { /* Prevent debounce effect for user key */ if ((HAL_GetTick() - debounce_time) > 50) { debounce_time = HAL_GetTick(); }if ((HAL_GetTick() - debounce_time) > 50) { ... } else { return; }else { ... } /* Change the selection type */ if (audio_select_mode == AUDIO_SELECT_MENU) { Audio_ChangeSelectMode(AUDIO_PLAYBACK_CONTROL); }if (audio_select_mode == AUDIO_SELECT_MENU) { ... } else if (audio_select_mode == AUDIO_PLAYBACK_CONTROL) { Audio_ChangeSelectMode(AUDIO_SELECT_MENU); }else if (audio_select_mode == AUDIO_PLAYBACK_CONTROL) { ... } }if (GPIO_Pin == KEY_BUTTON_PIN) { ... } }if (audio_demo.state == AUDIO_DEMO_PLAYBACK) { ... } }{ ... }