изменила форматирование. Добавила автовыбор ножек в зависимости от выбранной платы

This commit is contained in:
klassents committed 2025-03-27 13:55:05 +07:00
1 parent 78ef98a74d
commit f3df27f5fc
12 files changed
+261 -268

No files matched your search

@@ -11,15 +11,23 @@
*/
TaskHandle_t taskNotificationHandler;
void setup() {
// set interrupt pin
#ifdef BTN_BUILTIN
uint8_t int_pin = BTN_BUILTIN;
#elif defined(ARDUINO_ELSOMIK)
uint8_t int_pin = P0_8;
#else
uint8_t int_pin = 2;
#endif
void setup() {
// Create task for FreeRTOS notification
xTaskCreate(TaskNotification, // Task function
"Notification", // Task name
128, // Stack size
xTaskCreate(TaskNotification, // Task function
"Notification", // Task name
128, // Stack size
NULL,
3, // Priority
&taskNotificationHandler ); // TaskHandle
3, // Priority
&taskNotificationHandler); // TaskHandle
}
void loop() {
@@ -33,18 +41,15 @@ void TaskNotification(void *pvParameters)
{
(void) pvParameters;
int digitalPin = BTN_BUILTIN;
Serial.begin(9600);
attachInterrupt(digitalPinToInterrupt(digitalPin), digitalPinInterruptHandler, RISING);
attachInterrupt(digitalPinToInterrupt(int_pin), digitalPinInterruptHandler, RISING);
for (;;) {
if (ulTaskNotifyTake(pdTRUE, portMAX_DELAY)) {
Serial.println("Notification received");
}
}
}
@@ -53,5 +58,4 @@ void digitalPinInterruptHandler() {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
vTaskNotifyGiveFromISR(taskNotificationHandler, &xHigherPriorityTaskWoken);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}