mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-08-08 09:50:52 +00:00
FreeRTOS
This commit is contained in:
@@ -103,11 +103,10 @@ void task1(void *pvParameters) {
|
|||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (xSemaphoreTake(xMutex, 1500)) {
|
if (xSemaphoreTake(xMutex, 1500)) {
|
||||||
printf("Task 1 is running\n");
|
|
||||||
task_data.num1 = x;
|
task_data.num1 = x;
|
||||||
s_data.num1 = x;
|
s_data.num1 = x;
|
||||||
xQueueSend(xQueue1, &task_data, 0);
|
xQueueSend(xQueue1, &task_data, 0);
|
||||||
printf("Task 1 sent x=%" PRIu32 "\n", x);
|
printf("\nTask 1 sent x=%" PRIu32 "\n", x);
|
||||||
x+=2;
|
x+=2;
|
||||||
vTaskDelay(500);
|
vTaskDelay(500);
|
||||||
xSemaphoreGive(xMutex);
|
xSemaphoreGive(xMutex);
|
||||||
@@ -130,11 +129,10 @@ void task2(void *pvParameters) {
|
|||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (xSemaphoreTake(xMutex, 1500)) {
|
if (xSemaphoreTake(xMutex, 1500)) {
|
||||||
printf("Task 2 is running\n");
|
|
||||||
task_data.num2 = y;
|
task_data.num2 = y;
|
||||||
s_data.num2 = y;
|
s_data.num2 = y;
|
||||||
xQueueSend(xQueue2, &task_data, 0);
|
xQueueSend(xQueue2, &task_data, 0);
|
||||||
printf("Task 2 sent y=%" PRIu32 "\n", y);
|
printf("\nTask 2 sent y=%" PRIu32 "\n", y);
|
||||||
y++;
|
y++;
|
||||||
vTaskDelay(250);
|
vTaskDelay(250);
|
||||||
xSemaphoreGive(xMutex);
|
xSemaphoreGive(xMutex);
|
||||||
|
Reference in New Issue
Block a user