Thread.c 712 B

123456789101112131415161718192021222324252627
  1. #include "cmsis_os2.h" // CMSIS RTOS header file
  2. /*----------------------------------------------------------------------------
  3. * Thread 1 'Thread_Name': Sample thread
  4. *---------------------------------------------------------------------------*/
  5. osThreadId_t tid_Thread; // thread id
  6. void Thread (void *argument); // thread function
  7. int Init_Thread (void) {
  8. tid_Thread = osThreadNew(Thread, NULL, NULL);
  9. if (tid_Thread == NULL) {
  10. return(-1);
  11. }
  12. return(0);
  13. }
  14. void Thread (void *argument) {
  15. while (1) {
  16. ; // Insert thread code here...
  17. osThreadYield(); // suspend thread
  18. }
  19. }