コード例 #1
0
ファイル: user_main.c プロジェクト: Blue-Design/Espruino
/**
 * 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);
}
コード例 #2
0
ファイル: user_main.c プロジェクト: programmicha/Espruino
/**
 * \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);
}