TCP连接断开时有蜂鸣器提醒
This commit is contained in:
parent
f8afd039dc
commit
4c3843e20e
|
@ -141,7 +141,6 @@ int main(void)
|
||||||
hart_ht1200m_reset(); // HT1200M reset
|
hart_ht1200m_reset(); // HT1200M reset
|
||||||
HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1); // HART CLK
|
HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1); // HART CLK
|
||||||
HAL_TIM_Encoder_Start(&htim1, TIM_CHANNEL_ALL); // rotary encoder
|
HAL_TIM_Encoder_Start(&htim1, TIM_CHANNEL_ALL); // rotary encoder
|
||||||
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3); // buzzer
|
|
||||||
#if (ENCODE_TIM8 == 1)
|
#if (ENCODE_TIM8 == 1)
|
||||||
HAL_TIM_Encoder_Start(&htim8, TIM_CHANNEL_ALL);
|
HAL_TIM_Encoder_Start(&htim8, TIM_CHANNEL_ALL);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -148,72 +148,7 @@
|
||||||
<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>250</LineNumber>
|
|
||||||
<EnabledFlag>1</EnabledFlag>
|
|
||||||
<Address>134301072</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\250</Expression>
|
|
||||||
</Bp>
|
|
||||||
<Bp>
|
|
||||||
<Number>1</Number>
|
|
||||||
<Type>0</Type>
|
|
||||||
<LineNumber>243</LineNumber>
|
|
||||||
<EnabledFlag>1</EnabledFlag>
|
|
||||||
<Address>134301048</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\243</Expression>
|
|
||||||
</Bp>
|
|
||||||
<Bp>
|
|
||||||
<Number>2</Number>
|
|
||||||
<Type>0</Type>
|
|
||||||
<LineNumber>264</LineNumber>
|
|
||||||
<EnabledFlag>1</EnabledFlag>
|
|
||||||
<Address>134301000</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\264</Expression>
|
|
||||||
</Bp>
|
|
||||||
<Bp>
|
|
||||||
<Number>3</Number>
|
|
||||||
<Type>0</Type>
|
|
||||||
<LineNumber>115</LineNumber>
|
|
||||||
<EnabledFlag>1</EnabledFlag>
|
|
||||||
<Address>134238880</Address>
|
|
||||||
<ByteObject>0</ByteObject>
|
|
||||||
<HtxType>0</HtxType>
|
|
||||||
<ManyObjects>0</ManyObjects>
|
|
||||||
<SizeOfObject>0</SizeOfObject>
|
|
||||||
<BreakByAccess>0</BreakByAccess>
|
|
||||||
<BreakIfRCount>1</BreakIfRCount>
|
|
||||||
<Filename>../LWIP/App/lwip.c</Filename>
|
|
||||||
<ExecCommand></ExecCommand>
|
|
||||||
<Expression>\\semi_finished_product_testing\../LWIP/App/lwip.c\115</Expression>
|
|
||||||
</Bp>
|
|
||||||
</Breakpoint>
|
|
||||||
<WatchWindow1>
|
<WatchWindow1>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>0</count>
|
<count>0</count>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -50,7 +50,6 @@ static err_t tcpecho_recv_hart1(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
|
||||||
dma_usart_send(&huart5, hart1_uart5.tx_data, p->tot_len);
|
dma_usart_send(&huart5, hart1_uart5.tx_data, p->tot_len);
|
||||||
}
|
}
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
|
||||||
}
|
}
|
||||||
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
||||||
{
|
{
|
||||||
|
@ -76,7 +75,6 @@ static err_t tcpecho_recv_hart2(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
|
||||||
}
|
}
|
||||||
|
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
|
||||||
}
|
}
|
||||||
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
||||||
{
|
{
|
||||||
|
@ -125,7 +123,6 @@ static err_t tcpecho_recv_ble2(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
|
||||||
dma_usart_send(&huart3, ble2_uart3.tx_data, p->tot_len);
|
dma_usart_send(&huart3, ble2_uart3.tx_data, p->tot_len);
|
||||||
}
|
}
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
|
||||||
}
|
}
|
||||||
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
||||||
{
|
{
|
||||||
|
@ -227,7 +224,6 @@ static err_t tcpecho_recv_control(void *arg, struct tcp_pcb *tpcb, struct pbuf *
|
||||||
/*3. 对要发送的数据进行校验,组包,返回数据*/
|
/*3. 对要发送的数据进行校验,组包,返回数据*/
|
||||||
}
|
}
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
|
||||||
}
|
}
|
||||||
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
||||||
{
|
{
|
||||||
|
@ -240,35 +236,35 @@ 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
|
||||||
|
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
|
||||||
|
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
#if (BLE2_USART6 == 1)
|
#if (BLE2_USART6 == 1)
|
||||||
static err_t tcpecho_accept_ble1(void *arg, struct tcp_pcb *newpcb, err_t err) // 由于这个函数是*tcp_accept_fn类型的
|
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
|
tcp_recv(newpcb, tcpecho_recv_ble1); // 当收到数据时,回调用户自己写的tcpecho_recv
|
||||||
|
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
#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
|
||||||
|
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
|
||||||
|
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_3); // 停止蜂鸣器PWM输出,用于关闭蜂鸣器发声
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
void tcp_echo_init(void)
|
void tcp_echo_init(void)
|
||||||
|
|
Loading…
Reference in New Issue