исправлены ошибки
This commit is contained in:
parent
42e9becdb9
commit
6f84c00718
@ -18,9 +18,6 @@ SemaphoreHandle_t interruptSemaphore;
|
|||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
||||||
// Configure pin 2 as an input and enable the internal pull-up resistor
|
|
||||||
pinMode(2, INPUT_PULLUP);
|
|
||||||
|
|
||||||
// Create task for Arduino led
|
// Create task for Arduino led
|
||||||
xTaskCreate(TaskLed, // Task function
|
xTaskCreate(TaskLed, // Task function
|
||||||
"Led", // Task name
|
"Led", // Task name
|
||||||
@ -36,7 +33,7 @@ void setup() {
|
|||||||
interruptSemaphore = xSemaphoreCreateBinary();
|
interruptSemaphore = xSemaphoreCreateBinary();
|
||||||
if (interruptSemaphore != NULL) {
|
if (interruptSemaphore != NULL) {
|
||||||
// Attach interrupt for Arduino digital pin
|
// Attach interrupt for Arduino digital pin
|
||||||
attachInterrupt(digitalPinToInterrupt(2), interruptHandler, LOW);
|
attachInterrupt(digitalPinToInterrupt(BTN_BUILTIN), interruptHandler, RISING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -13,9 +13,6 @@ TaskHandle_t taskNotificationHandler;
|
|||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
||||||
// Configure pin 2 as an input and enable the internal pull-up resistor.
|
|
||||||
pinMode(2, INPUT_PULLUP);
|
|
||||||
|
|
||||||
// Create task for FreeRTOS notification
|
// Create task for FreeRTOS notification
|
||||||
xTaskCreate(TaskNotification, // Task function
|
xTaskCreate(TaskNotification, // Task function
|
||||||
"Notification", // Task name
|
"Notification", // Task name
|
||||||
@ -36,11 +33,11 @@ void TaskNotification(void *pvParameters)
|
|||||||
{
|
{
|
||||||
(void) pvParameters;
|
(void) pvParameters;
|
||||||
|
|
||||||
int digitalPin = 2;
|
int digitalPin = BTN_BUILTIN;
|
||||||
|
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
attachInterrupt(digitalPinToInterrupt(digitalPin), digitalPinInterruptHandler, LOW);
|
attachInterrupt(digitalPinToInterrupt(digitalPin), digitalPinInterruptHandler, RISING);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
||||||
@ -55,7 +52,6 @@ void TaskNotification(void *pvParameters)
|
|||||||
void digitalPinInterruptHandler() {
|
void digitalPinInterruptHandler() {
|
||||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||||
vTaskNotifyGiveFromISR(taskNotificationHandler, &xHigherPriorityTaskWoken);
|
vTaskNotifyGiveFromISR(taskNotificationHandler, &xHigherPriorityTaskWoken);
|
||||||
if (xHigherPriorityTaskWoken) {
|
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||||
taskYIELD();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user