This commit is contained in:
parent
4c3843e20e
commit
d1de706ea5
|
@ -165,12 +165,13 @@ void start_tcp_task(void const *argument)
|
||||||
MX_LWIP_Init();
|
MX_LWIP_Init();
|
||||||
/* USER CODE BEGIN start_tcp_task */
|
/* USER CODE BEGIN start_tcp_task */
|
||||||
tcp_echo_init();
|
tcp_echo_init();
|
||||||
|
uart_lcd_draw_ipaddr(); // 初始化显示IP地址信息
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
uart_lcd_draw_ipaddr(); // 初始化显示IP地址信息
|
|
||||||
|
|
||||||
osThreadTerminate(NULL);
|
vTaskDelay(1000);
|
||||||
|
// osThreadTerminate(NULL);
|
||||||
}
|
}
|
||||||
/* USER CODE END start_tcp_task */
|
/* USER CODE END start_tcp_task */
|
||||||
}
|
}
|
||||||
|
@ -192,7 +193,7 @@ void start_led_toggle_task(void const *argument)
|
||||||
|
|
||||||
uart_lcd_ecll_control_current_out();
|
uart_lcd_ecll_control_current_out();
|
||||||
vTaskDelay(500);
|
vTaskDelay(500);
|
||||||
}
|
}
|
||||||
/* USER CODE END start_led_toggle_task */
|
/* USER CODE END start_led_toggle_task */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "lwip.h"
|
#include "lwip.h"
|
||||||
#include "lwip/init.h"
|
#include "lwip/init.h"
|
||||||
#include "lwip/netif.h"
|
#include "lwip/netif.h"
|
||||||
#if defined ( __CC_ARM ) /* MDK ARM Compiler */
|
#if defined(__CC_ARM) /* MDK ARM Compiler */
|
||||||
#include "lwip/sio.h"
|
#include "lwip/sio.h"
|
||||||
#endif /* MDK ARM Compiler */
|
#endif /* MDK ARM Compiler */
|
||||||
#include "ethernetif.h"
|
#include "ethernetif.h"
|
||||||
|
@ -53,8 +53,8 @@ uint8_t GATEWAY_ADDRESS[4];
|
||||||
/* USER CODE END 2 */
|
/* USER CODE END 2 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LwIP initialization function
|
* LwIP initialization function
|
||||||
*/
|
*/
|
||||||
void MX_LWIP_Init(void)
|
void MX_LWIP_Init(void)
|
||||||
{
|
{
|
||||||
/* IP addresses initialization */
|
/* IP addresses initialization */
|
||||||
|
@ -71,15 +71,15 @@ void MX_LWIP_Init(void)
|
||||||
GATEWAY_ADDRESS[2] = 1;
|
GATEWAY_ADDRESS[2] = 1;
|
||||||
GATEWAY_ADDRESS[3] = 29;
|
GATEWAY_ADDRESS[3] = 29;
|
||||||
|
|
||||||
/* USER CODE BEGIN IP_ADDRESSES */
|
/* USER CODE BEGIN IP_ADDRESSES */
|
||||||
/* USER CODE END IP_ADDRESSES */
|
/* USER CODE END IP_ADDRESSES */
|
||||||
|
|
||||||
/* Initilialize the LwIP stack with RTOS */
|
/* Initilialize the LwIP stack with RTOS */
|
||||||
tcpip_init( NULL, NULL );
|
tcpip_init(NULL, NULL);
|
||||||
|
|
||||||
/* IP addresses initialization without DHCP (IPv4) */
|
/* IP addresses initialization without DHCP (IPv4) */
|
||||||
IP4_ADDR(&ipaddr, IP_ADDRESS[0], IP_ADDRESS[1], IP_ADDRESS[2], IP_ADDRESS[3]);
|
IP4_ADDR(&ipaddr, IP_ADDRESS[0], IP_ADDRESS[1], IP_ADDRESS[2], IP_ADDRESS[3]);
|
||||||
IP4_ADDR(&netmask, NETMASK_ADDRESS[0], NETMASK_ADDRESS[1] , NETMASK_ADDRESS[2], NETMASK_ADDRESS[3]);
|
IP4_ADDR(&netmask, NETMASK_ADDRESS[0], NETMASK_ADDRESS[1], NETMASK_ADDRESS[2], NETMASK_ADDRESS[3]);
|
||||||
IP4_ADDR(&gw, GATEWAY_ADDRESS[0], GATEWAY_ADDRESS[1], GATEWAY_ADDRESS[2], GATEWAY_ADDRESS[3]);
|
IP4_ADDR(&gw, GATEWAY_ADDRESS[0], GATEWAY_ADDRESS[1], GATEWAY_ADDRESS[2], GATEWAY_ADDRESS[3]);
|
||||||
|
|
||||||
/* add the network interface (IPv4/IPv6) with RTOS */
|
/* add the network interface (IPv4/IPv6) with RTOS */
|
||||||
|
@ -103,19 +103,19 @@ void MX_LWIP_Init(void)
|
||||||
netif_set_link_callback(&gnetif, ethernet_link_status_updated);
|
netif_set_link_callback(&gnetif, ethernet_link_status_updated);
|
||||||
|
|
||||||
/* Create the Ethernet link handler thread */
|
/* Create the Ethernet link handler thread */
|
||||||
/* USER CODE BEGIN H7_OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
|
/* USER CODE BEGIN H7_OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
|
||||||
osThreadDef(EthLink, ethernet_link_thread, osPriorityBelowNormal, 0, configMINIMAL_STACK_SIZE * 2);
|
osThreadDef(EthLink, ethernet_link_thread, osPriorityBelowNormal, 0, configMINIMAL_STACK_SIZE * 2);
|
||||||
osThreadCreate(osThread(EthLink), &gnetif);
|
osThreadCreate(osThread(EthLink), &gnetif);
|
||||||
/* USER CODE END H7_OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
|
/* USER CODE END H7_OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
|
||||||
|
|
||||||
/* USER CODE BEGIN 3 */
|
/* USER CODE BEGIN 3 */
|
||||||
flash_read_data(FLASH_USER_START_ADDR, IP_ADDRESS, 4);
|
flash_read_data(FLASH_USER_START_ADDR, IP_ADDRESS, 4);
|
||||||
if (IP_ADDRESS[0] == 192)
|
if (IP_ADDRESS[0] == 192)
|
||||||
{
|
{
|
||||||
IP4_ADDR(&ipaddr, IP_ADDRESS[0], IP_ADDRESS[1], IP_ADDRESS[2], IP_ADDRESS[3]);
|
IP4_ADDR(&ipaddr, IP_ADDRESS[0], IP_ADDRESS[1], IP_ADDRESS[2], IP_ADDRESS[3]);
|
||||||
gnetif.ip_addr = ipaddr;
|
gnetif.ip_addr = ipaddr;
|
||||||
}
|
}
|
||||||
/* USER CODE END 3 */
|
/* USER CODE END 3 */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_OBSOLETE_USER_CODE_SECTION_4
|
#ifdef USE_OBSOLETE_USER_CODE_SECTION_4
|
||||||
|
@ -126,25 +126,25 @@ void MX_LWIP_Init(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Notify the User about the network interface config status
|
* @brief Notify the User about the network interface config status
|
||||||
* @param netif: the network interface
|
* @param netif: the network interface
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
static void ethernet_link_status_updated(struct netif *netif)
|
static void ethernet_link_status_updated(struct netif *netif)
|
||||||
{
|
{
|
||||||
if (netif_is_up(netif))
|
if (netif_is_up(netif))
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN 5 */
|
/* USER CODE BEGIN 5 */
|
||||||
/* USER CODE END 5 */
|
/* USER CODE END 5 */
|
||||||
}
|
}
|
||||||
else /* netif is down */
|
else /* netif is down */
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN 6 */
|
/* USER CODE BEGIN 6 */
|
||||||
/* USER CODE END 6 */
|
/* USER CODE END 6 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined ( __CC_ARM ) /* MDK ARM Compiler */
|
#if defined(__CC_ARM) /* MDK ARM Compiler */
|
||||||
/**
|
/**
|
||||||
* Opens a serial device for communication.
|
* Opens a serial device for communication.
|
||||||
*
|
*
|
||||||
|
@ -155,9 +155,9 @@ sio_fd_t sio_open(u8_t devnum)
|
||||||
{
|
{
|
||||||
sio_fd_t sd;
|
sio_fd_t sd;
|
||||||
|
|
||||||
/* USER CODE BEGIN 7 */
|
/* USER CODE BEGIN 7 */
|
||||||
sd = 0; // dummy code
|
sd = 0; // dummy code
|
||||||
/* USER CODE END 7 */
|
/* USER CODE END 7 */
|
||||||
|
|
||||||
return sd;
|
return sd;
|
||||||
}
|
}
|
||||||
|
@ -172,8 +172,8 @@ sio_fd_t sio_open(u8_t devnum)
|
||||||
*/
|
*/
|
||||||
void sio_send(u8_t c, sio_fd_t fd)
|
void sio_send(u8_t c, sio_fd_t fd)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN 8 */
|
/* USER CODE BEGIN 8 */
|
||||||
/* USER CODE END 8 */
|
/* USER CODE END 8 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -191,9 +191,9 @@ u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len)
|
||||||
{
|
{
|
||||||
u32_t recved_bytes;
|
u32_t recved_bytes;
|
||||||
|
|
||||||
/* USER CODE BEGIN 9 */
|
/* USER CODE BEGIN 9 */
|
||||||
recved_bytes = 0; // dummy code
|
recved_bytes = 0; // dummy code
|
||||||
/* USER CODE END 9 */
|
/* USER CODE END 9 */
|
||||||
return recved_bytes;
|
return recved_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,10 +210,9 @@ u32_t sio_tryread(sio_fd_t fd, u8_t *data, u32_t len)
|
||||||
{
|
{
|
||||||
u32_t recved_bytes;
|
u32_t recved_bytes;
|
||||||
|
|
||||||
/* USER CODE BEGIN 10 */
|
/* USER CODE BEGIN 10 */
|
||||||
recved_bytes = 0; // dummy code
|
recved_bytes = 0; // dummy code
|
||||||
/* USER CODE END 10 */
|
/* USER CODE END 10 */
|
||||||
return recved_bytes;
|
return recved_bytes;
|
||||||
}
|
}
|
||||||
#endif /* MDK ARM Compiler */
|
#endif /* MDK ARM Compiler */
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,24 @@
|
||||||
<Name>-U090F00028316303030303032 -O2254 -SF1000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32F4xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F407VGTx$CMSIS\Flash\STM32F4xx_1024.FLM)</Name>
|
<Name>-U090F00028316303030303032 -O2254 -SF1000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32F4xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F407VGTx$CMSIS\Flash\STM32F4xx_1024.FLM)</Name>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
</TargetDriverDllRegistry>
|
</TargetDriverDllRegistry>
|
||||||
<Breakpoint/>
|
<Breakpoint>
|
||||||
|
<Bp>
|
||||||
|
<Number>0</Number>
|
||||||
|
<Type>0</Type>
|
||||||
|
<LineNumber>52</LineNumber>
|
||||||
|
<EnabledFlag>1</EnabledFlag>
|
||||||
|
<Address>134250286</Address>
|
||||||
|
<ByteObject>0</ByteObject>
|
||||||
|
<HtxType>0</HtxType>
|
||||||
|
<ManyObjects>0</ManyObjects>
|
||||||
|
<SizeOfObject>0</SizeOfObject>
|
||||||
|
<BreakByAccess>0</BreakByAccess>
|
||||||
|
<BreakIfRCount>1</BreakIfRCount>
|
||||||
|
<Filename>..\User\application\src\tcpserverc.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression>\\semi_finished_product_testing\../User/application/src/tcpserverc.c\52</Expression>
|
||||||
|
</Bp>
|
||||||
|
</Breakpoint>
|
||||||
<WatchWindow1>
|
<WatchWindow1>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>0</count>
|
<count>0</count>
|
||||||
|
@ -330,6 +347,31 @@
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>tcp_rx_data</ItemText>
|
<ItemText>tcp_rx_data</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>36</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>server_pcb_hart1</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>37</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>LAN8742</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>38</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>server_pcb_ble1</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>39</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>server_pcb_ble2</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>40</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>tcp_echo_flags_hart1</ItemText>
|
||||||
|
</Ww>
|
||||||
</WatchWindow1>
|
</WatchWindow1>
|
||||||
<MemoryWindow1>
|
<MemoryWindow1>
|
||||||
<Mm>
|
<Mm>
|
||||||
|
@ -421,7 +463,7 @@
|
||||||
<GroupNumber>2</GroupNumber>
|
<GroupNumber>2</GroupNumber>
|
||||||
<FileNumber>2</FileNumber>
|
<FileNumber>2</FileNumber>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<bDave2>0</bDave2>
|
<bDave2>0</bDave2>
|
||||||
<PathWithFileName>../Core/Src/main.c</PathWithFileName>
|
<PathWithFileName>../Core/Src/main.c</PathWithFileName>
|
||||||
|
@ -973,7 +1015,7 @@
|
||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>Middlewares/LwIP</GroupName>
|
<GroupName>Middlewares/LwIP</GroupName>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<cbSel>0</cbSel>
|
<cbSel>0</cbSel>
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -40,7 +40,7 @@ static err_t tcpecho_recv_hart1(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
{
|
{
|
||||||
/* 更新窗口*/
|
/* 更新窗口*/
|
||||||
tcp_echo_flags_hart1 = 1;
|
|
||||||
tcp_recved(tpcb, p->tot_len); // 读取数据的控制块 得到所有数据的长度
|
tcp_recved(tpcb, p->tot_len); // 读取数据的控制块 得到所有数据的长度
|
||||||
server_pcb_hart1 = tpcb; // 直接赋值
|
server_pcb_hart1 = tpcb; // 直接赋值
|
||||||
memcpy(hart1_uart5.tx_data, (int *)p->payload, p->tot_len);
|
memcpy(hart1_uart5.tx_data, (int *)p->payload, p->tot_len);
|
||||||
|
@ -54,6 +54,7 @@ static err_t tcpecho_recv_hart1(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
|
||||||
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
||||||
{
|
{
|
||||||
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);
|
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);
|
||||||
|
tcp_echo_flags_hart1 = 0;
|
||||||
return tcp_close(tpcb);
|
return tcp_close(tpcb);
|
||||||
}
|
}
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
|
@ -64,7 +65,6 @@ static err_t tcpecho_recv_hart2(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
{
|
{
|
||||||
/* 更新窗口*/
|
/* 更新窗口*/
|
||||||
tcp_echo_flags_hart2 = 1;
|
|
||||||
tcp_recved(tpcb, p->tot_len); // 读取数据的控制块 得到所有数据的长度
|
tcp_recved(tpcb, p->tot_len); // 读取数据的控制块 得到所有数据的长度
|
||||||
server_pcb_hart2 = tpcb; // 直接赋值
|
server_pcb_hart2 = tpcb; // 直接赋值
|
||||||
memcpy(hart2_uart2.tx_data, (int *)p->payload, p->tot_len);
|
memcpy(hart2_uart2.tx_data, (int *)p->payload, p->tot_len);
|
||||||
|
@ -79,6 +79,7 @@ static err_t tcpecho_recv_hart2(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
|
||||||
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
||||||
{
|
{
|
||||||
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);
|
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);
|
||||||
|
tcp_echo_flags_hart2 = 0;
|
||||||
return tcp_close(tpcb);
|
return tcp_close(tpcb);
|
||||||
}
|
}
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
|
@ -114,7 +115,6 @@ static err_t tcpecho_recv_ble2(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
{
|
{
|
||||||
/* 更新窗口*/
|
/* 更新窗口*/
|
||||||
tcp_echo_flags_ble2 = 1;
|
|
||||||
tcp_recved(tpcb, p->tot_len); // 读取数据的控制块 得到所有数据的长度
|
tcp_recved(tpcb, p->tot_len); // 读取数据的控制块 得到所有数据的长度
|
||||||
server_pcb_ble2 = tpcb; // 直接赋值
|
server_pcb_ble2 = tpcb; // 直接赋值
|
||||||
memcpy(ble2_uart3.tx_data, (int *)p->payload, p->tot_len);
|
memcpy(ble2_uart3.tx_data, (int *)p->payload, p->tot_len);
|
||||||
|
@ -127,6 +127,7 @@ static err_t tcpecho_recv_ble2(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
|
||||||
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
||||||
{
|
{
|
||||||
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);
|
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);
|
||||||
|
tcp_echo_flags_ble2 = 0;
|
||||||
return tcp_close(tpcb);
|
return tcp_close(tpcb);
|
||||||
}
|
}
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
|
@ -143,7 +144,6 @@ static err_t tcpecho_recv_control(void *arg, struct tcp_pcb *tpcb, struct pbuf *
|
||||||
{
|
{
|
||||||
HAL_GPIO_TogglePin(LED3_G_GPIO_Port, LED3_G_Pin);
|
HAL_GPIO_TogglePin(LED3_G_GPIO_Port, LED3_G_Pin);
|
||||||
/* 更新窗口*/
|
/* 更新窗口*/
|
||||||
tcp_echo_flags_control = 1;
|
|
||||||
tcp_recved(tpcb, p->tot_len); // 读取数据的控制块 得到所有数据的长度
|
tcp_recved(tpcb, p->tot_len); // 读取数据的控制块 得到所有数据的长度
|
||||||
server_pcb_control = tpcb; // 直接赋值
|
server_pcb_control = tpcb; // 直接赋值
|
||||||
memcpy(tcp_rx_data, (int *)p->payload, p->tot_len);
|
memcpy(tcp_rx_data, (int *)p->payload, p->tot_len);
|
||||||
|
@ -228,6 +228,7 @@ static err_t tcpecho_recv_control(void *arg, struct tcp_pcb *tpcb, struct pbuf *
|
||||||
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
||||||
{
|
{
|
||||||
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);
|
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);
|
||||||
|
tcp_echo_flags_control = 2;
|
||||||
return tcp_close(tpcb);
|
return tcp_close(tpcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,14 +237,16 @@ static err_t tcpecho_recv_control(void *arg, struct tcp_pcb *tpcb, struct pbuf *
|
||||||
static err_t tcpecho_accept_hart1(void *arg, struct tcp_pcb *newpcb, err_t err) // 由于这个函数是*tcp_accept_fn类型的
|
static err_t tcpecho_accept_hart1(void *arg, struct tcp_pcb *newpcb, err_t err) // 由于这个函数是*tcp_accept_fn类型的
|
||||||
// 形参的数量和类型必须一致
|
// 形参的数量和类型必须一致
|
||||||
{
|
{
|
||||||
tcp_recv(newpcb, tcpecho_recv_hart1); // 当收到数据时,回调用户自己写的tcpecho_recv
|
tcp_recv(newpcb, tcpecho_recv_hart1); // 当收到数据时,回调用户自己写的tcpecho_recv
|
||||||
|
tcp_echo_flags_hart1 = 1;
|
||||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static err_t tcpecho_accept_hart2(void *arg, struct tcp_pcb *newpcb, err_t err) // 由于这个函数是*tcp_accept_fn类型的
|
static err_t tcpecho_accept_hart2(void *arg, struct tcp_pcb *newpcb, err_t err) // 由于这个函数是*tcp_accept_fn类型的
|
||||||
{
|
{
|
||||||
tcp_recv(newpcb, tcpecho_recv_hart2); // 当收到数据时,回调用户自己写的tcpecho_recv
|
tcp_recv(newpcb, tcpecho_recv_hart2); // 当收到数据时,回调用户自己写的tcpecho_recv
|
||||||
|
tcp_echo_flags_hart2 = 1;
|
||||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
@ -257,13 +260,15 @@ static err_t tcpecho_accept_ble1(void *arg, struct tcp_pcb *newpcb, err_t err) /
|
||||||
#endif
|
#endif
|
||||||
static err_t tcpecho_accept_ble2(void *arg, struct tcp_pcb *newpcb, err_t err) // 由于这个函数是*tcp_accept_fn类型的
|
static err_t tcpecho_accept_ble2(void *arg, struct tcp_pcb *newpcb, err_t err) // 由于这个函数是*tcp_accept_fn类型的
|
||||||
{
|
{
|
||||||
tcp_recv(newpcb, tcpecho_recv_ble2); // 当收到数据时,回调用户自己写的tcpecho_recv
|
tcp_recv(newpcb, tcpecho_recv_ble2); // 当收到数据时,回调用户自己写的tcpecho_recv
|
||||||
|
tcp_echo_flags_ble2 = 1;
|
||||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
static err_t tcpecho_accept_control(void *arg, struct tcp_pcb *newpcb, err_t err) // 由于这个函数是*tcp_accept_fn类型的
|
static err_t tcpecho_accept_control(void *arg, struct tcp_pcb *newpcb, err_t err) // 由于这个函数是*tcp_accept_fn类型的
|
||||||
{
|
{
|
||||||
tcp_recv(newpcb, tcpecho_recv_control); // 当收到数据时,回调用户自己写的tcpecho_recv
|
tcp_recv(newpcb, tcpecho_recv_control); // 当收到数据时,回调用户自己写的tcpecho_recv
|
||||||
|
tcp_echo_flags_control = 1;
|
||||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue