From 2b5675a1a5e02d7b027aa8fc5db13d42ed7ed1db Mon Sep 17 00:00:00 2001 From: zouhaitao Date: Wed, 8 Jul 2026 09:57:05 +0800 Subject: [PATCH] feat: complete FCOB-2.7 SPI driver integration by mapping WS2812_DI to P2.3 and setting P_SW1 to 0x04 in GPIO_Init --- App/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/App/main.c b/App/main.c index 4425fc4..50a97d9 100644 --- a/App/main.c +++ b/App/main.c @@ -20,7 +20,7 @@ bit last_hw_b = 1; bit rgb_test_mode = 0; // 实际 WS2812 物理控制引脚(接 P0.0) -sbit WS2812_DI = P0^0; +sbit WS2812_DI = P2^3; // 振动马达控制引脚(输出1开启振动,输出0停止) sbit MOTOR = P2^5; @@ -1440,7 +1440,7 @@ void GPIO_Init(void) ET0 = 0; AUXR = 0x00; // T0, T1 为 12T 模式 (默认) INTCLKO = 0x00; - P_SW1 = 0x00; // 串口引脚映射:默认 P3.0 RxD, P3.1 TxD + P_SW1 = 0x04; // 串口引脚映射:P3.0 RxD, P3.1 TxD; SPI映射到第二组 (P2.2-P2.5) P_SW2 = 0x00; P_SW3 = 0x00; @@ -1448,9 +1448,9 @@ void GPIO_Init(void) P0M1 &= ~((1 << 1) | (1 << 2) | (1 << 3)); P0M0 &= ~((1 << 1) | (1 << 2) | (1 << 3)); - // 配置 P0.0 (WS2812_DI) 为推挽输出,初始化默认输出 0 (Reset/Idle) - P0M1 &= ~(1 << 0); - P0M0 |= (1 << 0); + // 配置 P2.3 (WS2812_DI) 为推挽输出,初始化默认输出 0 (Reset/Idle) + P2M1 &= ~(1 << 3); + P2M0 |= (1 << 3); WS2812_DI = 0; // 配置 P2.5 (MOTOR) 震动马达、P2.6 (LED_B)、P2.7 (LED_G) 为推挽输出