24 lines
888 B
C
24 lines
888 B
C
#ifndef __SERIAL_H
|
|
#define __SERIAL_H
|
|
|
|
#include <stdio.h>
|
|
#include "stm32f10x.h"
|
|
|
|
// 函数作用:初始化调试/通信串口及其接收缓冲区。
|
|
void Serial_Init(void);
|
|
// 函数作用:通过串口发送一个字节。
|
|
void Serial_SendByte(uint8_t Byte);
|
|
// 函数作用:通过串口连续发送以空字符结尾的字符串。
|
|
void Serial_SendString(const char* String);
|
|
// 函数作用:返回串口接收缓冲区指针,供主循环解析接收到的数据。
|
|
char* Serial_GetRxBuffer(void);
|
|
// 函数作用:清空串口接收缓冲区并复位接收状态。
|
|
void Serial_ClearRxBuffer(void);
|
|
|
|
// 注意:Get_Time_ms() 函数与串口无关,应该在 `Delay.h` 中声明。
|
|
// 我们暂时将它与串口放一起,但更规范的做法是分离。
|
|
// 函数作用:返回系统启动以来经过的毫秒数。
|
|
uint32_t Get_Time_ms(void);
|
|
|
|
#endif
|