Skip to content

Commit 943d713

Browse files
committedMar 2, 2019
Улучшены блокировка экрана и гашение экрана.
Теперь из любого меню по истечению 30 секунд происходит возврат в главное меню, и происходит блокировка управления. Спустя еще 30 секунд экран отключается
1 parent 77b411b commit 943d713

File tree

10 files changed

+151
-118
lines changed

10 files changed

+151
-118
lines changed
 

‎Inc/callbacks.h

+1-48
Original file line numberDiff line numberDiff line change
@@ -20,53 +20,6 @@ void TFT_LineSetupShowChar(u16 x, u16 y, u8 num, uint8_t fontsize, u16 color);
2020

2121

2222

23-
24-
25-
//lines.h
26-
//void pollLinesOutput(uint8_t waitMinutes);
27-
//void lineSendSignal(uint8_t lineNumber);
28-
//uint16_t get_sTimeLinesDiff(Lines* lineToCheck, uint8_t waitMinutes);
29-
30-
//guifunc.h
3123
void pollButton(uint16_t id, uint8_t action, int8_t* val);
32-
33-
//timedate.h
34-
//unsigned char isDaylightSavingTimeUS(unsigned char day, unsigned char month, unsigned char dow);
35-
//unsigned char isDaylightSavingTimeEU(unsigned char day, unsigned char month, unsigned char dow);
36-
//void correctDate(RTC_DateTypeDef* Date);
37-
//uint8_t increaseDay(RTC_DateTypeDef* Date);
38-
//void linesIncreaseMinute(uint8_t lineNumber);
39-
//uint8_t getLastDayOfMonth(RTC_DateTypeDef* Date);
40-
//uint8_t hoursToUTC(int8_t hours, int8_t timeZone);
41-
42-
//backup.h
43-
//void rtc_write_backup_reg(uint16_t BackupRegister, uint16_t data);
44-
//uint16_t rtc_read_backup_reg(uint16_t BackupRegister);
45-
//void saveDateToBKP(void);
46-
//void saveLineToBKP(uint8_t lineNumber);
47-
//void saveDaylightSavingToBKP(void);
48-
//void readDaylightSavingFromBKP(void);
49-
//void saveTimeCalibrToBKP(void);
50-
//void readTimeCalibrFromBKP(void);
51-
//void saveLinesPolarityToBKP(void);
52-
//void readLinesPolarityFromBKP(void);
53-
54-
55-
56-
//crc.h
57-
//uint32_t calkCRCofFlash(void);
58-
//uint32_t calcCRCofBKP(void);
59-
//uint8_t isCRC_OK_BKP(void);
60-
//uint8_t isCRC_OK_Flash(void);
61-
62-
63-
//flash.h
64-
//void flash_unlock(void);
65-
//void flash_lock(void);
66-
//uint8_t flash_ready(void);
67-
//void flash_erase_page(uint32_t address);
68-
//void flash_write(uint32_t address, uint32_t data);
69-
//uint32_t flash_read(uint32_t address);
70-
71-
24+
void menuLocker(WM_HWIN *CurrentMenuHandle);
7225
#endif

‎Inc/guivars.h

+6
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
#define CURRENT_ORANGE_LEVEL 85
5858

5959
#define UNLOCK_PASSWORD_ARRAY {4,0,2,5,1}
60+
#define TIME_TO_LOCK_MENU 30
61+
62+
#define __TURN_BACKLIGHT_ON BACKLIGHT_CONTROL_GPIO_Port->BSRR |= BACKLIGHT_CONTROL_Pin
63+
#define __TURN_BACKLIGHT_OFF BACKLIGHT_CONTROL_GPIO_Port->BSRR |= (BACKLIGHT_CONTROL_Pin<<16)
6064
typedef struct
6165
{
6266
uint8_t menuLocked;
@@ -69,7 +73,9 @@ typedef struct
6973
uint8_t valsChanged;
7074
uint8_t linesPolarity;
7175
uint8_t linesTimeChanged;
76+
uint8_t lockCountDown;
7277
int16_t diffSystemLine;
78+
7379

7480
} GUI_Vars;
7581
typedef struct

‎Inc/main.h

+2
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ void Error_Handler(void);
116116
#define NOT_PEN_GPIO_Port GPIOB
117117
#define TOUCH_CS_Pin GPIO_PIN_7
118118
#define TOUCH_CS_GPIO_Port GPIOB
119+
#define BACKLIGHT_CONTROL_Pin GPIO_PIN_0
120+
#define BACKLIGHT_CONTROL_GPIO_Port GPIOE
119121
#define LCD_RESET_Pin GPIO_PIN_1
120122
#define LCD_RESET_GPIO_Port GPIOE
121123
/* USER CODE BEGIN Private defines */

‎Middlewares/Third_Party/STemWin/config/src/mainMenu.c

+33-9
Original file line numberDiff line numberDiff line change
@@ -9225,7 +9225,7 @@ static void _cbDialog(WM_MESSAGE * pMsg) {
92259225
switch(pMsg->MsgId) {
92269226
case WM_INIT_DIALOG:
92279227

9228-
9228+
masterClock.guiVars->lockCountDown = TIME_TO_LOCK_MENU;
92299229
hItem = pMsg->hWin;
92309230
WINDOW_SetBkColor(hItem, 0x191615);
92319231

@@ -9302,17 +9302,28 @@ static void _cbDialog(WM_MESSAGE * pMsg) {
93029302

93039303
if (masterClock.guiVars->menuLocked)
93049304
{
9305-
WM_HideWindow(WM_GetDialogItem(pMsg->hWin, ID_IMAGE_1));
9306-
WM_ShowWindow(WM_GetDialogItem(pMsg->hWin, ID_IMAGE_2));
9305+
WM_HideWindow(WM_GetDialogItem(pMsg->hWin, ID_IMAGE_2));
9306+
WM_ShowWindow(WM_GetDialogItem(pMsg->hWin, ID_IMAGE_1));
93079307
}
93089308
else
93099309
{
9310-
WM_HideWindow(WM_GetDialogItem(pMsg->hWin, ID_IMAGE_2));
9311-
WM_ShowWindow(WM_GetDialogItem(pMsg->hWin, ID_IMAGE_1));
9310+
WM_HideWindow(WM_GetDialogItem(pMsg->hWin, ID_IMAGE_1));
9311+
WM_ShowWindow(WM_GetDialogItem(pMsg->hWin, ID_IMAGE_2));
93129312
}
93139313

93149314
break;
93159315
case WM_BACKTOMAINMENU:
9316+
masterClock.guiVars->lockCountDown = TIME_TO_LOCK_MENU;
9317+
if (masterClock.guiVars->menuLocked)
9318+
{
9319+
WM_HideWindow(WM_GetDialogItem(pMsg->hWin, ID_IMAGE_2));
9320+
WM_ShowWindow(WM_GetDialogItem(pMsg->hWin, ID_IMAGE_1));
9321+
}
9322+
else
9323+
{
9324+
WM_HideWindow(WM_GetDialogItem(pMsg->hWin, ID_IMAGE_1));
9325+
WM_ShowWindow(WM_GetDialogItem(pMsg->hWin, ID_IMAGE_2));
9326+
}
93169327
masterClock.guiVars->menuState = MENU_STATE_MAIN;
93179328
forceUpdateStrings();
93189329
break;
@@ -9338,20 +9349,33 @@ static void _cbDialog(WM_MESSAGE * pMsg) {
93389349
if (masterClock.guiVars->prevSecond_H == 5) //ïðîøëà ìèíóòà
93399350
{
93409351
sprintf(timeString, "%02d:%02d", sTime.Hours, sTime.Minutes);
9341-
TEXT_SetText(masterClock.handles->hHourMinString, timeString); //îáíîâëåíèå ñòðîêè ñ ÷àñàìè è ìèíóòàìè
9352+
TEXT_SetText(masterClock.handles->hHourMinString, timeString); //îáíîâëåíèå ñòðîêè ñ ÷àñàìè è ìèíóòàìè
93429353

93439354
}
93449355
}
93459356
pMsg->MsgId = 0;
93469357
masterClock.guiVars->prevSecond_L = sTime.Seconds % 10;
93479358
masterClock.guiVars->prevSecond_H = sTime.Seconds / 10;
9348-
break;
9359+
// if (masterClock.guiVars->lockCountDown != 0)
9360+
// {
9361+
// masterClock.guiVars->lockCountDown--;
9362+
// }
9363+
// else
9364+
// {
9365+
// __TURN_BACKLIGHT_OFF;
9366+
// masterClock.guiVars->menuLocked = 1;
9367+
// WM_HideWindow(WM_GetDialogItem(pMsg->hWin, ID_IMAGE_2));
9368+
// WM_ShowWindow(WM_GetDialogItem(pMsg->hWin, ID_IMAGE_1));
9369+
// }
9370+
break;
93499371

93509372

93519373

93529374
case WM_NOTIFY_PARENT:
93539375
Id = WM_GetId(pMsg->hWinSrc);
93549376
NCode = pMsg->Data.v;
9377+
masterClock.guiVars->lockCountDown = TIME_TO_LOCK_MENU;
9378+
93559379
switch (Id) {
93569380
case ID_BUTTON_LINE1: // Notifications sent by ''
93579381
switch(NCode) {
@@ -9463,7 +9487,7 @@ static void _cbDialog(WM_MESSAGE * pMsg) {
94639487
}
94649488
break;
94659489
// USER START (Optionally insert additional code for further Ids)
9466-
case ID_IMAGE_1 : // Notifications sent by Lock
9490+
case ID_IMAGE_1 : // Notifications sent by Lock
94679491
switch(NCode) {
94689492
case WM_NOTIFICATION_CLICKED:
94699493
// USER START (Optionally insert code for reacting on notification message)
@@ -9649,7 +9673,7 @@ void TFT_ShowChar(u16 x, u16 y, u8 num, uint8_t fontsize, u16 color)
96499673
else
96509674
{
96519675

9652-
Lcd_Write_Data(backgroundBuffer[backgrline]); //°??«
9676+
Lcd_Write_Data(backgroundBuffer[backgrline]); //°??«
96539677

96549678
}
96559679
mask >>= 1;

‎Src/callbacks.c

+28-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "LineSetupPulse.h"
1212
#include "LineSetup.h"
1313
#include "timedate.h"
14-
14+
#include "main.h"
1515
#define HEADER_ITEM0 0
1616
#define HEADER_ITEM1 1
1717
#define HEADER_ITEM2 2
@@ -372,7 +372,7 @@ void TFT_LineSetupShowChar(u16 x, u16 y, u8 num, uint8_t fontsize, u16 color)
372372
else
373373
{
374374

375-
Lcd_Write_Data(0x49E7); //°??«
375+
Lcd_Write_Data(0x49E7); //°??«
376376

377377
}
378378
mask >>= 1;
@@ -558,3 +558,29 @@ void pollButton(uint16_t id, uint8_t action, int8_t* val)
558558
}
559559

560560
}
561+
void menuLocker(WM_HWIN *CurrentMenuHandle)
562+
{
563+
564+
565+
if (masterClock.guiVars->lockCountDown != 0)
566+
{
567+
masterClock.guiVars->lockCountDown--;
568+
}
569+
else
570+
{
571+
if (*CurrentMenuHandle == masterClock.handles->hMainMenu && masterClock.guiVars->menuLocked)
572+
{
573+
__TURN_BACKLIGHT_OFF;
574+
return;
575+
}
576+
WM_MESSAGE msg;
577+
msg.MsgId = WM_BACKTOMAINMENU;
578+
msg.Data.v = 0xFF;
579+
masterClock.guiVars->lockCountDown = 30;
580+
masterClock.guiVars->menuLocked = 1;
581+
masterClock.guiVars->menuState = MENU_STATE_MAIN;
582+
WM_SendMessage(masterClock.handles->hMainMenu, &msg);
583+
WM_DeleteWindow(*CurrentMenuHandle);
584+
585+
}
586+
}

‎Src/main.c

+42-26
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ void delay(uint32_t delayTime);
148148

149149
/* Private user code ---------------------------------------------------------*/
150150
/* USER CODE BEGIN 0 */
151-
151+
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
152+
{
153+
masterClock.currentSense->DMAtransferComplete = 1;
154+
}
152155
void delay(uint32_t delayTime)
153156
{
154157
uint32_t i;
@@ -273,7 +276,8 @@ int main(void)
273276
MX_ADC1_Init();
274277
/* USER CODE BEGIN 2 */
275278
//GUI_Init();
276-
HAL_RTCEx_SetSecond_IT(&hrtc);
279+
__TURN_BACKLIGHT_ON;
280+
HAL_RTCEx_SetSecond_IT(&hrtc);
277281
//Init_SSD1289();
278282

279283
variables.calibrated = 1;
@@ -284,15 +288,15 @@ int main(void)
284288
/* USER CODE END 2 */
285289

286290
/* USER CODE BEGIN RTOS_MUTEX */
287-
/* add mutexes, ... */
291+
/* add mutexes, ... */
288292
/* USER CODE END RTOS_MUTEX */
289293

290294
/* USER CODE BEGIN RTOS_SEMAPHORES */
291-
/* add semaphores, ... */
295+
/* add semaphores, ... */
292296
/* USER CODE END RTOS_SEMAPHORES */
293297

294298
/* USER CODE BEGIN RTOS_TIMERS */
295-
/* start timers, add new ones, ... */
299+
/* start timers, add new ones, ... */
296300
/* USER CODE END RTOS_TIMERS */
297301

298302
/* Create the thread(s) */
@@ -321,11 +325,11 @@ int main(void)
321325
TaskLine3Handle = osThreadCreate(osThread(TaskLine3), NULL);
322326

323327
/* USER CODE BEGIN RTOS_THREADS */
324-
/* add threads, ... */
328+
/* add threads, ... */
325329
/* USER CODE END RTOS_THREADS */
326330

327331
/* USER CODE BEGIN RTOS_QUEUES */
328-
/* add queues, ... */
332+
/* add queues, ... */
329333
/* USER CODE END RTOS_QUEUES */
330334

331335

@@ -564,6 +568,7 @@ static void MX_RTC_Init(void)
564568

565569
/**Initialize RTC and set the Time and Date
566570
*/
571+
567572
/* USER CODE BEGIN RTC_Init 2 */
568573
HAL_RTC_GetTime(&hrtc, &sTime, RTC_FORMAT_BIN);
569574
/* USER CODE END RTC_Init 2 */
@@ -716,7 +721,7 @@ static void MX_GPIO_Init(void)
716721
/*Configure GPIO pin Output Level */
717722
HAL_GPIO_WritePin(GPIOE,
718723
LINE0_NEG_OUTPUT_Pin|LINE1_NEG_OUTPUT_Pin|LINE2_NEG_OUTPUT_Pin|LINE3_NEG_OUTPUT_Pin
719-
|LCD_RESET_Pin,
724+
|BACKLIGHT_CONTROL_Pin|LCD_RESET_Pin,
720725
GPIO_PIN_RESET);
721726

722727
/*Configure GPIO pin Output Level */
@@ -774,6 +779,13 @@ static void MX_GPIO_Init(void)
774779
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
775780
HAL_GPIO_Init(TOUCH_CS_GPIO_Port, &GPIO_InitStruct);
776781

782+
/*Configure GPIO pin : BACKLIGHT_CONTROL_Pin */
783+
GPIO_InitStruct.Pin = BACKLIGHT_CONTROL_Pin;
784+
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
785+
GPIO_InitStruct.Pull = GPIO_PULLUP;
786+
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
787+
HAL_GPIO_Init(BACKLIGHT_CONTROL_GPIO_Port, &GPIO_InitStruct);
788+
777789
}
778790

779791
/* FSMC initialization function */
@@ -818,8 +830,7 @@ static void MX_FSMC_Init(void)
818830

819831
__HAL_AFIO_FSMCNADV_DISCONNECTED();
820832

821-
}
822-
833+
}
823834
/* USER CODE BEGIN 4 */
824835

825836

@@ -958,21 +969,21 @@ void vTaskGUI(void const * argument)
958969
{
959970
if (masterClock.timeCalibration->seconds > 0) //åñëè äîáàâèòü ñåêóíäû
960971
{
961-
sTime.Seconds += masterClock.timeCalibration->seconds; //ïðèáàâèëè ñåêóíäû
972+
sTime.Seconds += masterClock.timeCalibration->seconds; //ïðèáàâèëè ñåêóíäû
962973
if(HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BIN) != HAL_OK)
963974
{
964975
Error_Handler();
965976
}
966977
}
967978
if (masterClock.timeCalibration->seconds < 0) //åñëè óáàâèòü ñåêóíäû
968979
{
969-
sTime.Seconds += masterClock.timeCalibration->seconds; //ïðèáàâèëè ñåêóíäû
980+
sTime.Seconds += masterClock.timeCalibration->seconds; //ïðèáàâèëè ñåêóíäû
970981
if(HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BIN) != HAL_OK)
971982
{
972983
Error_Handler();
973984
}
974985
}
975-
masterClock.timeCalibration->daysPassed = 0; // 1 => 0
986+
masterClock.timeCalibration->daysPassed = 0; // 1 => 0
976987
timeCalibr.isCalibrated = true;
977988
}
978989
}
@@ -1018,33 +1029,43 @@ void vTaskGUI(void const * argument)
10181029
switch (masterClock.guiVars->menuState) {
10191030
case MENU_STATE_MAIN:
10201031
sendMsg(masterClock.handles->hMainMenu, WM_SEC_UPDATE);
1032+
menuLocker(&masterClock.handles->hMainMenu);
10211033
break;
10221034
case MENU_STATE_TIMESETUP:
10231035
sendMsg(masterClock.handles->hTimeSetupMenu, WM_SEC_UPDATE);
1036+
menuLocker(&masterClock.handles->hTimeSetupMenu);
10241037
break;
10251038
case MENU_STATE_LINE1SETUP:
10261039
sendMsg(masterClock.handles->hLineSetupMenu, WM_SEC_UPDATE);
1040+
menuLocker(&masterClock.handles->hLineSetupMenu);
10271041
break;
10281042
case MENU_STATE_LINE2SETUP:
10291043
sendMsg(masterClock.handles->hLineSetupMenu, WM_SEC_UPDATE);
1044+
menuLocker(&masterClock.handles->hLineSetupMenu);
10301045
break;
10311046
case MENU_STATE_LINE3SETUP:
10321047
sendMsg(masterClock.handles->hLineSetupMenu, WM_SEC_UPDATE);
1048+
menuLocker(&masterClock.handles->hLineSetupMenu);
10331049
break;
10341050
case MENU_STATE_LINE4SETUP:
10351051
sendMsg(masterClock.handles->hLineSetupMenu, WM_SEC_UPDATE);
1052+
menuLocker(&masterClock.handles->hLineSetupMenu);
10361053
break;
10371054
case MENU_STATE_LINE1SETUP_PULSE:
10381055
sendMsg(masterClock.handles->hLineSetupPulseMenu, WM_SEC_UPDATE);
1056+
menuLocker(&masterClock.handles->hLineSetupPulseMenu);
10391057
break;
10401058
case MENU_STATE_LINE2SETUP_PULSE:
10411059
sendMsg(masterClock.handles->hLineSetupPulseMenu, WM_SEC_UPDATE);
1060+
menuLocker(&masterClock.handles->hLineSetupPulseMenu);
10421061
break;
10431062
case MENU_STATE_LINE3SETUP_PULSE:
10441063
sendMsg(masterClock.handles->hLineSetupPulseMenu, WM_SEC_UPDATE);
1064+
menuLocker(&masterClock.handles->hLineSetupPulseMenu);
10451065
break;
10461066
case MENU_STATE_LINE4SETUP_PULSE:
10471067
sendMsg(masterClock.handles->hLineSetupPulseMenu, WM_SEC_UPDATE);
1068+
menuLocker(&masterClock.handles->hLineSetupPulseMenu);
10481069
break;
10491070
case MENU_STATE_PASSWORD:
10501071
sendMsg(masterClock.handles->hPasswordMenu, WM_SEC_UPDATE);
@@ -1069,7 +1090,7 @@ void vTaskGUI(void const * argument)
10691090
void vTaskLine0(void const * argument)
10701091
{
10711092
/* USER CODE BEGIN vTaskLine0 */
1072-
/* Infinite loop */
1093+
/* Infinite loop */
10731094
for (;;)
10741095
{
10751096
xSemaphoreTake(masterClock.line[0].xSemaphore, portMAX_DELAY);
@@ -1089,7 +1110,7 @@ void vTaskLine0(void const * argument)
10891110
void vTaskLine1(void const * argument)
10901111
{
10911112
/* USER CODE BEGIN vTaskLine1 */
1092-
/* Infinite loop */
1113+
/* Infinite loop */
10931114
for (;;)
10941115
{
10951116
xSemaphoreTake(masterClock.line[1].xSemaphore, portMAX_DELAY);
@@ -1109,7 +1130,7 @@ void vTaskLine1(void const * argument)
11091130
void vTaskLine2(void const * argument)
11101131
{
11111132
/* USER CODE BEGIN vTaskLine2 */
1112-
/* Infinite loop */
1133+
/* Infinite loop */
11131134
for (;;)
11141135
{
11151136
xSemaphoreTake(masterClock.line[2].xSemaphore, portMAX_DELAY);
@@ -1129,7 +1150,7 @@ void vTaskLine2(void const * argument)
11291150
void vTaskLine3(void const * argument)
11301151
{
11311152
/* USER CODE BEGIN vTaskLine3 */
1132-
/* Infinite loop */
1153+
/* Infinite loop */
11331154
for (;;)
11341155
{
11351156
xSemaphoreTake(masterClock.line[3].xSemaphore, portMAX_DELAY);
@@ -1139,11 +1160,6 @@ void vTaskLine3(void const * argument)
11391160
/* USER CODE END vTaskLine3 */
11401161
}
11411162

1142-
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
1143-
{
1144-
masterClock.currentSense->DMAtransferComplete = 1;
1145-
}
1146-
11471163
/**
11481164
* @brief Period elapsed callback in non blocking mode
11491165
* @note This function is called when TIM1 interrupt took place, inside
@@ -1172,7 +1188,7 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
11721188
void Error_Handler(void)
11731189
{
11741190
/* USER CODE BEGIN Error_Handler_Debug */
1175-
/* User can add his own implementation to report the HAL error return state */
1191+
/* User can add his own implementation to report the HAL error return state */
11761192

11771193
/* USER CODE END Error_Handler_Debug */
11781194
}
@@ -1188,9 +1204,9 @@ void Error_Handler(void)
11881204
void assert_failed(uint8_t *file, uint32_t line)
11891205
{
11901206
/* USER CODE BEGIN 6 */
1191-
/* User can add his own implementation to report the file name and line number,
1192-
tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
1193-
/* USER CODE END 6 */
1207+
/* User can add his own implementation to report the file name and line number,
1208+
tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
1209+
/* USER CODE END 6 */
11941210
}
11951211
#endif /* USE_FULL_ASSERT */
11961212

‎Src/touch.c

+6-7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#include "flash.h"
33
#include "crc.h"
44
#include "backup.h"
5+
#include "cmsis_os.h"
6+
#include "main.h"
57
#define TOLERANCE 20
68

79
//unsigned int Xs_1=0,Xs_2=0,Xs_3=0,Xs_4=0,Ys_1=0,Ys_2=0,Ys_3=0,Ys_4=0; //јЗВјґҐЧш±кЦµ
@@ -131,7 +133,7 @@ uint8_t ReadTouchXY(Variables *var)
131133

132134
//var->a=touch;
133135

134-
while (var->touch_it&&count < 10)
136+
while(var->touch_it&&count < 10)
135137
{
136138
if (read_once(var))
137139
{
@@ -177,7 +179,7 @@ uint8_t ReadTouchXY(Variables *var)
177179

178180
x1 = buffer_x[3]; x2 = buffer_x[4];
179181
y1 = buffer_y[3]; y2 = buffer_y[4];
180-
if (((x1 > x2) && (x1 > x2 + TOLERANCE)) || ((x2 > x1) && (x2 > x1 + TOLERANCE)) || ((y1 > y2) && (y1 > y2 + TOLERANCE)) || ((y2 > y1) && (y2 > y1 + TOLERANCE)));
182+
if (((x1 > x2) && (x1 > x2 + TOLERANCE)) || ((x2 > x1) && (x2 > x1 + TOLERANCE)) || ((y1 > y2) && (y1 > y2 + TOLERANCE)) || ((y2 > y1) && (y2 > y1 + TOLERANCE))) ;
181183
else
182184
{
183185
X1 = (buffer_x[3] + buffer_x[4]) / 2;
@@ -413,13 +415,10 @@ void touch_control(Variables *var)
413415
var->touch_it = !HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_6);
414416
if (var->calibrated)
415417
{
416-
417-
418418
if (var->touch_it == 1)
419419
{
420-
421-
422-
420+
__TURN_BACKLIGHT_ON;
421+
masterClock.guiVars->lockCountDown = TIME_TO_LOCK_MENU;
423422
if (ReadTouchXY(var))
424423
{
425424
touch_correct(var);

‎VisualGDB/VisualGDBCache/freertos_cubemx-Debug/MemoryUtilizationReport.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
<Memories>
44
<MemoryUtilization>
55
<MemoryName>FLASH</MemoryName>
6-
<Used>225408</Used>
6+
<Used>225868</Used>
77
<Total>524288</Total>
88
</MemoryUtilization>
99
<MemoryUtilization>
1010
<MemoryName>SRAM</MemoryName>
11-
<Used>52636</Used>
11+
<Used>52640</Used>
1212
<Total>65536</Total>
1313
</MemoryUtilization>
1414
</Memories>

‎freertos_cubemx.gpdsc

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
22
<!-- ******************************************************************************
33
* File Name : freertos_cubemx.gpdsc
4-
* Date : 28/02/2019 22:14:29
4+
* Date : 02/03/2019 13:11:47
55
* Description : Generator PDSC File generated by STM32CubeMX (DO NOT EDIT!)
66
****************************************************************************** -->
77

@@ -12,7 +12,7 @@
1212
<url>C:\stm32\masterclock</url>
1313
<releases>
1414
<release version="1.0.0">
15-
- Generated: 28/02/2019 22:14:29
15+
- Generated: 02/03/2019 13:11:47
1616
</release>
1717
</releases>
1818
<requirements>
@@ -170,6 +170,20 @@
170170
<file category="header" condition="" name="Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c"/>
171171
</files>
172172
</component>
173+
<component Cclass="Device" Cgroup="STM32Cube HAL" Csub="PCCARD" Cversion="1.0.0">
174+
<description></description>
175+
<files>
176+
<file category="header" condition="" name="Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_fsmc.h"/>
177+
<file category="source" condition="" name="Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_ll_fsmc.c"/>
178+
</files>
179+
</component>
180+
<component Cclass="Device" Cgroup="STM32Cube HAL" Csub="NOR" Cversion="1.0.0">
181+
<description></description>
182+
<files>
183+
<file category="header" condition="" name="Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_fsmc.h"/>
184+
<file category="source" condition="" name="Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_ll_fsmc.c"/>
185+
</files>
186+
</component>
173187
<component Cclass="Device" Cgroup="STM32Cube HAL" Csub="FREERTOS" Cversion="9.0.0">
174188
<description></description>
175189
<files>
@@ -205,20 +219,6 @@
205219
<file category="header" condition="GCC Toolchain" name="Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM3\portmacro.h"/>
206220
</files>
207221
</component>
208-
<component Cclass="Device" Cgroup="STM32Cube HAL" Csub="NOR" Cversion="1.0.0">
209-
<description></description>
210-
<files>
211-
<file category="header" condition="" name="Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_fsmc.h"/>
212-
<file category="source" condition="" name="Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_ll_fsmc.c"/>
213-
</files>
214-
</component>
215-
<component Cclass="Device" Cgroup="STM32Cube HAL" Csub="PCCARD" Cversion="1.0.0">
216-
<description></description>
217-
<files>
218-
<file category="header" condition="" name="Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_fsmc.h"/>
219-
<file category="source" condition="" name="Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_ll_fsmc.c"/>
220-
</files>
221-
</component>
222222
<component Cclass="Device" Cgroup="STM32Cube HAL" Csub="RCC" Cversion="0.3.0">
223223
<description></description>
224224
<files>

‎freertos_cubemx.ioc

+15-8
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,20 @@ Mcu.Pin42=PB3
9696
Mcu.Pin43=PB4
9797
Mcu.Pin44=PB6
9898
Mcu.Pin45=PB7
99-
Mcu.Pin46=PE1
100-
Mcu.Pin47=VP_CRC_VS_CRC
101-
Mcu.Pin48=VP_FREERTOS_VS_ENABLE
102-
Mcu.Pin49=VP_RTC_VS_RTC_Activate
99+
Mcu.Pin46=PE0
100+
Mcu.Pin47=PE1
101+
Mcu.Pin48=VP_CRC_VS_CRC
102+
Mcu.Pin49=VP_FREERTOS_VS_ENABLE
103103
Mcu.Pin5=PC15-OSC32_OUT
104-
Mcu.Pin50=VP_RTC_VS_RTC_Calendar
105-
Mcu.Pin51=VP_SYS_VS_tim1
106-
Mcu.Pin52=VP_TIM7_VS_ClockSourceINT
104+
Mcu.Pin50=VP_RTC_VS_RTC_Activate
105+
Mcu.Pin51=VP_RTC_VS_RTC_Calendar
106+
Mcu.Pin52=VP_SYS_VS_tim1
107+
Mcu.Pin53=VP_TIM7_VS_ClockSourceINT
107108
Mcu.Pin6=OSC_IN
108109
Mcu.Pin7=OSC_OUT
109110
Mcu.Pin8=PC1
110111
Mcu.Pin9=PA4
111-
Mcu.PinsNb=53
112+
Mcu.PinsNb=54
112113
Mcu.ThirdPartyNb=0
113114
Mcu.UserConstants=
114115
Mcu.UserName=STM32F103VETx
@@ -248,6 +249,12 @@ PD8.Mode=16b-d1
248249
PD8.Signal=FSMC_D13
249250
PD9.Mode=16b-d1
250251
PD9.Signal=FSMC_D14
252+
PE0.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultOutputPP
253+
PE0.GPIO_Label=BACKLIGHT_CONTROL
254+
PE0.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_OD
255+
PE0.GPIO_PuPd=GPIO_PULLUP
256+
PE0.Locked=true
257+
PE0.Signal=GPIO_Output
251258
PE1.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultOutputPP
252259
PE1.GPIO_Label=LCD_RESET
253260
PE1.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_PP

0 commit comments

Comments
 (0)
Please sign in to comment.