欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: stm32f10x 移植contiki源程序 [打印本頁]

作者: kaihua.yang    時間: 2019-7-8 22:07
標題: stm32f10x 移植contiki源程序
1.使用std庫
2.移植了contiki
3.運行兩個thread正常

單片機源程序如下:
  1. #include "contiki.h"
  2. unsigned int idle_count = 0;

  3. static struct etimer et_on;
  4. PROCESS(led_on, "led_on");
  5. PROCESS_THREAD(led_on, ev, data)  
  6. {
  7.     static int on = 0;
  8.         PROCESS_BEGIN();

  9.         while(1)
  10.         {
  11.            on++;
  12.            etimer_set(&et_on, CLOCK_SECOND);              // etimer溢出時間為5s
  13.        PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et_on));  // 等待定時器溢出
  14.         }

  15.         PROCESS_END();
  16. }


  17. static struct etimer et_off;
  18. PROCESS(led_off, "led_off");
  19. PROCESS_THREAD(led_off, ev, data)  
  20. {
  21.     static int off = 0;
  22.         PROCESS_BEGIN();

  23.         while(1)
  24.         {
  25.            off++;
  26.            etimer_set(&et_off, CLOCK_SECOND);              // etimer溢出時間為5s
  27.        PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et_off));  // 等待定時器溢出
  28.         }

  29.         PROCESS_END();
  30. }

  31. AUTOSTART_PROCESSES(&led_on,&led_off);  

  32. int main(void*arg)
  33. {
  34.         clock_init();  
  35.         process_init();  
  36.         process_start(&etimer_process,NULL);  
  37.         autostart_start(autostart_processes);
  38.         while(1){
  39.                 while(process_run()> 0);  
  40.                 idle_count++;  
  41.         }
  42. }
復制代碼

所有資料51hei提供下載:
stm32-contiki-master.zip (350.96 KB, 下載次數: 11)







歡迎光臨 (http://m.raoushi.com/bbs/) Powered by Discuz! X3.1