This commit is contained in:
小冯Sir 2024-05-03 14:01:03 +08:00
parent 49c136b725
commit c84bfcd86a

View File

@ -12,41 +12,43 @@
#include "sdio.h" #include "sdio.h"
#include "rtc.h" #include "rtc.h"
void Staring_Menu(){ void Staring_Menu() {
WS_TFT_Clear(WHITE); WS_TFT_Clear(WHITE);
char buffer[120]; char buffer[120];
if(sdMountFlag == 1){ if (sdMountFlag == 1) {
WS_TFT_Dis_12X24_String(0,0,"SD card mount OK!",WHITE,GREEN); WS_TFT_Dis_12X24_String(0, 0, "SD card mount OK!", WHITE, GREEN);
WS_TFT_Dis_12X24_String(0,25,"SD card init OK!",WHITE,GREEN); WS_TFT_Dis_12X24_String(0, 25, "SD card init OK!", WHITE, GREEN);
sprintf(buffer,"size: %.1f M",(float )hsd.SdCard.BlockNbr * hsd.SdCard sprintf(buffer, "size: %.1f M", (float)hsd.SdCard.BlockNbr * hsd.SdCard
.BlockSize/ 1024 / 1024); .BlockSize / 1024 / 1024);
WS_TFT_Dis_12X24_String(0,49,buffer,WHITE,GREEN); WS_TFT_Dis_12X24_String(0, 49, buffer, WHITE, GREEN);
WS_TFT_Dis_12X24_String(0,73,"System Init OK!",WHITE,GREEN); WS_TFT_Dis_12X24_String(0, 73, "System Init OK!", WHITE, GREEN);
}else{ } else {
WS_TFT_Dis_12X24_String(0,0,"SD card mount fail!",WHITE,RED); 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); WS_TFT_Dis_12X24_String(0, 0, "Please Check sdCard", WHITE, RED);
} }
HAL_Delay(20); HAL_Delay(20);
WS_TFT_Clear(WHITE); WS_TFT_Clear(WHITE);
} }
void showTime(){ void showTime() {
RTC_TimeTypeDef sTime; RTC_TimeTypeDef sTime;
RTC_DateTypeDef sDate; RTC_DateTypeDef sDate;
HAL_RTC_GetTime(&hrtc,&sTime,RTC_FORMAT_BIN); HAL_RTC_GetTime(&hrtc, &sTime, RTC_FORMAT_BIN);
HAL_RTC_GetDate(&hrtc,&sDate,RTC_FORMAT_BIN); HAL_RTC_GetDate(&hrtc, &sDate, RTC_FORMAT_BIN);
uint8_t buffer[32]; uint8_t buffer[32];
sprintf(buffer,"20%02d-%02d-%02d week %d",sDate.Year,sDate.Month,sDate sprintf(buffer, "20%02u-%02u-%02u", sDate.Year, sDate.Month, sDate
.Date,sDate.WeekDay); .Date);
WS_TFT_Dis_12X24_String(16,0,buffer,WHITE,BLUE); WS_TFT_Dis_12X24_String(60, 0, buffer, WHITE, BLUE);
sprintf(buffer,"%02d:%02d:%02d",sTime.Hours,sTime.Minutes,sTime.Seconds); sprintf(buffer, "%02u:%02u:%02u", sTime.Hours, sTime.Minutes, sTime.Seconds);
WS_TFT_Dis_12X24_String(72,25,buffer,WHITE,BLUE); WS_TFT_Dis_12X24_String(72, 25, buffer, WHITE, BLUE);
} }
void user_Menu(){ void user_Menu() {
showTime(); showTime();
} }