From 8792c83418c306bcd45f5acd248419962113ee70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=86=AFSir?= Date: Fri, 3 May 2024 03:31:51 +0800 Subject: [PATCH] update menu function --- Firmware/Core/apps/Inc/menu.h | 1 + Firmware/Core/apps/src/menu.c | 25 +++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Firmware/Core/apps/Inc/menu.h b/Firmware/Core/apps/Inc/menu.h index 4e14b75..df718da 100644 --- a/Firmware/Core/apps/Inc/menu.h +++ b/Firmware/Core/apps/Inc/menu.h @@ -14,4 +14,5 @@ void Staring_Menu(); void user_Menu(); + #endif //APPS_CORE_APPS_INC_MENU_H_ diff --git a/Firmware/Core/apps/src/menu.c b/Firmware/Core/apps/src/menu.c index 116d0d5..36a1cd0 100644 --- a/Firmware/Core/apps/src/menu.c +++ b/Firmware/Core/apps/src/menu.c @@ -7,8 +7,10 @@ * @日 期 : 24-4-28 ****************************************************************************** */ +#include #include "menu.h" #include "sdio.h" +#include "rtc.h" void Staring_Menu(){ WS_TFT_Clear(WHITE); @@ -24,8 +26,27 @@ void Staring_Menu(){ WS_TFT_Dis_12X24_String(0,0,"SD card mount fail!",WHITE,RED); WS_TFT_Dis_12X24_String(0,0,"Please Check sdCard",WHITE,RED); } + HAL_Delay(20); + WS_TFT_Clear(WHITE); +} + +void showTime(){ + RTC_TimeTypeDef sTime; + RTC_DateTypeDef sDate; + HAL_RTC_GetTime(&hrtc,&sTime,RTC_FORMAT_BIN); + HAL_RTC_GetDate(&hrtc,&sDate,RTC_FORMAT_BIN); + uint8_t buffer[32]; + sprintf(buffer,"20%02d-%02d-%02d week %d",sDate.Year,sDate.Month,sDate + .Date,sDate.WeekDay); + WS_TFT_Dis_12X24_String(16,0,buffer,WHITE,BLUE); + sprintf(buffer,"%02d:%02d:%02d",sTime.Hours,sTime.Minutes,sTime.Seconds); + WS_TFT_Dis_12X24_String(72,25,buffer,WHITE,BLUE); + } void user_Menu(){ - HAL_Delay(20); -} \ No newline at end of file + + showTime(); + +} +