Initial commit - sync AliceRC to Gitea
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @file cmd.h
|
||||
* @brief 串口命令解析
|
||||
* 支持格式:
|
||||
* MODEL(SBUS) - 切换到 SBUS 输出模式
|
||||
* MODEL(PWM) - 切换到 PWM 输出模式
|
||||
* MODEL(UART) - 切换到 UART 输出模式
|
||||
* ADDR(0xXX) - 修改 NRF24L01 地址 5 字节
|
||||
* TUN(N) - 修改 RF 频道 (0..125)
|
||||
*
|
||||
* 命令以回车或换行结束 (\r 或 \n)
|
||||
* 命令缓冲区最大 32 字节
|
||||
*/
|
||||
#ifndef __CMD_H
|
||||
#define __CMD_H
|
||||
|
||||
#include "stc8h.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define CMD_BUF_SIZE 32
|
||||
|
||||
/* 命令处理结果,通过 model.h 中的 setter 应用 */
|
||||
typedef struct {
|
||||
uint8_t set_mode; /* 1 = 需要切换模式 */
|
||||
uint8_t new_mode; /* RxMode_e */
|
||||
uint8_t set_addr; /* 1 = 需要更新地址 */
|
||||
uint8_t new_addr[5];
|
||||
uint8_t set_channel; /* 1 = 需要更新频道 */
|
||||
uint8_t new_channel;
|
||||
} CmdResult_t;
|
||||
|
||||
/* 主循环调用 */
|
||||
void cmd_poll(void);
|
||||
|
||||
/* 处理单个字节 (UART 中断已入队) */
|
||||
void cmd_feed_byte(uint8_t b);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user