This commit is contained in:
TuxMonkey
2026-08-17 23:49:29 +08:00
parent 14a3ab4cd0
commit fc6ac7a0b4
3 changed files with 146 additions and 7 deletions

View File

@@ -17,6 +17,21 @@
#include "main.h"
#include "usart.h"
/* Change this one macro to select the remote control protocol. */
#define REMOTE_TYPE_DJI_DT7 1
#define REMOTE_TYPE_FS_I6 2
#ifndef REMOTE_CONTROL_TYPE
#define REMOTE_CONTROL_TYPE REMOTE_TYPE_FS_I6 // Change to REMOTE_TYPE_DJI_DT7 for DT7.
#endif
#if REMOTE_CONTROL_TYPE == REMOTE_TYPE_DJI_DT7
#define REMOTE_DJI_DT7
#elif REMOTE_CONTROL_TYPE == REMOTE_TYPE_FS_I6
#define REMOTE_FS_I6
#else
#error "Unsupported remote control protocol"
#endif
// 用于遥控器数据读取,遥控器数据是一个大小为2的数组
#define LAST 1
#define TEMP 0
@@ -99,6 +114,10 @@ typedef struct
uint8_t switch_left; // 左侧开关
uint8_t switch_right; // 右侧开关
#ifdef REMOTE_FS_I6
uint16_t ch[10]; // FSi6原始SBUS通道
#endif
} rc;
struct
{
@@ -111,6 +130,13 @@ typedef struct
Key_t key[3]; // 改为位域后的键盘索引,空间减少8倍,速度增加16~倍
uint8_t key_count[3][16];
#ifdef REMOTE_FS_I6
uint8_t sw_a;
uint8_t sw_b;
uint8_t sw_c;
uint8_t sw_d;
#endif
} RC_ctrl_t;
/* ------------------------- Internal Data ----------------------------------- */