diff --git a/.cproject b/.cproject
index c3cc3dd..c91f12d 100644
--- a/.cproject
+++ b/.cproject
@@ -169,4 +169,5 @@
+
\ No newline at end of file
diff --git a/.eide/eide.json b/.eide/eide.json
index ba9a2e7..db7618e 100644
--- a/.eide/eide.json
+++ b/.eide/eide.json
@@ -20,7 +20,15 @@
"targets": {
"Debug": {
"excludeList": [
- "Core/motor"
+ "Core/motor",
+ "Core/ioLibrary_Driver/Internet/DHCP",
+ "Core/ioLibrary_Driver/Internet/FTPClient",
+ "Core/ioLibrary_Driver/Internet/FTPServer",
+ "Core/ioLibrary_Driver/Internet/httpServer",
+ "Core/ioLibrary_Driver/Internet/MQTT",
+ "Core/ioLibrary_Driver/Internet/SNMP",
+ "Core/ioLibrary_Driver/Internet/SNTP",
+ "Core/ioLibrary_Driver/Internet/TFTP"
],
"toolchain": "GCC",
"compileConfig": {
@@ -61,7 +69,10 @@
"Drivers/STM32F1xx_HAL_Driver/Inc/Legacy",
"Drivers/STM32F1xx_HAL_Driver/Inc",
"Drivers/CMSIS/Device/ST/STM32F1xx/Include",
- "Drivers/CMSIS/Include"
+ "Drivers/CMSIS/Include",
+ "Core/ioLibrary_Driver/Ethernet/W5500",
+ "Core/ioLibrary_Driver/Ethernet",
+ "Core/ioLibrary_Driver/Internet/DNS"
],
"libList": [],
"defineList": [
diff --git a/.gitmodules b/.gitmodules
index 76e1739..1aa63b7 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,6 @@
[submodule "Core/motor"]
path = Core/motor
url = https://020824.xyz/gitea/murmur/injectorCTL
+[submodule "Core/ioLibrary_Driver"]
+ path = Core/ioLibrary_Driver
+ url = https://github.com/Wiznet/ioLibrary_Driver.git
diff --git a/.mxproject b/.mxproject
index 0123f26..a9b6d9f 100644
--- a/.mxproject
+++ b/.mxproject
@@ -1,30 +1,32 @@
[PreviousLibFiles]
-LibFiles=Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_uart.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_usart.h;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_def.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_bus.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_system.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_utils.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio_ex.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_exti.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_uart.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_usart.h;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_def.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_bus.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_system.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_utils.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio_ex.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_exti.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f103xe.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\system_stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\system_stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.h;Drivers\CMSIS\Include\cmsis_compiler.h;Drivers\CMSIS\Include\cmsis_gcc.h;Drivers\CMSIS\Include\cmsis_iccarm.h;Drivers\CMSIS\Include\cmsis_version.h;Drivers\CMSIS\Include\core_armv8mbl.h;Drivers\CMSIS\Include\core_armv8mml.h;Drivers\CMSIS\Include\core_cm0.h;Drivers\CMSIS\Include\core_cm0plus.h;Drivers\CMSIS\Include\core_cm1.h;Drivers\CMSIS\Include\core_cm23.h;Drivers\CMSIS\Include\core_cm3.h;Drivers\CMSIS\Include\core_cm33.h;Drivers\CMSIS\Include\core_cm4.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\tz_context.h;
+LibFiles=Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_spi.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_spi.h;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_def.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_bus.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_system.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_utils.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio_ex.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_uart.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_usart.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_spi.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_spi.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_spi.h;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_def.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_bus.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_system.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_utils.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio_ex.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_uart.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_usart.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f103xe.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\system_stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\system_stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.h;Drivers\CMSIS\Include\cmsis_compiler.h;Drivers\CMSIS\Include\cmsis_gcc.h;Drivers\CMSIS\Include\cmsis_iccarm.h;Drivers\CMSIS\Include\cmsis_version.h;Drivers\CMSIS\Include\core_armv8mbl.h;Drivers\CMSIS\Include\core_armv8mml.h;Drivers\CMSIS\Include\core_cm0.h;Drivers\CMSIS\Include\core_cm0plus.h;Drivers\CMSIS\Include\core_cm1.h;Drivers\CMSIS\Include\core_cm23.h;Drivers\CMSIS\Include\core_cm3.h;Drivers\CMSIS\Include\core_cm33.h;Drivers\CMSIS\Include\core_cm4.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\tz_context.h;
[PreviousUsedCubeIDEFiles]
-SourceFiles=Core\Src\main.c;Core\Src\gpio.c;Core\Src\dma.c;Core\Src\usart.c;Core\Src\stm32f1xx_it.c;Core\Src\stm32f1xx_hal_msp.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;Core\Src\system_stm32f1xx.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;Core\Src\system_stm32f1xx.c;;;
+SourceFiles=Core\Src\main.c;Core\Src\gpio.c;Core\Src\dma.c;Core\Src\spi.c;Core\Src\usart.c;Core\Src\stm32f1xx_it.c;Core\Src\stm32f1xx_hal_msp.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_spi.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;Core\Src\system_stm32f1xx.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_spi.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;Core\Src\system_stm32f1xx.c;;;
HeaderPath=Drivers\STM32F1xx_HAL_Driver\Inc;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;Drivers\CMSIS\Device\ST\STM32F1xx\Include;Drivers\CMSIS\Include;Core\Inc;
CDefines=USE_HAL_DRIVER;STM32F103xE;USE_HAL_DRIVER;USE_HAL_DRIVER;
[PreviousGenFiles]
AdvancedFolderStructure=true
-HeaderFileListSize=6
+HeaderFileListSize=7
HeaderFiles#0=..\Core\Inc\gpio.h
HeaderFiles#1=..\Core\Inc\dma.h
-HeaderFiles#2=..\Core\Inc\usart.h
-HeaderFiles#3=..\Core\Inc\stm32f1xx_it.h
-HeaderFiles#4=..\Core\Inc\stm32f1xx_hal_conf.h
-HeaderFiles#5=..\Core\Inc\main.h
+HeaderFiles#2=..\Core\Inc\spi.h
+HeaderFiles#3=..\Core\Inc\usart.h
+HeaderFiles#4=..\Core\Inc\stm32f1xx_it.h
+HeaderFiles#5=..\Core\Inc\stm32f1xx_hal_conf.h
+HeaderFiles#6=..\Core\Inc\main.h
HeaderFolderListSize=1
HeaderPath#0=..\Core\Inc
HeaderFiles=;
-SourceFileListSize=6
+SourceFileListSize=7
SourceFiles#0=..\Core\Src\gpio.c
SourceFiles#1=..\Core\Src\dma.c
-SourceFiles#2=..\Core\Src\usart.c
-SourceFiles#3=..\Core\Src\stm32f1xx_it.c
-SourceFiles#4=..\Core\Src\stm32f1xx_hal_msp.c
-SourceFiles#5=..\Core\Src\main.c
+SourceFiles#2=..\Core\Src\spi.c
+SourceFiles#3=..\Core\Src\usart.c
+SourceFiles#4=..\Core\Src\stm32f1xx_it.c
+SourceFiles#5=..\Core\Src\stm32f1xx_hal_msp.c
+SourceFiles#6=..\Core\Src\main.c
SourceFolderListSize=1
SourcePath#0=..\Core\Src
SourceFiles=;
diff --git a/Core/Inc/http_client.h b/Core/Inc/http_client.h
new file mode 100644
index 0000000..f3693f5
--- /dev/null
+++ b/Core/Inc/http_client.h
@@ -0,0 +1,39 @@
+#ifndef __HTTP_CLIENT_H
+#define __HTTP_CLIENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "socket.h"
+#include
+
+// HTTP响应缓冲区大小
+#define HTTP_BUFFER_SIZE 2048
+
+// HTTP请求结果
+typedef enum {
+ HTTP_OK = 0,
+ HTTP_ERROR_SOCKET = -1,
+ HTTP_ERROR_CONNECTION = -2,
+ HTTP_ERROR_SEND = -3,
+ HTTP_ERROR_RECEIVE = -4
+} http_result;
+
+// HTTP响应结构体
+typedef struct {
+ uint8_t buffer[HTTP_BUFFER_SIZE]; // 响应数据缓冲区
+ uint16_t length; // 响应数据长度
+} http_response;
+
+// 解析URL
+void parse_url(const char* url, char* host, char* path, uint16_t* port);
+
+// 使用IP地址的HTTP GET请求
+http_result http_get_ip(const uint8_t* ip, uint16_t port, const char* path, http_response* response);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HTTP_CLIENT_H */
\ No newline at end of file
diff --git a/Core/Inc/http_test.h b/Core/Inc/http_test.h
new file mode 100644
index 0000000..74c6daa
--- /dev/null
+++ b/Core/Inc/http_test.h
@@ -0,0 +1,18 @@
+#ifndef __HTTP_TEST_H
+#define __HTTP_TEST_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "http_client.h"
+#include
+
+// HTTP GET测试函数
+void http_test_request(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HTTP_TEST_H */
\ No newline at end of file
diff --git a/Core/Inc/main.h b/Core/Inc/main.h
index 9bc5a68..1d5ac61 100644
--- a/Core/Inc/main.h
+++ b/Core/Inc/main.h
@@ -61,6 +61,12 @@ void Error_Handler(void);
#define DIR2_GPIO_Port GPIOA
#define LED_Pin GPIO_PIN_15
#define LED_GPIO_Port GPIOE
+#define NET_INT_Pin GPIO_PIN_8
+#define NET_INT_GPIO_Port GPIOD
+#define NET_RST_Pin GPIO_PIN_9
+#define NET_RST_GPIO_Port GPIOD
+#define NET_CS_Pin GPIO_PIN_10
+#define NET_CS_GPIO_Port GPIOD
/* USER CODE BEGIN Private defines */
diff --git a/Core/Inc/spi.h b/Core/Inc/spi.h
new file mode 100644
index 0000000..5d4e747
--- /dev/null
+++ b/Core/Inc/spi.h
@@ -0,0 +1,52 @@
+/* USER CODE BEGIN Header */
+/**
+ ******************************************************************************
+ * @file spi.h
+ * @brief This file contains all the function prototypes for
+ * the spi.c file
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2024 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ ******************************************************************************
+ */
+/* USER CODE END Header */
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __SPI_H__
+#define __SPI_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "main.h"
+
+/* USER CODE BEGIN Includes */
+
+/* USER CODE END Includes */
+
+extern SPI_HandleTypeDef hspi2;
+
+/* USER CODE BEGIN Private defines */
+
+/* USER CODE END Private defines */
+
+void MX_SPI2_Init(void);
+
+/* USER CODE BEGIN Prototypes */
+
+/* USER CODE END Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SPI_H__ */
+
diff --git a/Core/Inc/stm32f1xx_hal_conf.h b/Core/Inc/stm32f1xx_hal_conf.h
index 951881c..6dab2e3 100644
--- a/Core/Inc/stm32f1xx_hal_conf.h
+++ b/Core/Inc/stm32f1xx_hal_conf.h
@@ -62,7 +62,7 @@
/*#define HAL_MMC_MODULE_ENABLED */
/*#define HAL_SDRAM_MODULE_ENABLED */
/*#define HAL_SMARTCARD_MODULE_ENABLED */
-/*#define HAL_SPI_MODULE_ENABLED */
+#define HAL_SPI_MODULE_ENABLED
/*#define HAL_SRAM_MODULE_ENABLED */
/*#define HAL_TIM_MODULE_ENABLED */
#define HAL_UART_MODULE_ENABLED
diff --git a/Core/Inc/w5500_init.h b/Core/Inc/w5500_init.h
new file mode 100644
index 0000000..6b2ec5b
--- /dev/null
+++ b/Core/Inc/w5500_init.h
@@ -0,0 +1,25 @@
+#ifndef __W5500_INIT_H
+#define __W5500_INIT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "main.h"
+#include "spi.h"
+#include "gpio.h"
+#include "wizchip_conf.h"
+#include "socket.h"
+#include "w5500.h"
+
+// W5500 初始化函数
+int8_t W5500_Init(void);
+
+// 网络配置结构体
+extern wiz_NetInfo gWIZNETINFO;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __W5500_INIT_H */
\ No newline at end of file
diff --git a/Core/Src/gpio.c b/Core/Src/gpio.c
index 683b738..aff7e62 100644
--- a/Core/Src/gpio.c
+++ b/Core/Src/gpio.c
@@ -59,6 +59,9 @@ void MX_GPIO_Init(void)
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_RESET);
+ /*Configure GPIO pin Output Level */
+ HAL_GPIO_WritePin(GPIOD, NET_RST_Pin|NET_CS_Pin, GPIO_PIN_RESET);
+
/*Configure GPIO pins : PE2 PE3 PE4 PE5
PE6 PE7 PE8 PE9
PE10 PE11 PE12 PE13
@@ -98,13 +101,13 @@ void MX_GPIO_Init(void)
HAL_GPIO_Init(DIR2_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : PB0 PB1 PB2 PB10
- PB11 PB12 PB13 PB14
- PB15 PB3 PB4 PB5
- PB6 PB7 PB8 PB9 */
+ PB11 PB12 PB3 PB4
+ PB5 PB6 PB7 PB8
+ PB9 */
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_10
- |GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14
- |GPIO_PIN_15|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
- |GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9;
+ |GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_3|GPIO_PIN_4
+ |GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8
+ |GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
@@ -115,14 +118,27 @@ void MX_GPIO_Init(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(LED_GPIO_Port, &GPIO_InitStruct);
- /*Configure GPIO pins : PD8 PD9 PD10 PD11
- PD12 PD13 PD14 PD15
- PD0 PD1 PD2 PD3
- PD4 PD5 PD6 PD7 */
- GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
- |GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15
- |GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
- |GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7;
+ /*Configure GPIO pin : NET_INT_Pin */
+ GPIO_InitStruct.Pin = NET_INT_Pin;
+ GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ HAL_GPIO_Init(NET_INT_GPIO_Port, &GPIO_InitStruct);
+
+ /*Configure GPIO pins : NET_RST_Pin NET_CS_Pin */
+ GPIO_InitStruct.Pin = NET_RST_Pin|NET_CS_Pin;
+ GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
+ HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
+
+ /*Configure GPIO pins : PD11 PD12 PD13 PD14
+ PD15 PD0 PD1 PD2
+ PD3 PD4 PD5 PD6
+ PD7 */
+ GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14
+ |GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2
+ |GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6
+ |GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
diff --git a/Core/Src/http_client.c b/Core/Src/http_client.c
new file mode 100644
index 0000000..c921aa4
--- /dev/null
+++ b/Core/Src/http_client.c
@@ -0,0 +1,100 @@
+#include "http_client.h"
+#include "stdio.h"
+
+#define HTTP_SOCKET 0 // 使用Socket 0
+
+// 直接使用IP地址的HTTP GET请求
+http_result http_get_ip(const uint8_t* ip, uint16_t port, const char* path, http_response* response)
+{
+ int32_t ret;
+ char request[512];
+
+ // 1. 创建socket
+ if((ret = socket(HTTP_SOCKET, Sn_MR_TCP, 0, 0)) != HTTP_SOCKET)
+ {
+ return HTTP_ERROR_SOCKET;
+ }
+
+ // 2. 连接服务器
+ if((ret = connect(HTTP_SOCKET, (uint8_t*)ip, port)) != SOCK_OK)
+ {
+ close(HTTP_SOCKET);
+ return HTTP_ERROR_CONNECTION;
+ }
+
+ // 3. 构建并发送HTTP请求
+ sprintf(request,
+ "GET %s HTTP/1.1\r\n"
+ "Host: %d.%d.%d.%d\r\n"
+ "Connection: close\r\n"
+ "\r\n",
+ path, ip[0], ip[1], ip[2], ip[3]);
+
+ if(send(HTTP_SOCKET, (uint8_t*)request, strlen(request)) <= 0)
+ {
+ close(HTTP_SOCKET);
+ return HTTP_ERROR_SEND;
+ }
+
+ // 4. 接收响应数据
+ response->length = 0;
+ while(1)
+ {
+ if(getSn_SR(HTTP_SOCKET) == SOCK_CLOSED) break;
+
+ ret = recv(HTTP_SOCKET,
+ &response->buffer[response->length],
+ HTTP_BUFFER_SIZE - response->length);
+
+ if(ret <= 0) break;
+ response->length += ret;
+
+ if(response->length >= HTTP_BUFFER_SIZE) break;
+ }
+
+ // 5. 关闭socket
+ close(HTTP_SOCKET);
+
+ if(response->length == 0)
+ {
+ return HTTP_ERROR_RECEIVE;
+ }
+
+ return HTTP_OK;
+}
+
+// URL解析函数
+void parse_url(const char* url, char* host, char* path, uint16_t* port)
+{
+ char* p;
+
+ // 跳过 "http://"
+ if(strncmp(url, "http://", 7) == 0)
+ url += 7;
+
+ // 复制主机名
+ p = strchr(url, '/');
+ if(p == NULL)
+ {
+ strcpy(host, url);
+ strcpy(path, "/");
+ }
+ else
+ {
+ strncpy(host, url, p - url);
+ host[p - url] = '\0';
+ strcpy(path, p);
+ }
+
+ // 检查端口号
+ p = strchr(host, ':');
+ if(p != NULL)
+ {
+ *p = '\0';
+ *port = atoi(p + 1);
+ }
+ else
+ {
+ *port = 80;
+ }
+}
\ No newline at end of file
diff --git a/Core/Src/http_test.c b/Core/Src/http_test.c
new file mode 100644
index 0000000..675059a
--- /dev/null
+++ b/Core/Src/http_test.c
@@ -0,0 +1,21 @@
+#include "http_test.h"
+
+void http_test_request(void)
+{
+ http_response response;
+ // 目标IP地址:169.254.1.1
+ uint8_t server_ip[4] = {169, 254, 1, 1};
+ const char* path = "/status.xml";
+
+ // 发送GET请求
+ if(http_get_ip(server_ip, 80, path, &response) == HTTP_OK)
+ {
+ // 处理响应数据
+ response.buffer[response.length] = '\0'; // 确保字符串结束
+ printf("Response: %s\n", response.buffer);
+ }
+ else
+ {
+ printf("HTTP request failed\n");
+ }
+}
\ No newline at end of file
diff --git a/Core/Src/main.c b/Core/Src/main.c
index 6817d14..a5ced0f 100644
--- a/Core/Src/main.c
+++ b/Core/Src/main.c
@@ -19,12 +19,14 @@
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "dma.h"
+#include "spi.h"
#include "usart.h"
#include "gpio.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
-
+#include "w5500_init.h"
+#include "http_test.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@@ -91,8 +93,14 @@ int main(void)
MX_DMA_Init();
MX_USART1_UART_Init();
MX_USART2_UART_Init();
+ MX_SPI2_Init();
/* USER CODE BEGIN 2 */
+ if(W5500_Init() != 0) {
+ Error_Handler();
+ }
+ // 执行HTTP测试
+ http_test_request();
/* USER CODE END 2 */
/* Infinite loop */
@@ -101,7 +109,6 @@ int main(void)
{
/* USER CODE END WHILE */
-
/* USER CODE BEGIN 3 */
HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
HAL_Delay(500);
diff --git a/Core/Src/spi.c b/Core/Src/spi.c
new file mode 100644
index 0000000..078683a
--- /dev/null
+++ b/Core/Src/spi.c
@@ -0,0 +1,122 @@
+/* USER CODE BEGIN Header */
+/**
+ ******************************************************************************
+ * @file spi.c
+ * @brief This file provides code for the configuration
+ * of the SPI instances.
+ ******************************************************************************
+ * @attention
+ *
+ * Copyright (c) 2024 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
+ *
+ ******************************************************************************
+ */
+/* USER CODE END Header */
+/* Includes ------------------------------------------------------------------*/
+#include "spi.h"
+
+/* USER CODE BEGIN 0 */
+
+/* USER CODE END 0 */
+
+SPI_HandleTypeDef hspi2;
+
+/* SPI2 init function */
+void MX_SPI2_Init(void)
+{
+
+ /* USER CODE BEGIN SPI2_Init 0 */
+
+ /* USER CODE END SPI2_Init 0 */
+
+ /* USER CODE BEGIN SPI2_Init 1 */
+
+ /* USER CODE END SPI2_Init 1 */
+ hspi2.Instance = SPI2;
+ hspi2.Init.Mode = SPI_MODE_MASTER;
+ hspi2.Init.Direction = SPI_DIRECTION_2LINES;
+ hspi2.Init.DataSize = SPI_DATASIZE_8BIT;
+ hspi2.Init.CLKPolarity = SPI_POLARITY_LOW;
+ hspi2.Init.CLKPhase = SPI_PHASE_1EDGE;
+ hspi2.Init.NSS = SPI_NSS_SOFT;
+ hspi2.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2;
+ hspi2.Init.FirstBit = SPI_FIRSTBIT_MSB;
+ hspi2.Init.TIMode = SPI_TIMODE_DISABLE;
+ hspi2.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
+ hspi2.Init.CRCPolynomial = 10;
+ if (HAL_SPI_Init(&hspi2) != HAL_OK)
+ {
+ Error_Handler();
+ }
+ /* USER CODE BEGIN SPI2_Init 2 */
+
+ /* USER CODE END SPI2_Init 2 */
+
+}
+
+void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle)
+{
+
+ GPIO_InitTypeDef GPIO_InitStruct = {0};
+ if(spiHandle->Instance==SPI2)
+ {
+ /* USER CODE BEGIN SPI2_MspInit 0 */
+
+ /* USER CODE END SPI2_MspInit 0 */
+ /* SPI2 clock enable */
+ __HAL_RCC_SPI2_CLK_ENABLE();
+
+ __HAL_RCC_GPIOB_CLK_ENABLE();
+ /**SPI2 GPIO Configuration
+ PB13 ------> SPI2_SCK
+ PB14 ------> SPI2_MISO
+ PB15 ------> SPI2_MOSI
+ */
+ GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_15;
+ GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
+ HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+
+ GPIO_InitStruct.Pin = GPIO_PIN_14;
+ GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+
+ /* USER CODE BEGIN SPI2_MspInit 1 */
+
+ /* USER CODE END SPI2_MspInit 1 */
+ }
+}
+
+void HAL_SPI_MspDeInit(SPI_HandleTypeDef* spiHandle)
+{
+
+ if(spiHandle->Instance==SPI2)
+ {
+ /* USER CODE BEGIN SPI2_MspDeInit 0 */
+
+ /* USER CODE END SPI2_MspDeInit 0 */
+ /* Peripheral clock disable */
+ __HAL_RCC_SPI2_CLK_DISABLE();
+
+ /**SPI2 GPIO Configuration
+ PB13 ------> SPI2_SCK
+ PB14 ------> SPI2_MISO
+ PB15 ------> SPI2_MOSI
+ */
+ HAL_GPIO_DeInit(GPIOB, GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15);
+
+ /* USER CODE BEGIN SPI2_MspDeInit 1 */
+
+ /* USER CODE END SPI2_MspDeInit 1 */
+ }
+}
+
+/* USER CODE BEGIN 1 */
+
+/* USER CODE END 1 */
diff --git a/Core/Src/w5500_init.c b/Core/Src/w5500_init.c
new file mode 100644
index 0000000..36810d7
--- /dev/null
+++ b/Core/Src/w5500_init.c
@@ -0,0 +1,74 @@
+#include "w5500_init.h"
+
+// W5500 Network Configuration
+wiz_NetInfo gWIZNETINFO = {
+ .mac = {0x00, 0x08, 0xDC, 0x12, 0x34, 0x56}, // MAC 地址
+ .ip = {169, 254, 1, 11}, // IP 地址
+ .sn = {255, 255, 255, 0}, // 子网掩码
+ .gw = {192, 168, 1, 1}, // 网关地址
+ .dns = {8, 8, 8, 8}, // DNS 服务器
+ .dhcp = NETINFO_STATIC // 静态IP模式
+};
+
+// W5500 SPI 读写函数
+static void W5500_Select(void) {
+ HAL_GPIO_WritePin(NET_CS_GPIO_Port, NET_CS_Pin, GPIO_PIN_RESET);
+}
+
+static void W5500_Deselect(void) {
+ HAL_GPIO_WritePin(NET_CS_GPIO_Port, NET_CS_Pin, GPIO_PIN_SET);
+}
+
+static void W5500_ReadBuff(uint8_t* buff, uint16_t len) {
+ HAL_SPI_Receive(&hspi2, buff, len, HAL_MAX_DELAY);
+}
+
+static void W5500_WriteBuff(uint8_t* buff, uint16_t len) {
+ HAL_SPI_Transmit(&hspi2, buff, len, HAL_MAX_DELAY);
+}
+
+static uint8_t W5500_ReadByte(void) {
+ uint8_t byte;
+ W5500_ReadBuff(&byte, 1);
+ return byte;
+}
+
+static void W5500_WriteByte(uint8_t byte) {
+ W5500_WriteBuff(&byte, 1);
+}
+
+int8_t W5500_Init(void)
+{
+ // 1. 注册通信函数
+ reg_wizchip_cs_cbfunc(W5500_Select, W5500_Deselect);
+ reg_wizchip_spi_cbfunc(W5500_ReadByte, W5500_WriteByte);
+ reg_wizchip_spiburst_cbfunc(W5500_ReadBuff, W5500_WriteBuff);
+
+ // 2. 初始化缓冲区大小
+ uint8_t rx_tx_buff_sizes[] = {2, 2, 2, 2, 2, 2, 2, 2}; // 每个Socket分配2K缓存
+ if(wizchip_init(rx_tx_buff_sizes, rx_tx_buff_sizes) < 0) {
+ return -1;
+ }
+
+ // 3. 配置网络参数
+ wizchip_setnetinfo(&gWIZNETINFO);
+
+ // 4. PHY 配置
+ wiz_PhyConf phyconf;
+ phyconf.by = PHY_CONFBY_SW;
+ phyconf.mode = PHY_MODE_AUTONEGO;
+ phyconf.speed = PHY_SPEED_100;
+ phyconf.duplex = PHY_DUPLEX_FULL;
+ wizphy_setphyconf(&phyconf);
+
+ // 5. 等待PHY就绪
+ uint32_t tick = HAL_GetTick();
+ while(1) {
+ if(wizphy_getphylink() == PHY_LINK_ON) break;
+ if(HAL_GetTick() - tick > 5000) { // 5秒超时
+ return -1;
+ }
+ }
+
+ return 0;
+}
\ No newline at end of file
diff --git a/Core/ioLibrary_Driver b/Core/ioLibrary_Driver
new file mode 160000
index 0000000..b981401
--- /dev/null
+++ b/Core/ioLibrary_Driver
@@ -0,0 +1 @@
+Subproject commit b981401e7f3d07015619adf44c13998e13e777f9
diff --git a/f1CTL.ioc b/f1CTL.ioc
index 5eb01b9..7120039 100644
--- a/f1CTL.ioc
+++ b/f1CTL.ioc
@@ -31,24 +31,31 @@ Mcu.Family=STM32F1
Mcu.IP0=DMA
Mcu.IP1=NVIC
Mcu.IP2=RCC
-Mcu.IP3=SYS
-Mcu.IP4=USART1
-Mcu.IP5=USART2
-Mcu.IPNb=6
+Mcu.IP3=SPI2
+Mcu.IP4=SYS
+Mcu.IP5=USART1
+Mcu.IP6=USART2
+Mcu.IPNb=7
Mcu.Name=STM32F103V(C-D-E)Tx
Mcu.Package=LQFP100
Mcu.Pin0=OSC_IN
Mcu.Pin1=OSC_OUT
-Mcu.Pin10=VP_SYS_VS_Systick
+Mcu.Pin10=PD9
+Mcu.Pin11=PD10
+Mcu.Pin12=PA9
+Mcu.Pin13=PA10
+Mcu.Pin14=PA13
+Mcu.Pin15=PA14
+Mcu.Pin16=VP_SYS_VS_Systick
Mcu.Pin2=PA1
Mcu.Pin3=PA2
Mcu.Pin4=PA3
Mcu.Pin5=PE15
-Mcu.Pin6=PA9
-Mcu.Pin7=PA10
-Mcu.Pin8=PA13
-Mcu.Pin9=PA14
-Mcu.PinsNb=11
+Mcu.Pin6=PB13
+Mcu.Pin7=PB14
+Mcu.Pin8=PB15
+Mcu.Pin9=PD8
+Mcu.PinsNb=17
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32F103VCTx
@@ -89,6 +96,24 @@ PA3.Mode=Asynchronous
PA3.Signal=USART2_RX
PA9.Mode=Asynchronous
PA9.Signal=USART1_TX
+PB13.Mode=Full_Duplex_Master
+PB13.Signal=SPI2_SCK
+PB14.Mode=Full_Duplex_Master
+PB14.Signal=SPI2_MISO
+PB15.Mode=Full_Duplex_Master
+PB15.Signal=SPI2_MOSI
+PD10.GPIOParameters=GPIO_Label
+PD10.GPIO_Label=NET_CS
+PD10.Locked=true
+PD10.Signal=GPIO_Output
+PD8.GPIOParameters=GPIO_Label
+PD8.GPIO_Label=NET_INT
+PD8.Locked=true
+PD8.Signal=GPIO_Input
+PD9.GPIOParameters=GPIO_Label
+PD9.GPIO_Label=NET_RST
+PD9.Locked=true
+PD9.Signal=GPIO_Output
PE15.GPIOParameters=GPIO_Label
PE15.GPIO_Label=LED
PE15.Locked=true
@@ -151,6 +176,11 @@ RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
RCC.TimSysFreq_Value=72000000
RCC.USBFreq_Value=72000000
RCC.VCOOutput2Freq_Value=8000000
+SPI2.CalculateBaudRate=18.0 MBits/s
+SPI2.Direction=SPI_DIRECTION_2LINES
+SPI2.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate
+SPI2.Mode=SPI_MODE_MASTER
+SPI2.VirtualType=VM_MASTER
USART1.IPParameters=VirtualMode
USART1.VirtualMode=VM_ASYNC
USART2.IPParameters=VirtualMode