This commit is contained in:
2026-02-25 15:12:13 +08:00
parent 9d69b29eed
commit 090eb335a8
25 changed files with 620 additions and 19973 deletions
+8 -33
View File
@@ -1,21 +1,7 @@
/**********************************************************************************
* 文件名 :W5500.c
* 描述 :W5500 驱动函数库
* 库版本 :ST_v3.5
* 作者 :泥人通信模块开发团队
* 博客 :http://nirenelec.blog.163.com
* 淘宝 :http://nirenelec.taobao.com
**********************************************************************************/
//#include "stm32f1xx.h"
//#include "stm32f1xx_hal_spi.h"
#include "main.h"
#include "bsp_W5500.h"
#include "usart.h"
#include "stdio.h"
#include "spi.h"
//#include "bsp_print.h"
#define BSP_W5500_SPI_CS_LOW
@@ -41,12 +27,10 @@ static void Write_SOCK_Data_Buffer(bsp_W5500_Class_t *pW5500_Class, u8 *dat_ptr,
bsp_W5500_t W5500 =
{
.Gateway_IP = {192,168,1,1},
.Sub_Mask = {255,255,255,0},/*子网掩码*/
.Phy_Addr = {0x0c,0x29,0xab,0x7c,0x00,0x01},
//.IP_Addr = {169,254,107,101},
.IP_Addr = {192,168,100,101},
.Gateway_IP = {192,168,100,1}, /*网关IP地址*/
.Sub_Mask = {255,255,255,0}, /*子网掩码*/
.Phy_Addr = {0x0c,0x29,0xab,0x7c,0x00,0x01}, /*物理地址(MAC)*/
.IP_Addr = {192,168,100,101}, /*本机IP地址*/
.Interrupt_Process = bsp_W5500_Interrupt_Process,
@@ -57,18 +41,8 @@ bsp_W5500_t W5500 =
.W5500_Class[0] =
{
.SocketPort = 0, /*使用端口0*/
.ConfigData.Gateway_IP = {192,168,1,1},
.ConfigData.Sub_Mask = {255,255,255,0},
.ConfigData.Phy_Addr = {0x0c,0x29,0xab,0x7c,0x00,0x01},
.ConfigData.IP_Addr = {192,168,100,101},
.ConfigData.Port = {0x13,0x88},
// .ConfigData.DIP = {192,168,1,32},
// .ConfigData.DPort = {0x03,0x09},
.ConfigData.Port = {0x01,0xF6},
.Run_Mode = BSP_W5500_PORT_RUN_MODE_TCP_SERVER,
// .Rx_DataAnalysis = proto_HSMS_Rx_DataAnalysis,
},
};
@@ -776,7 +750,7 @@ static void bsp_W5500_Init()
{
bsp_W5500_Socket_Init(&pW5500->W5500_Class[i]);
pW5500->W5500_Class[i].Run_State = 0; /*复位状态*/
// bsp_W5500_Socket_Set(&pW5500->W5500_Class[i]); /*W5500端口初始化配置*/
//bsp_W5500_Socket_Set(&pW5500->W5500_Class[i]); /*W5500端口初始化配置*/
}
}
@@ -798,9 +772,10 @@ static void bsp_W5500_Task(void)
// Write_SOCK_Data_Buffer(&pW5500->W5500_Class[i], pW5500->W5500_Class[i].Rx_Buffer, Len);
// printf("RX");
// Debug_UartSend(pW5500->W5500_Class[i].Rx_Buffer, Len);
if(pW5500->W5500_Class[i].Rx_DataAnalysis != NULL)
{
pW5500->W5500_Class[i].Rx_DataAnalysis(&pW5500->W5500_Class[i],pW5500->W5500_Class[i].Rx_Buffer,Len);/*数据解析*/
pW5500->W5500_Class[i].Rx_DataAnalysis(pW5500->W5500_Class[i].Rx_Buffer,Len,&pW5500->W5500_Class[i]);/*数据解析*/
}
}
}