备份--111
This commit is contained in:
parent
2f81e27eb0
commit
f5f2abbf8f
File diff suppressed because it is too large
Load Diff
|
@ -45,7 +45,7 @@ static err_t tcpecho_recv_hart1(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
|
|||
if (p != NULL)
|
||||
{
|
||||
/* 更新窗口*/
|
||||
tcp_echo_flags_hart1 = 1;
|
||||
|
||||
tcp_recved(tpcb, p->tot_len); // 读取数据的控制块 得到所有数据的长度
|
||||
server_pcb_hart1 = tpcb; // 直接赋值
|
||||
memcpy(hart1_uart5.tx_data, (int *)p->payload, p->tot_len);
|
||||
|
@ -69,7 +69,7 @@ static err_t tcpecho_recv_hart2(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
|
|||
if (p != NULL)
|
||||
{
|
||||
/* 更新窗口*/
|
||||
tcp_echo_flags_hart2 = 1;
|
||||
|
||||
tcp_recved(tpcb, p->tot_len); // 读取数据的控制块 得到所有数据的长度
|
||||
server_pcb_hart2 = tpcb; // 直接赋值
|
||||
memcpy(hart2_uart2.tx_data, (int *)p->payload, p->tot_len);
|
||||
|
@ -95,7 +95,7 @@ static err_t tcpecho_recv_ble1(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
|
|||
if (p != NULL)
|
||||
{
|
||||
/* 更新窗口*/
|
||||
tcp_echo_flags_ble1 = 1;
|
||||
|
||||
tcp_recved(tpcb, p->tot_len); // 读取数据的控制块 得到所有数据的长度
|
||||
server_pcb_ble1 = tpcb; // 直接赋值
|
||||
|
||||
|
@ -109,6 +109,7 @@ static err_t tcpecho_recv_ble1(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
|
|||
}
|
||||
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
||||
{
|
||||
tcp_echo_flags_ble1 = 0;
|
||||
return tcp_close(tpcb);
|
||||
}
|
||||
return ERR_OK;
|
||||
|
@ -120,7 +121,7 @@ static err_t tcpecho_recv_ble2(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
|
|||
if (p != NULL)
|
||||
{
|
||||
/* 更新窗口*/
|
||||
tcp_echo_flags_ble2 = 1;
|
||||
|
||||
tcp_recved(tpcb, p->tot_len); // 读取数据的控制块 得到所有数据的长度
|
||||
server_pcb_ble2 = tpcb; // 直接赋值
|
||||
memcpy(ble2_uart3.tx_data, (int *)p->payload, p->tot_len);
|
||||
|
@ -147,7 +148,7 @@ static err_t tcpecho_recv_control(void *arg, struct tcp_pcb *tpcb, struct pbuf *
|
|||
communication_data_u communication_data;
|
||||
if (p != NULL)
|
||||
{
|
||||
tcp_echo_flags_control = 1;
|
||||
|
||||
/* 更新窗口*/
|
||||
tcp_recved(tpcb, p->tot_len); // 读取数据的控制块 得到所有数据的长度
|
||||
server_pcb_control = tpcb; // 直接赋值
|
||||
|
@ -240,35 +241,40 @@ 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类型的,形参的数量和类型必须一致
|
||||
{
|
||||
tcp_recv(newpcb, tcpecho_recv_hart1); // 当收到数据时,回调用户自己写的tcpecho_recv
|
||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
||||
tcp_recv(newpcb, tcpecho_recv_hart1); // 当收到数据时,回调用户自己写的tcpecho_recv
|
||||
tcp_echo_flags_hart1 = 1;
|
||||
// HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
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
|
||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
||||
tcp_recv(newpcb, tcpecho_recv_hart2); // 当收到数据时,回调用户自己写的tcpecho_recv
|
||||
tcp_echo_flags_hart2 = 1;
|
||||
// HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
||||
return ERR_OK;
|
||||
}
|
||||
#if (BLE2_USART6 == 1)
|
||||
static err_t tcpecho_accept_ble1(void *arg, struct tcp_pcb *newpcb, err_t err) // 由于这个函数是*tcp_accept_fn类型的
|
||||
{
|
||||
tcp_recv(newpcb, tcpecho_recv_ble1); // 当收到数据时,回调用户自己写的tcpecho_recv
|
||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
||||
tcp_recv(newpcb, tcpecho_recv_ble1); // 当收到数据时,回调用户自己写的tcpecho_recv
|
||||
tcp_echo_flags_ble1 = 1;
|
||||
// HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
||||
return ERR_OK;
|
||||
}
|
||||
#endif
|
||||
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
|
||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
||||
tcp_recv(newpcb, tcpecho_recv_ble2); // 当收到数据时,回调用户自己写的tcpecho_recv
|
||||
tcp_echo_flags_ble2 = 1;
|
||||
// HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
||||
return ERR_OK;
|
||||
}
|
||||
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
|
||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
||||
tcp_recv(newpcb, tcpecho_recv_control); // 当收到数据时,回调用户自己写的tcpecho_recv
|
||||
tcp_echo_flags_control = 1;
|
||||
// HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
||||
return ERR_OK;
|
||||
}
|
||||
void tcp_echo_init(void)
|
||||
|
|
Loading…
Reference in New Issue