完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
主函数如下:
while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ loop_cnt++; //HAL_GPIO_TogglePin(LED_GPIO_Port,LED_Pin); if(13 == ((loop_cnt >> 4) 0x0f)) HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_RESET); else if (15 == ((loop_cnt >> 4) 0x0f)) HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_SET); HAL_IWDG_Refresh( hiwdg); if(HAL_GPIO_ReadPin(GPIOD, GPIO_PIN_13)) { HAL_GPIO_WritePin(GPIOD, GPIO_PIN_6, GPIO_PIN_RESET); } else { HAL_GPIO_WritePin(GPIOD, GPIO_PIN_6, GPIO_PIN_SET); } //print_log("w5500 link STA %drn", (Read_W5500_1Byte(PHYCFGR) LINK)); #if 1 if((getPHYCFGR() 0x01) != link_state) { link_state = (getPHYCFGR() 0x01); if((getPHYCFGR() 0x01) == 0) { beep_voice(1, 200); close(2); S_State[2] = 0; close(3); S_State[3] = 0; close(4); S_State[4] = 0; close(5); S_State[5] = 0; } else { beep_voice(2, 50); print_log("w5500 linkrn"); } } else if(memcmp(gSystemParam.deviceIp, gSystemParam.gateway, 3) == 0) // check gateway { //tmpTciks = g64msticks; // handle webserver do_http(0); //print_log("do_http %lldrn", g64msTicks - tmpTciks); //tmpTciks = g64msTicks; // handle NTP services //ntpServices(); //print_log("ntpServices %lldrn", g64msTicks - tmpTciks); //tmpTciks = g64msTicks; netAppServices(); //read_net_app(); //print_log("netAppServices %lldrn", g64msTicks - tmpTciks); } // handle uart message, include uart1 uart2 uart3 cmdMachine(); #endif }在注释掉do_http(0)后程序无法启动,请问是什么问题? do_http的函数定义如下: char rx_buf[MAX_URI_SIZE] = {0};void do_http(uint8_t sn){ unsigned short len; st_http_request *http_request; memset(rx_buf,0x00,MAX_URI_SIZE); http_request = (st_http_request*)rx_buf; // struct of http request /* http service start */ switch(getSn_SR(sn)) { case SOCK_INIT: //listen(sn); break; case SOCK_LISTEN: break; case SOCK_ESTABLISHED: //case SOCK_CLOSE_WAIT: if(getSn_IR(sn) Sn_IR_CON) { setSn_IR(sn, Sn_IR_CON); } if ((len = getSn_RX_RSR(sn)) > 0) { len = recv(sn, (unsigned char*)http_request, len); *(((unsigned char*)http_request)+len) = 0; //proc_http(sn, (unsigned char*)http_request); // request is processed disconnect(sn); //printf("SOCK_ESTABLISHED %04xrn", len); } break; case SOCK_CLOSE_WAIT: if ((len = getSn_RX_RSR(sn)) > 0) { //printf("close wait: %drn",len); len = recv(sn, (unsigned char*)http_request, len); *(((unsigned char*)http_request)+len) = 0; //proc_http(sn, (unsigned char*)http_request); // request is processed //printf("SOCK_CLOSE_WAIT %04xrn", len); } disconnect(sn); break; case SOCK_CLOSED: len = gSystemParam.webServerPort[1]; len *= 256; len += gSystemParam.webServerPort[0]; socket(sn, Sn_MR_TCP, len, 0x00); /* reinitialize the socket */ break; default: break; }// end of switch} |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
调试STM32H750的FMC总线读写PSRAM遇到的问题求解?
1909 浏览 1 评论
X-NUCLEO-IHM08M1板文档中输出电流为15Arms,15Arms是怎么得出来的呢?
1678 浏览 1 评论
1172 浏览 2 评论
STM32F030F4 HSI时钟温度测试过不去是怎么回事?
771 浏览 2 评论
ST25R3916能否对ISO15693的标签芯片进行分区域写密码?
1732 浏览 2 评论
1970浏览 9评论
STM32仿真器是选择ST-LINK还是选择J-LINK?各有什么优势啊?
807浏览 4评论
stm32f4下spi+dma读取数据不对是什么原因导致的?
254浏览 3评论
STM32F0_TIM2输出pwm2后OLED变暗或者系统重启是怎么回事?
624浏览 3评论
634浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-1-24 01:36 , Processed in 0.912112 second(s), Total 76, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号