60 lines
1000 B
C
60 lines
1000 B
C
#include "cmsis_os2.h"
|
|
#include "stdio.h"
|
|
#include "main.h"
|
|
|
|
#include "RTE_Components.h"
|
|
#ifdef RTE_Compiler_EventRecorder
|
|
#include "EventRecorder.h"
|
|
#endif
|
|
|
|
const osThreadAttr_t tid_Thread1_attr = {
|
|
.name = "Thread1",
|
|
.priority = (osPriority_t) osPriorityLow3,
|
|
.stack_size = 256 * 4
|
|
};
|
|
|
|
|
|
const osThreadAttr_t tid_Thread2_attr = {
|
|
.name = "Thread2",
|
|
.priority = (osPriority_t) osPriorityLow4,
|
|
.stack_size = 512 * 4
|
|
};
|
|
|
|
osThreadId_t Thread1_id= NULL;
|
|
osThreadId_t Thread2_id= NULL;
|
|
|
|
|
|
|
|
void Thread1(void *argument)
|
|
{
|
|
printf("Thread1 Init.\r\n");
|
|
while(1)
|
|
{
|
|
EventStartA(0);
|
|
HAL_Delay(20);
|
|
osDelay(200);
|
|
EventStopA(0);
|
|
}
|
|
}
|
|
|
|
void Thread2(void *argument)
|
|
{
|
|
printf("Thread2 Init.\r\n");
|
|
while(1)
|
|
{
|
|
EventStartA(1);
|
|
HAL_Delay(10);
|
|
osDelay(100);
|
|
EventStopA(1);
|
|
}
|
|
}
|
|
|
|
void Thread_Init(void)
|
|
{
|
|
Thread1_id = osThreadNew(Thread1, NULL, &tid_Thread1_attr);
|
|
|
|
Thread2_id = osThreadNew(Thread2, NULL, &tid_Thread2_attr);
|
|
}
|
|
|
|
|