Select one of the symbols to view example projects that use it.
 
Outline
Includes
#include "main.h"
Private variables
msc_demo
Menu_Init()
MSC_MenuProcess()
Files
loading...
CodeScopeSTM32 Libraries and SamplesMSC_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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file USB_Host/MSC_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 -------------------------------------------------------- */ MSC_DEMO_StateMachine msc_demo; Private variables /* Private function prototypes ---------------------------------------------- */ /* Private functions -------------------------------------------------------- */ /** * @brief Demo state machine. * @param None * @retval None *//* ... */ void Menu_Init(void) { USBH_UsrLog("Starting MSC Demo"); msc_demo.state = MSC_DEMO_START; }{ ... } /** * @brief Manages MSC Menu Process. * @param None * @retval None *//* ... */ void MSC_MenuProcess(void) { switch(msc_demo.state) { case MSC_DEMO_START: if(Appli_state == APPLICATION_READY) { BSP_LCD_SetTextColor(LCD_COLOR_GREEN); BSP_LCD_DisplayStringAtLine(19, (uint8_t *)"Press User button to start read and write operations"); /* Wait for User Input */ while((BSP_PB_GetState(BUTTON_WAKEUP) != SET) && (Appli_state != APPLICATION_DISCONNECT)) { }while ((BSP_PB_GetState(BUTTON_WAKEUP) != SET) && (Appli_state != APPLICATION_DISCONNECT)) { ... } msc_demo.state = MSC_DEMO_FILE_OPERATIONS; /* Prevent debounce effect for user key */ HAL_Delay(400); BSP_LCD_ClearStringLine(19); }if (Appli_state == APPLICATION_READY) { ... } break; case MSC_DEMO_START: case MSC_DEMO_FILE_OPERATIONS: /* Read and Write File Here */ if(Appli_state == APPLICATION_READY) { MSC_File_Operations(); BSP_LCD_SetTextColor(LCD_COLOR_GREEN); BSP_LCD_DisplayStringAtLine(19, (uint8_t *)"Press User button to display disk content"); /* Wait for User Input */ while((BSP_PB_GetState(BUTTON_WAKEUP) != SET) && (Appli_state != APPLICATION_DISCONNECT)) { }while ((BSP_PB_GetState(BUTTON_WAKEUP) != SET) && (Appli_state != APPLICATION_DISCONNECT)) { ... } msc_demo.state = MSC_DEMO_EXPLORER; /* Prevent debounce effect for user key */ HAL_Delay(400); BSP_LCD_ClearStringLine(19); }if (Appli_state == APPLICATION_READY) { ... } break; case MSC_DEMO_FILE_OPERATIONS: case MSC_DEMO_EXPLORER: /* Display disk content */ if(Appli_state == APPLICATION_READY) { Explore_Disk("0:/", 1); msc_demo.state = MSC_DEMO_START; /* Prevent debounce effect for user key */ HAL_Delay(400); }if (Appli_state == APPLICATION_READY) { ... } break; case MSC_DEMO_EXPLORER: default: break;default }switch (msc_demo.state) { ... } if(Appli_state == APPLICATION_DISCONNECT) { Appli_state = APPLICATION_IDLE; LCD_LOG_ClearTextZone(); LCD_ErrLog("MSC device disconnected!\n"); msc_demo.state = MSC_DEMO_START; msc_demo.select = 0; }if (Appli_state == APPLICATION_DISCONNECT) { ... } }{ ... }