Select one of the symbols to view example projects that use it.
 
Outline
Includes
#include "main.h"
Private variables
msc_demo
MenuEvent
ExploreDisk_State
Private function prototypes
Menu_Init()
MSC_MenuThread(const void *)
HAL_GPIO_EXTI_Callback(uint16_t)
Files
loading...
SourceVuSTM32 Libraries and SamplesMSC_RTOSSrc/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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file USB_Host/MSC_RTOS/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; osSemaphoreId MenuEvent; __IO uint8_t ExploreDisk_State = 0; Private variables /* Private function prototypes -----------------------------------------------*/ static void MSC_MenuThread(void const *argument); Private function prototypes /* Private functions ---------------------------------------------------------*/ /** * @brief Demo state machine. * @param None * @retval None *//* ... */ void Menu_Init(void) { /* Create Menu Semaphore */ osSemaphoreDef(osSem); MenuEvent = osSemaphoreCreate(osSemaphore(osSem), 1); /* Force menu to show Item 0 by default */ osSemaphoreRelease(MenuEvent); /* Menu task */ osThreadDef(Menu_Thread, MSC_MenuThread, osPriorityHigh, 0, 8 * configMINIMAL_STACK_SIZE); osThreadCreate(osThread(Menu_Thread), NULL); msc_demo.state = MSC_DEMO_IDLE; USBH_UsrLog("Starting MSC Demo"); }{ ... } /** * @brief User task * @param argument not used * @retval None *//* ... */ void MSC_MenuThread(void const *argument) { for(;;) { if(osSemaphoreWait(MenuEvent , osWaitForever) == osOK) { switch(msc_demo.state) { case MSC_DEMO_IDLE: msc_demo.state = MSC_DEMO_START; osSemaphoreRelease(MenuEvent); break; case MSC_DEMO_IDLE: case MSC_DEMO_START: if(Appli_state == APPLICATION_READY) { BSP_LCD_SetTextColor(LCD_COLOR_GREEN); BSP_LCD_DisplayStringAtLine(18, (uint8_t *)"Press User button to start"); BSP_LCD_DisplayStringAtLine(19, (uint8_t *)"read and write operations"); msc_demo.state = MSC_DEMO_FILE_OPERATIONS; osSemaphoreRelease(MenuEvent); }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) { BSP_LCD_ClearStringLine(18); BSP_LCD_ClearStringLine(19); MSC_File_Operations(); BSP_LCD_SetTextColor(LCD_COLOR_GREEN); BSP_LCD_DisplayStringAtLine(18, (uint8_t *)"Press User button to"); BSP_LCD_DisplayStringAtLine(19, (uint8_t *)"display disk content"); msc_demo.state = MSC_DEMO_EXPLORER; }if (Appli_state == APPLICATION_READY) { ... } break; case MSC_DEMO_FILE_OPERATIONS: case MSC_DEMO_EXPLORER: /* Display disk content */ if(Appli_state == APPLICATION_READY) { BSP_LCD_ClearStringLine(18); BSP_LCD_ClearStringLine(19); ExploreDisk_State = 1; Explore_Disk("0:/", 1); msc_demo.state = MSC_DEMO_START; ExploreDisk_State = 0; BSP_LCD_SetTextColor(LCD_COLOR_GREEN); BSP_LCD_DisplayStringAtLine(18, (uint8_t *)"Press User button to start"); BSP_LCD_DisplayStringAtLine(19, (uint8_t *)"read and write operations"); }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(); BSP_LCD_ClearStringLine(18); BSP_LCD_ClearStringLine(19); LCD_ErrLog("MSC device disconnected!\n"); msc_demo.state = MSC_DEMO_IDLE; }if (Appli_state == APPLICATION_DISCONNECT) { ... } }if (osSemaphoreWait(MenuEvent , osWaitForever) == osOK) { ... } }for (;;) { ... } }{ ... } /** * @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) { if(GPIO_Pin == USER_BUTTON_PIN) { if(ExploreDisk_State == 0) { osSemaphoreRelease(MenuEvent); }if (ExploreDisk_State == 0) { ... } }if (GPIO_Pin == USER_BUTTON_PIN) { ... } }{ ... }
Details