当前位置: 首页>>代码示例>>C++>>正文


C++ serial_line_init函数代码示例

本文整理汇总了C++中serial_line_init函数的典型用法代码示例。如果您正苦于以下问题:C++ serial_line_init函数的具体用法?C++ serial_line_init怎么用?C++ serial_line_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了serial_line_init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: start_process_run_loop

/*---------------------------------------------------------------------------*/
static void
start_process_run_loop(void *data)
{
    /* Yield once during bootup */
    simProcessRunValue = 1;
    cooja_mt_yield();

    /* Initialize random generator */
    random_init(0);

    /* Start process handler */
    process_init();

    /* Start Contiki processes */
    procinit_init();

    /* Print startup information */
    printf(CONTIKI_VERSION_STRING " started. ");
    if(node_id > 0) {
      printf("Node id is set to %u.\n", node_id);
    } else {
      printf("Node id is not set.\n");
    }

    /* Initialize communication stack */
    init_net();

    /* Start serial process */
    serial_line_init();

    /* Start autostart processes (defined in Contiki application) */
    print_processes(autostart_processes);
    autostart_start(autostart_processes);

    while(1)
	{
		/* Always pretend we have processes left while inside process_run() */
		simProcessRunValue = 1;

		if (simDoReceiverCallback) {
		  simDoReceiverCallback = 0;
		  radio_call_receiver();
		}

		simProcessRunValue = process_run();
		while (simProcessRunValue-- > 0) {
		  process_run();
		}
		simProcessRunValue = process_nevents();

		// Check if we must stay awake
		if (simDontFallAsleep) {
			simDontFallAsleep=0;
			simProcessRunValue = 1;
		}

		/* Yield thread when one process_run has completed */
		cooja_mt_yield();
	}
}
开发者ID:EDAyele,项目名称:ptunes,代码行数:61,代码来源:contiki_template.c

示例2: main

int
main()
{
    //dubug uart init
    dbg_setup_uart();
    clock_init();
		rtimer_init();
	
    //process init first
    process_init();

    uart1_set_input(serial_line_input_byte);
    serial_line_init();

    process_start(&etimer_process, NULL);

    /* with keil, can't use the AUTOSTART_PROCESSES to add the exmaple or it will be error
     * So in this project, start the process manual.
     */
#ifdef WITH_LED_BLINK
    process_start(&blink_process, NULL);
#endif
#ifdef WITH_CONTIKI_SHELL
    process_start(&stm32_shell_process, NULL);
#endif
#ifdef WITH_RTIMER_TEST
		process_start(&rtimer_ex_process, NULL);
#endif
    while(1)
    {
        do {}
        while(process_run()>0);
        idle_count++;
    }
}
开发者ID:ehigh2014,项目名称:contiki_stm32_keil,代码行数:35,代码来源:contiki-main.c

示例3: main

int
main()
{
  configure_mcu_clocks();
  uart_init(115200);
  printf("Platform init complete, starting contiki init\n");

  clock_init();
  rtimer_init();
  leds_init();
  process_init();
#if WITH_SERIAL_LINE_INPUT
  uart_set_input(serial_line_input_byte);
  serial_line_init();
#endif
  process_start(&etimer_process, NULL);
  ctimer_init();
  autostart_start(autostart_processes);
  while(1) {
    do {
	// meant to do some sleeping here, if we want to save power...
	//
    } while(process_run() > 0);
  }
  return 0;
}
开发者ID:frtos-wpan,项目名称:contiki-outoftree,代码行数:26,代码来源:contiki-main.c

示例4: main

/*---------------------------------------------------------------------------*/
int
main(void)
{
  printf("Starting Contiki\n");
  process_init();
  ctimer_init();

  netstack_init();
  
  procinit_init();

  serial_line_init();
  
  autostart_start(autostart_processes);

  
  /* Make standard output unbuffered. */
  setvbuf(stdout, (char *)NULL, _IONBF, 0);
  
  while(1) {
    fd_set fds;
    int n;
    struct timeval tv;
    
    clock_time_t next_event;
	
    n = process_run();
    next_event = etimer_next_expiration_time()-clock_time();

#if DEBUG_SLEEP
    if(n > 0) {
      printf("%d events pending\n",n);
    } else {
      printf("next event: T-%.03f\n",(double)next_event/(double)CLOCK_SECOND);
    }
#endif

	if(next_event>CLOCK_SECOND*2)
		next_event = CLOCK_SECOND*2;
    tv.tv_sec = n?0:next_event/CLOCK_SECOND;
    tv.tv_usec = n?0:next_event%1000*1000;

    FD_ZERO(&fds);
    FD_SET(STDIN_FILENO, &fds);
    select(1, &fds, NULL, NULL, &tv);

    if(FD_ISSET(STDIN_FILENO, &fds)) {
      char c;
      if(read(STDIN_FILENO, &c, 1) > 0) {
	serial_line_input_byte(c);
      }
    }
    
    etimer_request_poll();
  }
  
  return 0;
}
开发者ID:dak664,项目名称:contiki-2.x,代码行数:59,代码来源:contiki-main.c

示例5: collect_common_net_init

/*---------------------------------------------------------------------------*/
void
collect_common_net_init(void)
{
  collect_common_set_send_active(1);
  uart1_set_input(serial_line_input_byte);
  serial_line_init();

  PRINTF("I am sink!\r\n");
}
开发者ID:ChenZJgor,项目名称:contiki,代码行数:10,代码来源:MainSource.c

示例6: collect_common_net_init

/*---------------------------------------------------------------------------*/
void
collect_common_net_init(void)
{
#if CONTIKI_TARGET_Z1
  uart0_set_input(serial_line_input_byte);
#else
  uart1_set_input(serial_line_input_byte);
#endif
  serial_line_init();
}
开发者ID:Asterios,项目名称:contiki-econotag,代码行数:11,代码来源:udp-sender.c

示例7: collect_common_net_init

/*---------------------------------------------------------------------------*/
void
collect_common_net_init(void)
{
#if CONTIKI_TARGET_Z1
  uart0_set_input(serial_line_input_byte);
#else
  uart1_set_input(serial_line_input_byte);
#endif
  serial_line_init();

  PRINTF("I am sink!\n");
  printf("Energy: %d\n", ENERGEST_CONF_ON);
}
开发者ID:pvhau,项目名称:contiki-ext,代码行数:14,代码来源:udp-sink.c

示例8: collect_common_net_init

/*---------------------------------------------------------------------------*/
void
collect_common_net_init(void)
{
#if CONTIKI_TARGET_Z1
  uart0_set_input(serial_line_input_byte);
#else
  uart1_set_input(serial_line_input_byte);
#endif
  serial_line_init();

  PRINTF("I am sink!\n");
  //NETSTACK_RDC.off(0);
  //NETSTACK_RDC.init();
}
开发者ID:mlwymore,项目名称:contiki,代码行数:15,代码来源:udp-sink.c

示例9: main

/*---------------------------------------------------------------------------*/
int
main(void)
{
  printf("Starting Contiki\n");
  process_init();
  ctimer_init();

  netstack_init();
  
  procinit_init();

  serial_line_init();
  
  //autostart_start(autostart_processes);

  
  /* Make standard output unbuffered. */
  setvbuf(stdout, (char *)NULL, _IONBF, 0);
  
  while(1) {
    fd_set fds;
    int n;
    struct timeval tv;
    
    n = process_run();

    
    tv.tv_sec = 0;
    tv.tv_usec = 1;

    FD_ZERO(&fds);
    FD_SET(STDIN_FILENO, &fds);
    select(1, &fds, NULL, NULL, &tv);

    if(FD_ISSET(STDIN_FILENO, &fds)) {
      char c;
      if(read(STDIN_FILENO, &c, 1) > 0) {
	serial_line_input_byte(c);
      }
    }
    
    etimer_request_poll();
  }
  
  return 0;
}
开发者ID:michaelkirsche,项目名称:6lowpan4omnet-diy,代码行数:47,代码来源:contiki-main.c

示例10: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(sky_shell_process, ev, data)
{
  PROCESS_BEGIN();

  /* WITH_UIP=1 assumes incoming SLIP serial data.
   * We override this assumption by restoring default serial input handler. */
  uart1_set_input(serial_line_input_byte);
  serial_line_init();

  serial_shell_init();

  shell_file_init();
  shell_wget_init();
  shell_text_init();

  PROCESS_END();
}
开发者ID:EDAyele,项目名称:ptunes,代码行数:18,代码来源:sky-shell-webserver.c

示例11: PROCESS_THREAD

PROCESS_THREAD(demo_6lbr_process, ev, data)
{
  PROCESS_BEGIN();

#if SHELL
  uart1_set_input(serial_line_input_byte);
  serial_line_init();

  serial_shell_init();
  shell_ping_init();
  shell_6lbr_init();
#else
  start_apps();
#endif

  PROCESS_END();
}
开发者ID:denghongcai,项目名称:6lbr,代码行数:17,代码来源:6lbr-demo.c

示例12: main

int
main(void)
{
  //calibrate_rc_osc_32k(); //CO: Had to comment this out

  /* Init LEDs */
  leds_init();

  /* Initialize hardware */
  init_lowlevel();

  /* Clock */
  clock_init();

  /* Process subsystem */
  process_init();

  /* Register initial processes */
  procinit_init();


  //Give ourselves a prefix
  //init_net();

  /* This line wasn't present in ProMini code */
  /* Make pin 5 on port B an input (PB5 SCK/PCINT5) */
  PORTB &= ~(1<<5);
  serial_line_init();

  /* Autostart processes */
  autostart_start(autostart_processes);

  printf_P(PSTR("\r\n********BOOTING CONTIKI*********\r\n"));

  printf_P(PSTR("System online.\r\n"));

  /* Main scheduler loop */
  do {

    process_run();

  } while (1);

  return 0;
}
开发者ID:andyhelp,项目名称:contiki-arduino,代码行数:45,代码来源:contiki-arduino-main.c

示例13: main

/*---------------------------------------------------------------------------*/
int
main(void)
{

  /* Hardware initialization */
  bus_init();

  leds_init();
  fade(LEDS_GREEN);

  uart1_init(115200);
  uart1_set_input(serial_line_input_byte);

  /* initialize process manager. */
  process_init();

  serial_line_init();

  printf("\n" CONTIKI_VERSION_STRING " started\n");
  printf("model: " SENSINODE_MODEL "\n\n");

  /* initialize the radio driver */

  cc2430_rf_init();
  rime_init(sicslowmac_init(&cc2430_rf_driver));
  set_rime_addr();

  /* start services */
  process_start(&etimer_process, NULL);

  fade(LEDS_RED);

  autostart_start(autostart_processes);

  while(1) {
    process_run();
    etimer_request_poll();
  }
}
开发者ID:Asterios,项目名称:contiki-econotag,代码行数:40,代码来源:contiki-sensinode-main.c

示例14: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(udp_server_process, ev, data)
{
  static int connected = 0;
  static session_t dst;

  PROCESS_BEGIN();

  dtls_init();

  init_dtls(&dst);
  serial_line_init();

  if (!dtls_context) {
    dsrv_log(LOG_EMERG, "cannot create context\n");
    PROCESS_EXIT();
  }

  while(1) {
    PROCESS_YIELD();
    if(ev == tcpip_event) {
      dtls_handle_read(dtls_context);
    } else if (ev == serial_line_event_message) {
      register size_t len = min(strlen(data), sizeof(buf) - buflen);
      memcpy(buf + buflen, data, len);
      buflen += len;
      if (buflen < sizeof(buf) - 1)
	buf[buflen++] = '\n';	/* serial event does not contain LF */
    }

    if (buflen) {
      if (!connected)
	connected = dtls_connect(dtls_context, &dst) >= 0;
      
      try_send(dtls_context, &dst);
    }
  }
  
  PROCESS_END();
}
开发者ID:Asterios,项目名称:contiki-tls-dtls,代码行数:40,代码来源:dtls-client.c

示例15: main

/**
 * \brief Main function for CC26xx-based platforms
 *
 * The same main() is used for all supported boards
 */
int
main(void)
{
  /* Enable flash cache and prefetch. */
  ti_lib_vims_mode_set(VIMS_BASE, VIMS_MODE_ENABLED);
  ti_lib_vims_configure(VIMS_BASE, true, true);

  ti_lib_int_master_disable();

  /* Set the LF XOSC as the LF system clock source */
  oscillators_select_lf_xosc();

  lpm_init();

  board_init();

  gpio_interrupt_init();

  leds_init();

  /*
   * Disable I/O pad sleep mode and open I/O latches in the AON IOC interface
   * This is only relevant when returning from shutdown (which is what froze
   * latches in the first place. Before doing these things though, we should
   * allow software to first regain control of pins
   */
  ti_lib_pwr_ctrl_io_freeze_disable();

  fade(LEDS_RED);

  ti_lib_int_master_enable();

  soc_rtc_init();
  clock_init();
  rtimer_init();

  watchdog_init();
  process_init();

  random_init(0x1234);

  /* Character I/O Initialisation */
#if CC26XX_UART_CONF_ENABLE
  cc26xx_uart_init();
#endif

  serial_line_init();

  printf("Starting " CONTIKI_VERSION_STRING "\n\r");
  printf("With DriverLib v%u.%u\n\r", DRIVERLIB_RELEASE_GROUP,
         DRIVERLIB_RELEASE_BUILD);
  printf(BOARD_STRING "\n\r");

  process_start(&etimer_process, NULL);
  ctimer_init();

  energest_init();
  ENERGEST_ON(ENERGEST_TYPE_CPU);

  fade(LEDS_YELLOW);

  printf(" Net: ");
  printf("%s\n\r", NETSTACK_NETWORK.name);
  printf(" MAC: ");
  printf("%s\n\r", NETSTACK_MAC.name);
  printf(" RDC: ");
  printf("%s", NETSTACK_RDC.name);

  if(NETSTACK_RDC.channel_check_interval() != 0) {
    printf(", Channel Check Interval: %u ticks",
           NETSTACK_RDC.channel_check_interval());
  }
  printf("\n\r");

  netstack_init();

  set_rf_params();

#if NETSTACK_CONF_WITH_IPV6
  memcpy(&uip_lladdr.addr, &linkaddr_node_addr, sizeof(uip_lladdr.addr));
  queuebuf_init();
  process_start(&tcpip_process, NULL);
#endif /* NETSTACK_CONF_WITH_IPV6 */

  fade(LEDS_GREEN);

  process_start(&sensors_process, NULL);

  autostart_start(autostart_processes);

  watchdog_start();

  fade(LEDS_ORANGE);

  while(1) {
//.........这里部分代码省略.........
开发者ID:yplam,项目名称:SensorTagUDP,代码行数:101,代码来源:contiki-main.c


注:本文中的serial_line_init函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。