2024-09-11 09:03:46 +00:00
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "UartTask.h"
|
|
|
|
|
|
#include "RTCTask.h"
|
|
|
|
|
|
#include "os_cfg.h"
|
|
|
|
|
|
|
2024-09-13 08:57:53 +00:00
|
|
|
|
#include "DrvRtcI2c.h"
|
|
|
|
|
|
#include "BSPUart.h"
|
|
|
|
|
|
|
2024-09-11 09:03:46 +00:00
|
|
|
|
#include "driverlib/uart.h"
|
|
|
|
|
|
#include "inc/hw_memmap.h"
|
|
|
|
|
|
|
|
|
|
|
|
// UART任务,周期性发送时间
|
|
|
|
|
|
void UartTask(void *p_arg)
|
|
|
|
|
|
{
|
|
|
|
|
|
char timeStr[12];
|
|
|
|
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
|
|
// 从全局变量读取时间
|
2024-09-13 08:57:53 +00:00
|
|
|
|
sprintf(timeStr, "%02u:%02u:%02u", time.hour, time.minute, time.second); // 格式化时间字符串
|
2024-09-11 09:03:46 +00:00
|
|
|
|
|
|
|
|
|
|
// 发送格式化的时间字符串到UART
|
|
|
|
|
|
for (int i = 0; timeStr[i] != '\0'; i++) {
|
|
|
|
|
|
UARTCharPut(UART1_BASE, timeStr[i]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OSTimeDlyHMSM(0, 0, 1, 0); // 延迟1秒
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|