From 9687338dab37d059b9ae4bcde1a0670025448aa9 Mon Sep 17 00:00:00 2001 From: iorebuild Date: Sun, 5 Jul 2026 13:42:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=AF=91=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eide/eide.yml | 75 +++++++++++++++++++++++++++++++++++-- .vscode/settings.json | 9 +++++ App/{ => Inc}/LetterShell.h | 0 App/{ => Inc}/main.h | 0 App/{ => Src}/LetterShell.c | 28 +++++++------- App/{ => Src}/main.c | 10 +++-- 6 files changed, 101 insertions(+), 21 deletions(-) create mode 100644 .vscode/settings.json rename App/{ => Inc}/LetterShell.h (100%) rename App/{ => Inc}/main.h (100%) rename App/{ => Src}/LetterShell.c (76%) rename App/{ => Src}/main.c (86%) diff --git a/.eide/eide.yml b/.eide/eide.yml index 5fc2dd3..1a6f299 100644 --- a/.eide/eide.yml +++ b/.eide/eide.yml @@ -7,7 +7,65 @@ srcDirs: [] virtualFolder: name: files: [] - folders: [] + folders: + - name: System + files: + - path: VoiletBspStm32F10x/System/system_stm32f10x.c + - path: VoiletBspStm32F10x/System/LinkScripts/Gcc/stm32_flash_ze.ld + - path: VoiletBspStm32F10x/System/Cmsis/Src/core_cm3.c + folders: [] + - name: Startup + files: + - path: VoiletBspStm32F10x/System/Startup/Gcc/startup_stm32f10x_hd.s + folders: [] + - name: App + files: + - path: App/Src/LetterShell.c + - path: App/Src/main.c + folders: [] + - name: Shell + files: + - path: VoiletBspStm32F10x/ThirdParty/LetterShellV3/Src/shell.c + - path: VoiletBspStm32F10x/ThirdParty/LetterShellV3/Src/shell_cmd_list.c + - path: VoiletBspStm32F10x/ThirdParty/LetterShellV3/Src/shell_companion.c + - path: VoiletBspStm32F10x/ThirdParty/LetterShellV3/Src/shell_ext.c + folders: [] + - name: Bsp + files: + - path: VoiletBspStm32F10x/Bsp/Src/Bsp.c + - path: VoiletBspStm32F10x/Bsp/Src/Delay.c + - path: VoiletBspStm32F10x/Bsp/Src/Gpio.c + - path: VoiletBspStm32F10x/Bsp/Src/Interrupt.c + - path: VoiletBspStm32F10x/Bsp/Src/SeggerCall.c + - path: VoiletBspStm32F10x/Bsp/Src/SysCall.c + - path: VoiletBspStm32F10x/Bsp/Src/Uart.c + folders: [] + - name: StdLib + files: + - path: VoiletBspStm32F10x/StdLib/Src/misc.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_adc.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_bkp.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_can.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_cec.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_crc.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_dac.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_dbgmcu.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_dma.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_exti.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_flash.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_fsmc.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_gpio.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_i2c.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_iwdg.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_pwr.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_rcc.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_rtc.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_sdio.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_spi.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_tim.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_usart.c + - path: VoiletBspStm32F10x/StdLib/Src/stm32f10x_wwdg.c + folders: [] dependenceList: [] outDir: Output miscInfo: @@ -15,8 +73,17 @@ miscInfo: targets: Debug: cppPreprocessAttrs: - defineList: [] - incList: [] + defineList: + - USE_STDPERIPH_DRIVER + - STM32F10X_HD + incList: + - App/Inc + - Board + - VoiletBspStm32F10x/Bsp/Inc + - VoiletBspStm32F10x/StdLib/Inc + - VoiletBspStm32F10x/System/Cmsis/Inc + - VoiletBspStm32F10x/System + - VoiletBspStm32F10x/ThirdParty/LetterShellV3/Inc libList: [] excludeList: [] settings: @@ -55,7 +122,7 @@ targets: LIB_FLAGS: -lm output-format: elf remove-unused-input-sections: true - scatterFilePath: .lds + scatterFilePath: VoiletBspStm32F10x/System/LinkScripts/Gcc/stm32_flash_ze.ld storageLayout: RAM: [] ROM: [] diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..06fb314 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "editor.formatOnSave": true, + "[c]": { + "editor.defaultFormatter": "xaver.clang-format" + }, + "[cpp]": { + "editor.defaultFormatter": "xaver.clang-format" + } +} \ No newline at end of file diff --git a/App/LetterShell.h b/App/Inc/LetterShell.h similarity index 100% rename from App/LetterShell.h rename to App/Inc/LetterShell.h diff --git a/App/main.h b/App/Inc/main.h similarity index 100% rename from App/main.h rename to App/Inc/main.h diff --git a/App/LetterShell.c b/App/Src/LetterShell.c similarity index 76% rename from App/LetterShell.c rename to App/Src/LetterShell.c index 4065eb6..56bdf61 100755 --- a/App/LetterShell.c +++ b/App/Src/LetterShell.c @@ -3,11 +3,11 @@ /* 板级BSP头文件 */ #include "Bsp.h" -#define WR_BUFFER_SIZE 512 +#define WR_BUFFER_SIZE 512 /* 1. 创建shell对象,开辟shell缓冲区 */ -Shell Host; //Shell实例化 -char HostBuffer[WR_BUFFER_SIZE]; //读写缓冲区 +Shell Host; // Shell实例化 +char HostBuffer[WR_BUFFER_SIZE]; // 读写缓冲区 const COM_MAP_T *HostCom = TTY_COM; /** * @brief Shell写函数 @@ -16,8 +16,9 @@ const COM_MAP_T *HostCom = TTY_COM; * @note void * @example void */ -signed short ShellWrite(char *ch, unsigned short Len) { - ComSendStr(HostCom, (uint8_t *) ch, Len); +signed short ShellWrite(char *ch, unsigned short Len) +{ + ComSendStr(HostCom, (uint8_t *)ch, Len); return Len; } @@ -28,29 +29,30 @@ signed short ShellWrite(char *ch, unsigned short Len) { * @note void * @example void */ -void LetterShellIrqFunc(void *Param) { +void LetterShellIrqFunc(void *Param) +{ uint8_t ch = 0x00; ch = ComReceiveChar(Param); shellHandler(&Host, ch); } - /** * @brief 初始化Shell * @note void * @param ComX 串口号,baud 波特率 * @retval void */ -void LetterShellInit(const COM_MAP_T *ComX, uint32_t Baud) { - //初始化串口 +void LetterShellInit(const COM_MAP_T *ComX, uint32_t Baud) +{ + // 初始化串口 ComStdConfig(ComX, Baud); - //设置串口回调函数 + // 设置串口回调函数 IrqRegister(ComX->Periph.Irqn, LetterShellIrqFunc); - //设置中断等级 + // 设置中断等级 IrqEnable(ComX->Periph.Irqn, 1, 1); - //注册写函数 + // 注册写函数 Host.write = ShellWrite; - //初始化LetterShell + // 初始化LetterShell shellInit(&Host, HostBuffer, WR_BUFFER_SIZE); } diff --git a/App/main.c b/App/Src/main.c similarity index 86% rename from App/main.c rename to App/Src/main.c index 81491c2..0812bfc 100755 --- a/App/main.c +++ b/App/Src/main.c @@ -2,17 +2,19 @@ // Created by anonymous on 2026/5/24. // /* C标准库头文件 */ -#include #include +#include /* BSP文件 */ -#include "main.h" #include "Bsp.h" +#include "main.h" -int main(void) { +int main(void) +{ BspInit(); - while (1) { + while (1) + { LedToggle(LED0); DelayMs(100); }