diff --git a/App/Voilet.c b/App/Voilet.c index 67b98c2..5fff9a1 100644 --- a/App/Voilet.c +++ b/App/Voilet.c @@ -1,7 +1,6 @@ // // Created by anonymous on 2026/5/24. // -#include "Bsp.h" #include "Voilet.h" // LED灯数组 @@ -25,7 +24,8 @@ const GPIO_CONFIG DO_PERIPH[] = { #endif //串口配置表 const COM_CONFIG COM_PERIPH[] = { - {COM1,.TxPort = GPIO2, .TxMode = GPIO_Mode_AF_PP,.RxPort = GPIO3, .RxMode = GPIO_Mode_IPU,.Speed = GPIO_Speed_50MHz}, + {COM0,.TxPort = GPIO9, .RxPort =GPIO10, .Speed = GPIO_Speed_50MHz}, + {COM1,.TxPort = GPIO2, .RxPort = GPIO3, .Speed = GPIO_Speed_50MHz}, }; void BspExtraInit(void); @@ -41,17 +41,15 @@ void VoiletBspInit(void) { INTERRUPT_DISABLE + //初始化中断系统 + IrqInit(); + //初始化延时库 DelayConfig(); - //关闭所有外设时钟 - AllPeriphClockDisable(); - //LED灯配置 #if (LED_NUM != 0) - for (i = 0;i < LED_NUM;i++) { - //打开外设时钟 - GpioClockEnable(&LED_PERIPH[i].GpioX); + for (i = 0;i < ARRAY_LEN(LED_PERIPH);i++) { //配置GPIO口 GpioConfig(&LED_PERIPH[i].GpioX, LED_PERIPH[i].Mode, LED_PERIPH[i].Speed); } @@ -79,9 +77,8 @@ void VoiletBspInit(void) { //串口配置 for (i = 0;i < ARRAY_LEN(COM_PERIPH);i++) { - UartClockEnable(&COM_PERIPH[i].ComX); - GpioConfig(&COM_PERIPH[i].TxPort, COM_PERIPH[i].TxMode, COM_PERIPH[i].Speed); - GpioConfig(&COM_PERIPH[i].TxPort, COM_PERIPH[i].RxMode, COM_PERIPH[i].Speed); + GpioConfig(&COM_PERIPH[i].TxPort, GPIO_Mode_AF_PP, COM_PERIPH[i].Speed); + GpioConfig(&COM_PERIPH[i].RxPort, GPIO_Mode_IPU, COM_PERIPH[i].Speed); } INTERRUPT_ENABLE @@ -99,7 +96,7 @@ void BspExtraInit(void) { //LetterShell初始化 #ifdef USE_SHELL - // LetterShellInit(TTY_COM,TTY_BAUD); + LetterShellInit(TTY_COM,TTY_BAUD); #endif } diff --git a/App/Voilet.h b/App/Voilet.h index 81d6e30..61dee82 100644 --- a/App/Voilet.h +++ b/App/Voilet.h @@ -5,6 +5,8 @@ #ifndef VOILET_H #define VOILET_H +#include "Bsp.h" + #define LED_NUM 2 //LED灯数量 #if (LED_NUM != 0) #define LED0 0 @@ -19,8 +21,8 @@ #if (DO_NUM != 0) #endif -#define USE_SHELL //系统使用Shell #define TTY_COM COM1 +#define TTY_BAUD 115200 typedef struct { GPIO_MAP_T GpioX; @@ -29,11 +31,9 @@ typedef struct { }GPIO_CONFIG; typedef struct { - COM_MAP_T ComX; + COM_MAP_T *ComX; GPIO_MAP_T TxPort; - GPIOMode_TypeDef TxMode; GPIO_MAP_T RxPort; - GPIOMode_TypeDef RxMode; GPIOSpeed_TypeDef Speed; }COM_CONFIG; diff --git a/App/main.c b/App/main.c index e291d73..a36e99d 100644 --- a/App/main.c +++ b/App/main.c @@ -6,14 +6,12 @@ #include /* BSP文件 */ #include "main.h" -#include "Bsp.h" +#include "Voilet.h" int main(void) { VoiletBspInit(); - UartStdConfig((COM_MAP_T)COM1,9600); - while (1) { LedToggle(LED0); DelayMs(100); diff --git a/VoiletBspStm32F10x b/VoiletBspStm32F10x index 15fd21e..42ceefc 160000 --- a/VoiletBspStm32F10x +++ b/VoiletBspStm32F10x @@ -1 +1 @@ -Subproject commit 15fd21eba6b75157e4b6b29d34becb2a1fa8c565 +Subproject commit 42ceefc5ad05d9ffe933c7fac36a15507a6a5775