1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
22
23
24
25
28
29
30
31
36
41
42
47
48
49
50
51
52
53
54
55
56
57
58
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
83
84
85
86
87
88
89
90
91
92
104
106
107
108
109
110
111
112
113
114
115
116
/* ... */
#include "main.h"
Includes
MSC_DEMO_StateMachine msc_demo;
Private variables
/* ... */
void Menu_Init(void)
{
USBH_UsrLog("Starting MSC Demo");
msc_demo.state = MSC_DEMO_START;
}{ ... }
/* ... */
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");
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;
HAL_Delay(400);
BSP_LCD_ClearStringLine(19);
}if (Appli_state == APPLICATION_READY) { ... }
break;
case MSC_DEMO_START:
case MSC_DEMO_FILE_OPERATIONS:
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");
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;
HAL_Delay(400);
BSP_LCD_ClearStringLine(19);
}if (Appli_state == APPLICATION_READY) { ... }
break;
case MSC_DEMO_FILE_OPERATIONS:
case MSC_DEMO_EXPLORER:
if(Appli_state == APPLICATION_READY)
{
Explore_Disk("0:/", 1);
msc_demo.state = MSC_DEMO_START;
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) { ... }
}{ ... }