Guest User

Untitled

a guest
Jul 11th, 2012
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.84 KB | None | 0 0
  1.   uint8_t buf[256] = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl";
  2.  
  3.  
  4.  
  5.   /*
  6.    * Main loop, does nothing except spawn a shell when the old one was terminated
  7.    */
  8.  
  9.   while (TRUE) {
  10.     if (!shelltp && isUsbActive())
  11.       {
  12.         shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
  13.         while(1){
  14.             chSequentialStreamWrite(chp, buf, 256);
  15.         }
  16.       }
  17.     else if (chThdTerminated(shelltp)) {
  18.       chThdRelease(shelltp);    /* Recovers memory of the previous shell.   */
  19.       shelltp = NULL;           /* Triggers spawning of a new shell.        */
  20.     }
  21.     chThdSleepMilliseconds(1000);
  22.   }
Advertisement
Add Comment
Please, Sign In to add comment