Thread.c 751 B

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