Beispiel #1
0
void user_init()
{
    struct station_config conf;

    // This is used to setup the serial communication
    uart_div_modify(0, UART_CLK_FREQ / 115200);

    wifi_set_opmode(STATION_MODE);

    // os_bzero ( &conf, sizeof(struct station_config) );
    os_memset ( &conf, 0, sizeof(struct station_config) );
    os_memcpy (&conf.ssid, ssid, 32);
    os_memcpy (&conf.password, pass, 64 );
    wifi_station_set_config (&conf);

    // And this is used to print some information
    os_printf("\n");
    os_printf("SDK version:%s\n", system_get_sdk_version());
    system_print_meminfo();
    os_delay_us ( 1 );
    os_printf ( "CPU Hz = %d\n", system_get_cpu_freq() );

    show_mac ();
    show_ip ();

    /* set a callback for wifi events */
    wifi_set_event_handler_cb ( wifi_event );
}
Beispiel #2
0
char *show_interface_info(const int fd, char * name)
{
	//printf("%s",show_ipv4(fd,"eth0"));
	//printf("%s",show_netmask(fd,"eth0"));
	//printf("%s",show_mac(fd,"eth0"));
	char *str = (char*)malloc(1000);
	sprintf(str, "%s\n%s\n%s\n", show_ipv4(fd,name),show_mac(fd,name),show_netmask(fd,name));
return str;
}