20240909-DXSPX-emb/LWIP移植(移植)/Src/Usr/Task/UartTask.c
2024-10-15 13:48:59 +08:00

34 lines
743 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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"
#include "DrvRtcI2c.h"
#include "BSPUart.h"
#include "driverlib/uart.h"
#include "inc/hw_memmap.h"
// UART任务周期性发送时间
void UartTask(void *p_arg)
{
char timeStr[12];
while (1) {
// 从全局变量读取时间
sprintf(timeStr, "%02u:%02u:%02u", time.hour, time.minute, time.second); // 格式化时间字符串
// 发送格式化的时间字符串到UART
for (int i = 0; timeStr[i] != '\0'; i++) {
UARTCharPut(UART1_BASE, timeStr[i]);
}
OSTimeDlyHMSM(0, 0, 1, 0); // 延迟1秒
}
}