From 6f84c00718b270ef44d9e4ce68bb1a6c69daad1c Mon Sep 17 00:00:00 2001 From: KLASSENTS Date: Wed, 26 Mar 2025 16:31:28 +0700 Subject: [PATCH] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FreeRTOS/examples/Interrupts/Interrupts.ino | 5 +---- .../examples/Notifications/Notifications.ino | 12 ++++-------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/libraries/FreeRTOS/examples/Interrupts/Interrupts.ino b/libraries/FreeRTOS/examples/Interrupts/Interrupts.ino index b65cb9f..926095a 100644 --- a/libraries/FreeRTOS/examples/Interrupts/Interrupts.ino +++ b/libraries/FreeRTOS/examples/Interrupts/Interrupts.ino @@ -18,9 +18,6 @@ SemaphoreHandle_t interruptSemaphore; void setup() { - // Configure pin 2 as an input and enable the internal pull-up resistor - pinMode(2, INPUT_PULLUP); - // Create task for Arduino led xTaskCreate(TaskLed, // Task function "Led", // Task name @@ -36,7 +33,7 @@ void setup() { interruptSemaphore = xSemaphoreCreateBinary(); if (interruptSemaphore != NULL) { // Attach interrupt for Arduino digital pin - attachInterrupt(digitalPinToInterrupt(2), interruptHandler, LOW); + attachInterrupt(digitalPinToInterrupt(BTN_BUILTIN), interruptHandler, RISING); } diff --git a/libraries/FreeRTOS/examples/Notifications/Notifications.ino b/libraries/FreeRTOS/examples/Notifications/Notifications.ino index 0a4f4b3..d18b1aa 100644 --- a/libraries/FreeRTOS/examples/Notifications/Notifications.ino +++ b/libraries/FreeRTOS/examples/Notifications/Notifications.ino @@ -13,9 +13,6 @@ TaskHandle_t taskNotificationHandler; void setup() { - // Configure pin 2 as an input and enable the internal pull-up resistor. - pinMode(2, INPUT_PULLUP); - // Create task for FreeRTOS notification xTaskCreate(TaskNotification, // Task function "Notification", // Task name @@ -36,11 +33,11 @@ void TaskNotification(void *pvParameters) { (void) pvParameters; - int digitalPin = 2; + int digitalPin = BTN_BUILTIN; Serial.begin(9600); - attachInterrupt(digitalPinToInterrupt(digitalPin), digitalPinInterruptHandler, LOW); + attachInterrupt(digitalPinToInterrupt(digitalPin), digitalPinInterruptHandler, RISING); for (;;) { @@ -55,7 +52,6 @@ void TaskNotification(void *pvParameters) void digitalPinInterruptHandler() { BaseType_t xHigherPriorityTaskWoken = pdFALSE; vTaskNotifyGiveFromISR(taskNotificationHandler, &xHigherPriorityTaskWoken); - if (xHigherPriorityTaskWoken) { - taskYIELD(); - } + portYIELD_FROM_ISR(xHigherPriorityTaskWoken); + }