Files
ZhaTianRC/rx/uart.h
T
2026-06-29 19:04:09 +08:00

26 lines
696 B
C
Raw 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.
# ifndef CONFIG
# define CONFIG
# include "config.h"
# endif
/* UART 接收缓冲 (放在 xdata) */
static uint8 __xdata uart_rx_buf[UART_BUF_SIZE];
void UART_Init(void);
void SBUS_Init(void);
void CRFS_Init(void);
void UART_Receive(void) __interrupt(4);
void UART_SendByte(uint8 dat);
void UART_SendString(uint8 size, char *str);
void UART_ParseCommand(void);
/* 转换数据为sbus信号输出
* sbus为25字节固定信号,数据结构如下:
* Byte 1 | 帧头(固定为0x0F)
* Byte 2-23 | 数据通道(16个11位数据)
* Byte 24 | 标志位(包含帧丢失、故障保护等)
* Byte 25 | 帧尾(固定为0x00
*/
void SBUS_Update(RFDATA dat);