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); + }