Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Create the thread(s) */
- /* definition and creation of THREAD1 */
- osThreadDef(THREAD1, LED_Thread1, osPriorityBelowNormal, 0, 128);
- THREAD1Handle = osThreadCreate(osThread(THREAD1), NULL);
- /* definition and creation of THREAD2 */
- osThreadDef(THREAD2, LED_Thread2, osPriorityBelowNormal, 0, 128);
- THREAD2Handle = osThreadCreate(osThread(THREAD2), NULL);
- /* USER CODE BEGIN RTOS_THREADS */
- /* Set thread 2 in suspend state */
- OsStatus = osThreadSuspend(THREAD2Handle);
- /* USER CODE END RTOS_THREADS */
- underneath:
- osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *argument)
- {
- TaskHandle_t handle;
- #if( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
- if((thread_def->buffer != NULL) && (thread_def->controlblock != NULL)) {
- handle = xTaskCreateStatic((TaskFunction_t)thread_def->pthread,(const portCHAR *)thread_def->name,
- thread_def->stacksize, argument, makeFreeRtosPriority(thread_def->tpriority),
- thread_def->buffer, thread_def->controlblock);
- }
- else {
- if (xTaskCreate((TaskFunction_t)thread_def->pthread,(const portCHAR *)thread_def->name,
- thread_def->stacksize, argument, makeFreeRtosPriority(thread_def->tpriority),
- &handle) != pdPASS) {
- return NULL;
- }
- }
- #elif( configSUPPORT_STATIC_ALLOCATION == 1 )
- handle = xTaskCreateStatic((TaskFunction_t)thread_def->pthread,(const portCHAR *)thread_def->name,
- thread_def->stacksize, argument, makeFreeRtosPriority(thread_def->tpriority),
- thread_def->buffer, thread_def->controlblock);
- #else
- if (xTaskCreate((TaskFunction_t)thread_def->pthread,(const portCHAR *)thread_def->name,
- thread_def->stacksize, argument, makeFreeRtosPriority(thread_def->tpriority),
- &handle) != pdPASS) {
- return NULL;
- }
- #endif
- return handle;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement