修改了一些代码

This commit is contained in:
2026-06-28 23:50:53 +08:00
parent c9d25d7323
commit 8aa637be48
12 changed files with 210 additions and 1310 deletions
+7 -13
View File
@@ -4,14 +4,6 @@
/* ========================================================================
* 系统常量
* ======================================================================== */
#define FOSC 24000000UL /* 系统主频 24MHz */
#define PWM_PERIOD 5000 /* 20ms / 4us = 5000 步 */
#define PWM_MIN 250 /* 1.0ms 脉宽 (4us/步) */
#define PWM_MAX 500 /* 2.0ms 脉宽 */
#define PWM_MID 375 /* 1.5ms 脉宽 */
#define CHANNEL_COUNT 4 /* 4路PWM输出 */
#define UART_BUF_SIZE 32
/* 接收状态 */
@@ -33,16 +25,18 @@
#define RF_PHRASE_LEN 6
/* LED 闪烁模式 */
#define LED_BLINK_SLOW 0 /* 1Hz - 未连接 */
#define LED_BLINK_FAST 1 /* 3Hz - 对频中 */
#define LED_ON 2 /* 常亮 - 已连接 */
#define LED_OFF 3 /* 熄灭 */
#define LED_BLINK_DOUBLE 4 /* 双闪 - NRF硬件错误 */
#define UNCONNECTED 0 /* 1Hz - 未连接 */
#define NRF_BINDING 1 /* 3Hz - 对频中 */
#define CONNECTED 2 /* 常亮 - 已连接 */
#define NRF_ERROR 4 /* 双闪 - NRF硬件错误 */
/* ========================================================================
* 全局变量
* ======================================================================== */
// 系统滴答定时器计数 (用于LED闪烁)
static uint8 sys_tick = 0;
/* PWM 通道脉宽值 (4us单位, 放在 xdata) */
static volatile uint16_t __xdata pwm_ch[CHANNEL_COUNT];