void HighTask(void const * argument){
for(;;){
vTaskDelay(500);
printf("High task take RecursiveMutex1\r\n");
xSemaphoreTakeRecursive(RecursiveMutexHandle,portMAX_DELAY);
printf("High task running...!\r\n");
printf("High task take RecursiveMutex2\r\n");
xSemaphoreTakeRecursive(RecursiveMutexHandle,portMAX_DELAY);
printf("High task running...!\r\n");
HAL_GPIO_TogglePin(GPIOC,GPIO_PIN_1);
printf("High task give RecursiveMutex1\r\n");
xSemaphoreGiveRecursive(RecursiveMutexHandle);
printf("High task give RecursiveMutex2\r\n");
xSemaphoreGiveRecursive(RecursiveMutexHandle);
vTaskDelay(500);
}
}
void MiddleTask(void const * argument){
for(;;){
printf("Middle task running!\r\n");
HAL_GPIO_TogglePin(GPIOC,GPIO_PIN_0);
vTaskDelay(1000);
}
}
void LowTask(void const * argument){
for(;;){
printf("Low task take RecursiveMutex\r\n");
xSemaphoreTakeRecursive(RecursiveMutexHandle,portMAX_DELAY);
printf("Low task running...!\r\n");
for(int i=0;i<20000000;i++){
taskYIELD();
}
printf("Low task give RecursiveMutex\r\n");
xSemaphoreGive(RecursiveMutexHandle);
vTaskDelay(1000);
}
}