Ejemplo n.º 1
0
extern "C" void ICACHE_FLASH_ATTR user_init(void)
{
    do_global_ctors();
    system_set_os_print(0);

    uart_init(BIT_RATE_115200, BIT_RATE_115200);
    //os_delay_us(1000000);
    
    int ret = esp8266.init(2048, 2048, 1024);
    
    os_printf("\n\n\n");
    
    //DTXT("MQTT ESP8266 Slave Firmware ver. %d.%d\n", VERSION_MAJOR, VERSION_MINOR);
    //DTXT("2015 Michael Jacobsen\n");
    //DTXT("\n");    
    //system_print_meminfo();
    //system_set_os_print(0);
    //DTXT("\n");
    
    if(ret == 0) {
        wifi.init(&esp8266);
        dispatcher.init(&esp8266);
        
        if(dispatcher.setup(&wifi) == EOK) {
            wifi.setup();

            //os_printf("{\"jsonrpc\":\"2.0\",\"method\":\"system\",\"params\":{\"code\":1,\"sys\":\"system\",\"msg\":\"start\",\"p1\":null,\"p2\":null,\"n1\":0,\"n2\":0}}\n");
        }
    }
    else {
        os_printf("{\"jsonrpc\":\"2.0\",\"method\":\"jsonrpc\",\"params\":{\"code\": -10,\"error\":\"esp8266.init() returns error; %d\"}}\n", ret);
    }
}
Ejemplo n.º 2
0
void init_done() {
    system_set_os_print(1);
    gdb_init();
    do_global_ctors();
    printf("\n%08x\n", core_version);
    esp_schedule();
}
Ejemplo n.º 3
0
extern "C" void ICACHE_FLASH_ATTR user_init(void)
{
	do_global_ctors();
	// Configure the UART
	uart_init(UART_BITRATE, UART_BITRATE);

	DPRINT("ESP8266 platform starting...");
//	Config::instance().zero();
	Config::I().errno(ERRNO_OK);

	if(!Config::I().wifi_configured())
		reset_wifi_configs();

//	startudp();

	os_timer_disarm(&WiFiCheck);
	Config::I().errno(ERRNO_UNDEFINED);
	os_timer_setfn(&WiFiCheck, (os_timer_func_t *)wifi_check_ip, NULL);
	os_timer_arm(&WiFiCheck, 1000, 0);

	RGBLED::I();
	test_flash();

	PM;
//	HTTPD::instance();
}
Ejemplo n.º 4
0
extern "C" void user_init(void)
{
	do_global_ctors();
	// Configure the UART
	uart_init(BIT_RATE_115200, BIT_RATE_115200);
	ets_uart_printf("System init...\r\n");


	mySwitch.init();
	mySwitch.enableReceive(13);  // Receiver on inerrupt 0 => that is pin #2
	// Set up a timer to send the message
	// os_timer_disarm(ETSTimer *ptimer)
	os_timer_disarm(&hello_timer);
	// os_timer_setfn(ETSTimer *ptimer, ETSTimerFunc *pfunction, void *parg)
	os_timer_setfn(&hello_timer, (os_timer_func_t *)hello_cb, (void *)0);
	//void os_timer_arm(ETSTimer *ptimer,uint32_t milliseconds, bool repeat_flag)
	os_timer_arm(&hello_timer, DELAY, 1);
	ets_uart_printf("System init done.\r\n");




}
Ejemplo n.º 5
0
//入口函数,初始化参数,并调用初始化堆与IO的函数
void mini_crt_entry(void)
{
    int ret;
    int flag = 0, argc = 0;
    char *argv[16];
    char *cl = GetCommandLineA();

    argv[argc++] = cl;
    //每个位置判断若是空格,且后一个位置非空格,则视为参数
    for (; *cl; cl++) {
        if (*cl == '\"') flag ^= 1;
        else if (*cl == ' ' && !flag) {
            if (*(cl + 1) && *(cl + 1) != ' ')
                argv[argc++] = cl + 1;
            *cl = 0;
        }
    }
    if (!mini_crt_heap_init() || !mini_crt_io_init()) exit(1);
    do_global_ctors();

    ret = main(argc, argv);
    exit(ret);
}
Ejemplo n.º 6
0
void init_done() {
    system_set_os_print(1);
    gdb_init();
    do_global_ctors();
    esp_schedule();
}
Ejemplo n.º 7
0
void init_done() {
    do_global_ctors();
    esp_schedule();
}