Select one of the symbols to view example projects that use it.
 
Outline
Includes
#include "main.h"
Private variables
CdcDemo
Menu_Init()
CDC_MenuProcess()
Files
loading...
CodeScopeSTM32 Libraries and SamplesCDC_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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file USB_Host/CDC_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 ---------------------------------------------------------*/ CDC_DEMO_StateMachine CdcDemo; Private variables /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /** * @brief Demo state machine. * @param None * @retval None *//* ... */ void Menu_Init(void) { USBH_UsrLog("Starting CDC Demo"); CdcDemo.state = CDC_DEMO_WAIT; }{ ... } /** * @brief Manages CDC Menu Process. * @param None * @retval None *//* ... */ void CDC_MenuProcess(void) { switch(CdcDemo.state) { case CDC_DEMO_WAIT: if(Appli_state == APPLICATION_READY) { BSP_LCD_SetTextColor(LCD_COLOR_GREEN); BSP_LCD_DisplayStringAtLine(19, (uint8_t *)"Press User button to start sending data "); /* 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)) { ... } CdcDemo.state = CDC_DEMO_SEND; /* Prevent debounce effect for user key */ HAL_Delay(400); BSP_LCD_ClearStringLine(19); }if (Appli_state == APPLICATION_READY) { ... } break; case CDC_DEMO_WAIT: case CDC_DEMO_SEND: /* Read and Write File Here */ if(Appli_state == APPLICATION_READY) { CDC_Handle_Send_Menu(); }if (Appli_state == APPLICATION_READY) { ... } break; case CDC_DEMO_SEND: case CDC_DEMO_RECEIVE: if(Appli_state == APPLICATION_READY) { CDC_Handle_Receive_Menu(); }if (Appli_state == APPLICATION_READY) { ... } break; case CDC_DEMO_RECEIVE: default: break;default }switch (CdcDemo.state) { ... } if(Appli_state == APPLICATION_DISCONNECT) { Appli_state = APPLICATION_IDLE; LCD_LOG_ClearTextZone(); LCD_ErrLog("CDC device disconnected!\n"); CdcDemo.state = CDC_DEMO_WAIT; CdcDemo.Receive_state = CDC_RECEIVE_IDLE; CdcDemo.Send_state = CDC_SEND_IDLE; CdcDemo.select = 0; }if (Appli_state == APPLICATION_DISCONNECT) { ... } }{ ... }