Пример #1
0
void ICACHE_FLASH_ATTR
user_init(void)
{
	gpio_init();
	gpio_output_set(0, 0, 0, 0xFFFFFFFF);

	//init software uart
	Softuart_SetPinRx(&softuart,13); 	
	Softuart_SetPinTx(&softuart,15);

	gpio_pin_wakeup_disable();
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U,FUNC_GPIO12);

	UART_SetPrintPort(UART1);
	UartDev.data_bits = EIGHT_BITS;
	UartDev.parity = NONE_BITS;
	UartDev.stop_bits = ONE_STOP_BIT;
	uart_init(BIT_RATE_9600, BIT_RATE_115200);


	//clear noise
	uart0_sendStr("\r\n\r\n\r\n");

	//wifi_set_phy_mode(3);
	system_phy_set_powerup_option(3);
	wifi_set_opmode(STATION_MODE); //Set station mode
	system_phy_set_max_tpw(82); //MAX POWERR!
	system_phy_set_tpw_via_vdd33(system_get_vdd33());
	user_set_station_config();

	os_timer_disarm(&init_timer);
	os_timer_setfn(&init_timer, (os_timer_func_t *)gps_uart_init, NULL);
	os_timer_arm(&init_timer, 1000, 0); 
}
Пример #2
0
/**
 * The main entry point in an ESP8266 application.
 * It is where the logic of ESP8266 starts.
 */
void user_init() {
  system_timer_reinit(); // use microsecond os_timer_*

  // Initialize the UART devices
  int defaultBaudRate = 9600;
#ifdef DEFAULT_CONSOLE_BAUDRATE
  defaultBaudRate = DEFAULT_CONSOLE_BAUDRATE;
#endif

  uart_init(defaultBaudRate, defaultBaudRate);

  //uart_init(BIT_RATE_9600, BIT_RATE_9600);
  os_delay_us(1000); // make sure there's a gap on uart output
  UART_SetPrintPort(1);
  system_set_os_print(1);
  os_printf("\n\n\n\n");
  os_delay_us(1000);

  // Dump the restart exception information.
  dumpRestart();
  os_printf("Heap: %d\n", system_get_free_heap_size());
  os_printf("Variables: %d @%dea = %dbytes\n", JSVAR_CACHE_SIZE, sizeof(JsVar),
      JSVAR_CACHE_SIZE * sizeof(JsVar));
  os_printf("Time sys=%u rtc=%u\n", system_get_time(), system_get_rtc_time());

  // Register the ESP8266 initialization callback.
  system_init_done_cb(initDone);

  os_timer_setfn(&mainLoopSuspendTimer, enableMainLoop, NULL);
}
Пример #3
0
void ICACHE_FLASH_ATTR user_init(void) {
    wifi_init();
    uart_init_new();
    tcp_shell_init();
    UART_SetPrintPort( debugPort );
    xTaskCreate( forthright_task, "forthright", 256, NULL, 2, &tasks[0] ); // create root FORTH interpreter
}
Пример #4
0
/**
 * \brief The main entry point in an ESP8266 application.
 * It is where the logic of ESP8266 starts.
 */
void user_init() {
	// Initialize the UART devices
	uart_init(BIT_RATE_115200, BIT_RATE_115200);
	os_delay_us(10000); // give the uart a break
	UART_SetPrintPort(1);

	// Dump the restart exception information.
	dumpRestart();

	// Register the ESP8266 initialization callback.
	system_init_done_cb(initDone);

	// Do NOT attempt to auto connect to an access point.
	//wifi_station_set_auto_connect(0);
	os_timer_setfn(&mainLoopSuspendTimer, enableMainLoop, NULL);
}
Пример #5
0
/******************************************************************************
 * FunctionName : user_init
 * Description  : entry of user application, init user function here
 * Parameters   : none
 * Returns      : none
*******************************************************************************/
void user_init(void)
{

    uart_init(115200, 115200);

    UART_SetPrintPort(0);


    os_printf("init start, SDK version:%s\n", system_get_sdk_version());

    os_sprintf("vicly rom 20150109001");



   //Set softAP + station mode
   wifi_set_opmode(STATIONAP_MODE);

   // ESP8266 connect to router.
    user_set_station_config();


    /*
    static os_timer_t myuart_test_timer;
	os_timer_disarm(&myuart_test_timer);
	//os_timer_setfn(&myuart_test_timer, (os_timer_func_t *)vtest_uart, NULL);
	os_sprintf("os_sprintf:vicly test os time...;;");
	PRINTF("timer:PRINTF:uart0_sendStr q1  ... \n");
	os_timer_arm(&myuart_test_timer, 15000, 1);   //call set_usart_gpu_content 15sec each
*/


    /*
    //---------------smart config------------------s
//    os_printf("SDK version:%s\n", system_get_sdk_version());
	///smartconfig_set_type(SC_TYPE_ESPTOUCH); //SC_TYPE_ESPTOUCH,SC_TYPE_AIRKISS,SC_TYPE_ESPTOUCH_AIRKISS
	//smartconfig_set_type(SC_TYPE_AIRKISS); //SC_TYPE_ESPTOUCH,SC_TYPE_AIRKISS,SC_TYPE_ESPTOUCH_AIRKISS
	smartconfig_set_type(SC_TYPE_ESPTOUCH); //SC_TYPE_ESPTOUCH,SC_TYPE_AIRKISS,SC_TYPE_ESPTOUCH_AIRKISS

	wifi_set_opmode(STATION_MODE);
    smartconfig_start(smartconfig_done);
    //---------------smart config------------------e
*/


///#if ESP_PLATFORM
    /*Initialization of the peripheral drivers*/
    /*For light demo , it is user_light_init();*/
    /* Also check whether assigned ip addr by the router.If so, connect to ESP-server  */
///    user_esp_platform_init();
///#endif
    /*Establish a udp socket to receive local device detect info.*/
    /*Listen to the port 1025, as well as udp broadcast.
    /*If receive a string of device_find_request, it rely its IP address and MAC.*/
///    user_devicefind_init();







user_esp_platform_init();
///	v_user_esp_platform_init();

    /*Establish a TCP server for http(with JSON) POST or GET command to communicate with the device.*/
    /*You can find the command in "2B-SDK-Espressif IoT Demo.pdf" to see the details.*/
    /*the JSON command for curl is like:*/
    /*3 Channel mode: curl -X POST -H "Content-Type:application/json" -d "{\"period\":1000,\"rgb\":{\"red\":16000,\"green\":16000,\"blue\":16000}}" http://192.168.4.1/config?command=light      */
    /*5 Channel mode: curl -X POST -H "Content-Type:application/json" -d "{\"period\":1000,\"rgb\":{\"red\":16000,\"green\":16000,\"blue\":16000,\"cwhite\":3000,\"wwhite\",3000}}" http://192.168.4.1/config?command=light      */

    /*
#ifdef SERVER_SSL_ENABLE
    user_webserver_init(SERVER_SSL_PORT);
#else
    user_webserver_init(SERVER_PORT);
#endif
*/

}