Initial commit - sync AliceRC to Gitea
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @file uart.h
|
||||
* @brief UART1 驱动 (命令解析 / SBUS 输出复用)
|
||||
* UART1 资源:
|
||||
* - P3.0 = RX (命令输入)
|
||||
* - P3.1 = TX (默认调试输出/SBUS 输出经板上三极管反相)
|
||||
*
|
||||
* 主循环调用 uart_poll() 处理命令接收
|
||||
* SBUS 输出由调用者直接调用 uart1_send_byte()
|
||||
*/
|
||||
#ifndef __UART_H
|
||||
#define __UART_H
|
||||
|
||||
#include "stc8h.h"
|
||||
#include <stdint.h>
|
||||
|
||||
void uart1_init(uint32_t baud);
|
||||
void uart1_send_byte(uint8_t b);
|
||||
void uart1_send_bytes(const uint8_t *buf, uint8_t len);
|
||||
uint8_t uart1_rx_available(void);
|
||||
uint8_t uart1_read_byte(void);
|
||||
|
||||
/* 接收环形缓冲区 (64 字节,放 XDATA) */
|
||||
#define UART1_RX_BUF_SIZE 64
|
||||
extern volatile uint8_t __xdata g_uart1_rx_buf[UART1_RX_BUF_SIZE];
|
||||
extern volatile uint8_t __xdata g_uart1_rx_head;
|
||||
extern volatile uint8_t __xdata g_uart1_rx_tail;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user