基于ESP8266_NONOS_SDK-2.2.0

void ICACHE_FLASH_ATTR OS_Timer_1_cb(void)//软件定时器的回调函数
{
	struct ip_info ST_ESP8266_ip;
	u8 esp8266_ip[4];
	switch(wifi_get_opmode())
	{
	   case 0x01: os_printf("mode = station\r\n");break;
	   case 0x02: os_printf("mode = softap\r\n");break;
	   case 0x03: os_printf("mode = sta+softap\r\n");break;
	}
	wifi_get_ip_info(SOFTAP_IF,&ST_ESP8266_ip);
	esp8266_ip[0]=ST_ESP8266_ip.ip.addr;
	esp8266_ip[1]=ST_ESP8266_ip.ip.addr>>8;
	esp8266_ip[2]=ST_ESP8266_ip.ip.addr>>16;
	esp8266_ip[3]=ST_ESP8266_ip.ip.addr>>24;
	os_printf("ESP8266 ip=%d.%d.%d.%d\r\n",esp8266_ip[0],esp8266_ip[1],esp8266_ip[2],esp8266_ip[3]);
	os_printf("num of dev con =%d\r\n",wifi_softap_get_station_num());
}

void ICACHE_FLASH_ATTR ESP8266_AP_init(void)
{
	struct softap_config AP_Config;
	wifi_set_opmode(0x02);
	os_memset(&AP_Config,0,sizeof(struct softap_config));
	os_strcpy(AP_Config.ssid,"wifissid");
	os_strcpy(AP_Config.password,"1234");
	AP_Config.ssid_len=os_strlen("wifissid");
	AP_Config.channel=1;
	AP_Config.authmode=AUTH_WPA2_PSK;
	AP_Config.ssid_hidden=0;
	AP_Config.max_connection=4;
	AP_Config.beacon_interval=100;
	wifi_softap_set_config(&AP_Config);
}


//主函数调用如下
ESP8266_AP_init();
OS_Timer_1_Init(1000,1);