void user_init(void)
{
        uint8_t i;
        //system_set_os_print(0);
	os_timer_disarm(&some_timer);

	//Setup timer
	os_timer_setfn(&some_timer, (os_timer_func_t *)some_timer_func, NULL);

	//Arm the timer
	//&some_timer is the pointer
	//1000 is the fire time in ms
	//0 for once and 1 for repeating
	os_timer_arm(&some_timer, 5000, 0);

	UartDev.data_bits = EIGHT_BITS;
	UartDev.parity = NONE_BITS;
	UartDev.stop_bits = ONE_STOP_BIT;
	uart_init(BIT_RATE_500000, BIT_RATE_500000);
	os_printf("size flash_param_t %d\n", sizeof(flash_param_t));


	#ifdef CONFIG_STATIC
		// refresh wifi config
		config_execute();
	#endif

	#ifdef CONFIG_DYNAMIC
		serverInit(flash_param->port);
	#else
		serverInit(8876);
	#endif

	#ifdef CONFIG_GPIO
		config_gpio();
	#endif

	for (i = 0; i < 16; ++i)
		uart0_sendStr("\r\n");

	system_os_task(recvTask, recvTaskPrio, recvTaskQueue, recvTaskQueueLen);
}
예제 #2
0
void ICACHE_FLASH_ATTR user_init(void)
{
	uint8_t i;
	//wifi_set_opmode(3); //STA+AP

	#ifdef CONFIG_DYNAMIC
		flash_param_t *flash_param;
		flash_param_init();
		flash_param = flash_param_get();
		UartDev.data_bits = GETUART_DATABITS(flash_param->uartconf0);
		UartDev.parity = GETUART_PARITYMODE(flash_param->uartconf0);
		UartDev.stop_bits = GETUART_STOPBITS(flash_param->uartconf0);
		uart_init(flash_param->baud, BIT_RATE_115200);
	#else
		UartDev.data_bits = EIGHT_BITS;
		UartDev.parity = NONE_BITS;
		UartDev.stop_bits = ONE_STOP_BIT;
		uart_init(BIT_RATE_115200, BIT_RATE_115200);
	#endif
	os_printf("size flash_param_t %d\n", sizeof(flash_param_t));


	#ifdef CONFIG_STATIC
		// refresh wifi config
		config_execute();
	#endif

	#ifdef CONFIG_DYNAMIC
		serverInit(flash_param->port);
	#else
		serverInit(23);
	#endif

	config_gpio();

    os_timer_disarm(&main_timer);
	os_timer_setfn(&main_timer, (os_timer_func_t *)main_timer_callback, NULL);
	os_timer_arm(&main_timer, TIMER_DURATION_MS, 1);

	system_os_task(recvTask, recvTaskPrio, recvTaskQueue, recvTaskQueueLen);
}