将数据显示在LCD上
//获取时间:时分秒
HAL_RTC_GetTime(&RTC_Handler,&RTC_TimeStruct,RTC_FORMAT_BIN);
sprintf((char*)tbuf,"Time:%02d:%02d:%02d",RTC_TimeStruct.Hours,RTC_TimeStruct.Minutes,RTC_TimeStruct.Seconds);
LCD_ShowString(30,140,210,16,16,tbuf);
//获取日期:年月日,周
HAL_RTC_GetDate(&RTC_Handler,&RTC_DateStruct,RTC_FORMAT_BIN);
sprintf((char*)tbuf,"Date:20%02d-%02d-%02d",RTC_DateStruct.Year,RTC_DateStruct.Month,RTC_DateStruct.Date);
LCD_ShowString(30,160,210,16,16,tbuf);
sprintf((char*)tbuf,"Week:%d",RTC_DateStruct.WeekDay);
LCD_ShowString(30,180,210,16,16,tbuf);
|