1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
31
32
35
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
114
125
126
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
232
252
255
256
257
258
259
266
270
271
274
275
/* ... */
#include "main.h"
#include "settings_res.c"
/* ... */
/* ... */
Includes
static void Startup(WM_HWIN hWin, uint16_t xpos, uint16_t ypos);
Private function prototypes
K_ModuleItem_Typedef settings_board =
{
8,
"system info",
settings,
0,
Startup,
NULL,
...}
;
Private typedef
#define ID_WINDOW_0 (GUI_ID_USER + 0x00)
#define ID_TEXT_BOARD (GUI_ID_USER + 0x02)
#define ID_TEXT_CORE (GUI_ID_USER + 0x03)
#define ID_TEXT_CPU (GUI_ID_USER + 0x04)
#define ID_TEXT_VERSION (GUI_ID_USER + 0x05)
#define ID_TEXT_COPYRIGHT (GUI_ID_USER + 0x06)
#define ID_TEXT_BOARD_1 (GUI_ID_USER + 0x07)
#define ID_TEXT_BOARD_2 (GUI_ID_USER + 0x0C)
#define ID_TEXT_CORE_1 (GUI_ID_USER + 0x08)
#define ID_TEXT_CPU_1 (GUI_ID_USER + 0x09)
#define ID_TEXT_VERSION_1 (GUI_ID_USER + 0x0A)
#define ID_TEXT_TITLE (GUI_ID_USER + 0x0B)
#define ID_BUTTON_EXIT (GUI_ID_USER + 0x20)
13 defines
Private defines
static const GUI_WIDGET_CREATE_INFO _aDialog[] =
{
{ WINDOW_CreateIndirect, "", ID_WINDOW_0, 0, 0, 800, 480, 0, 0x64, 0 },
{ TEXT_CreateIndirect, "System Information", ID_TEXT_TITLE, 290, 30, 300, 40, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Board", ID_TEXT_BOARD, 90, 155, 80, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Core", ID_TEXT_CORE, 285, 155, 80, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "CPU Speed", ID_TEXT_CPU, 445, 155, 100, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Firm.Ver", ID_TEXT_VERSION, 645, 155, 90, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, " STM32469I-", ID_TEXT_BOARD_1, 60, 295, 120, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, " DISCO " , ID_TEXT_BOARD_2, 65, 315, 100, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, " STM32F4", ID_TEXT_CORE_1, 260, 300, 100, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, " 180MHz", ID_TEXT_CPU_1, 450, 300, 100, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "V1.4.1", ID_TEXT_VERSION_1, 655, 300, 100, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Copyright (c) STMicroelectronics 2016", ID_TEXT_COPYRIGHT, 550, 453, 240, 20, 0, 0x0, 0 },
...};
static WM_HTIMER hTimer;
uint32_t frame = 0;
Private variables
/* ... */
static void _OnPaint_exit(BUTTON_Handle hObj) {
GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor());
GUI_Clear();
GUI_SetColor(GUI_STCOLOR_LIGHTBLUE);
GUI_AA_FillCircle(100, 0, 100);
GUI_SetBkColor(GUI_STCOLOR_LIGHTBLUE);
GUI_SetColor(GUI_WHITE);
GUI_SetFont(&GUI_FontLubalGraph32);
GUI_DispStringAt("Menu", 20, 20);
}{ ... }
/* ... */
static void _cbButton_exit(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
_OnPaint_exit(pMsg->hWin);
break;case WM_PAINT:
default:
BUTTON_Callback(pMsg);
break;default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _cbDialog(WM_MESSAGE * pMsg) {
WM_HWIN hItem;
int Id, NCode;
switch (pMsg->MsgId) {
case WM_INIT_DIALOG:
frame = 0;
hTimer = WM_CreateTimer(pMsg->hWin, 0, 50, 0);
hItem = BUTTON_CreateEx(700, 0, 100, 100, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_EXIT);
WM_SetCallback(hItem, _cbButton_exit);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_BOARD);
TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CORE);
TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CPU);
TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_VERSION);
TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_BOARD_1);
TEXT_SetFont(hItem, &GUI_FontLubalGraph24);
TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_BOARD_2);
TEXT_SetFont(hItem, &GUI_FontLubalGraph24);
TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CORE_1);
TEXT_SetFont(hItem, &GUI_FontLubalGraph24);
TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CPU_1);
TEXT_SetFont(hItem, &GUI_FontLubalGraph24);
TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_VERSION_1);
TEXT_SetFont(hItem, &GUI_FontLubalGraph24);
TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_COPYRIGHT);
TEXT_SetFont(hItem, &GUI_FontLubalGraph16);
TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_TITLE);
TEXT_SetFont(hItem, &GUI_FontLubalGraph32B);
TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);
break;
case WM_INIT_DIALOG:
case WM_PAINT:
GUI_SetColor(GUI_STCOLOR_LIGHTBLUE);
GUI_AA_DrawRoundedRect(30, 140, 200, 340, 30);
GUI_AA_DrawRoundedRect(220, 140, 390, 340, 30);
GUI_AA_DrawRoundedRect(410, 140, 580, 340, 30);
GUI_AA_DrawRoundedRect(600, 140, 770, 340, 30);
GUI_DrawBitmap(open_board[frame] , 65, 190);
GUI_DrawBitmap(open_mcu[frame] , 255, 190);
GUI_DrawBitmap(open_cpu[frame] , 445, 190);
GUI_DrawBitmap(open_fversion[frame], 635, 190);
break;
case WM_PAINT:
case WM_TIMER:
if(frame < 4)
{
WM_InvalidateWindow(pMsg->hWin);
WM_RestartTimer(pMsg->Data.v, 50);
frame++;
}if (frame < 4) { ... }
else
{
if(hTimer != 0)
{
WM_DeleteTimer(hTimer);
hTimer = 0;
}if (hTimer != 0) { ... }
}else { ... }
break;
case WM_TIMER:
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch(Id) {
case ID_BUTTON_EXIT:
switch(NCode) {
case WM_NOTIFICATION_RELEASED:
if(hTimer != 0)
{
WM_DeleteTimer(hTimer);
hTimer = 0;
}if (hTimer != 0) { ... }
GUI_EndDialog(pMsg->hWin, 0);
break;case WM_NOTIFICATION_RELEASED:
}switch (NCode) { ... }
break; case ID_BUTTON_EXIT:
}switch (Id) { ... }
break;case WM_NOTIFY_PARENT:
default:
WM_DefaultProc(pMsg);
break;default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void Startup(WM_HWIN hWin, uint16_t xpos, uint16_t ypos)
{
GUI_CreateDialogBox(_aDialog, GUI_COUNTOF(_aDialog), _cbDialog, hWin, xpos, ypos);
}{ ... }
/* ... */
/* ... */