Добавлена поддержка FreeRTOS #16

Merged
klassents merged 23 commits from v0.5.0_FreeRTOS into v0.5.0 2025-03-28 06:37:51 +03:00
2 changed files with 5 additions and 12 deletions
Showing only changes of commit 6f84c00718 - Show all commits

View File

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

View File

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