2026-08-26 07:26:58 +08:00
|
|
|
|
#ifndef __USART_H__
|
|
|
|
|
|
#define __USART_H__
|
|
|
|
|
|
|
|
|
|
|
|
#include "at32f403a_407.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* USART2 / UART4 环形队列接口 */
|
|
|
|
|
|
|
|
|
|
|
|
/* 发送数据 */
|
|
|
|
|
|
void USART2_SendData(uint8_t *data, uint16_t len);
|
|
|
|
|
|
void USART4_SendData(uint8_t *data, uint16_t len);
|
|
|
|
|
|
|
2026-09-09 07:03:52 +08:00
|
|
|
|
/* 等待 UART4 发送环形缓冲排空(供关机 ACK 等场景) */
|
|
|
|
|
|
void USART4_WaitTxIdle(uint32_t timeout_ms);
|
|
|
|
|
|
|
2026-08-26 07:26:58 +08:00
|
|
|
|
/* 接收出队:返回 1=取到数据,0=队列空 */
|
|
|
|
|
|
uint8_t USART2_RxPop(uint8_t *c);
|
|
|
|
|
|
uint8_t UART4_RxPop(uint8_t *c);
|
|
|
|
|
|
|
|
|
|
|
|
/* 初始化(关联串口外设,由 wk_usart2_init / wk_uart4_init 调用) */
|
|
|
|
|
|
void uart_ring_usart2_init(void);
|
|
|
|
|
|
void uart_ring_uart4_init(void);
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* __USART_H__ */
|