void ICACHE_FLASH_ATTR user_init(void) { char buf[128] = {0}; at_customLinkMax = 5; sdio_slave_init(); sdio_register_recv_cb(sdio_recv_data_callback); at_init(); at_register_uart_rx_buffer_fetch_cb(at_custom_uart_rx_buffer_fetch_cb); #ifdef ESP_AT_FW_VERSION if ((ESP_AT_FW_VERSION != NULL) && (os_strlen(ESP_AT_FW_VERSION) < 64)) { os_sprintf(buf,"compile time:%s %s\r\n"ESP_AT_FW_VERSION,__DATE__,__TIME__); } else { os_sprintf(buf,"compile time:%s %s",__DATE__,__TIME__); } #else os_sprintf(buf,"compile time:%s %s",__DATE__,__TIME__); #endif at_set_custom_info(buf); at_fake_uart_enable(TRUE,at_sdio_response); at_cmd_array_regist(&at_custom_cmd[0], sizeof(at_custom_cmd)/sizeof(at_custom_cmd[0])); espconn_tcp_set_wnd(4); at_port_print("\r\nready\r\n"); #ifdef SDIO_DEBUG os_timer_disarm(&at_spi_check); os_timer_setfn(&at_spi_check, (os_timer_func_t *)at_spi_check_cb, NULL); os_timer_arm(&at_spi_check, 1000, 1); os_printf("\r\ntimer start\r\n"); #endif }
static void ICACHE_FLASH_ATTR at_espconn_demo_init(void) { uint32 ip = 0; at_espconn_demo_espconn_ptr = (struct espconn *)os_zalloc(sizeof(struct espconn)); at_espconn_demo_espconn_ptr->type = ESPCONN_TCP; at_espconn_demo_espconn_ptr->state = ESPCONN_NONE; at_espconn_demo_espconn_ptr->proto.tcp = (esp_tcp *)os_zalloc(sizeof(esp_tcp)); at_espconn_demo_espconn_ptr->proto.tcp->local_port = espconn_port(); at_espconn_demo_espconn_ptr->proto.tcp->remote_port = 8999; ip = ipaddr_addr("192.168.1.120"); os_memcpy(at_espconn_demo_espconn_ptr->proto.tcp->remote_ip,&ip,sizeof(ip)); espconn_regist_connectcb(at_espconn_demo_espconn_ptr, at_espconn_demo_connect_cb); espconn_regist_reconcb(at_espconn_demo_espconn_ptr, at_espconn_demo_recon_cb); espconn_regist_disconcb(at_espconn_demo_espconn_ptr, at_espconn_demo_discon_cb); espconn_regist_recvcb(at_espconn_demo_espconn_ptr, at_espconn_demo_recv); espconn_regist_sentcb(at_espconn_demo_espconn_ptr, at_espconn_demo_send_cb); espconn_connect(at_espconn_demo_espconn_ptr); at_fake_uart_enable(TRUE,at_espconn_demo_response); }