Skip to content

Commit a382f7b

Browse files
committed
Properly turn FunctionalInterrupt into integral library
1 parent 73171c3 commit a382f7b

File tree

6 files changed

+30
-9
lines changed

6 files changed

+30
-9
lines changed

CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ set(LIBRARY_SRCS
4747
libraries/FFat/src/FFat.cpp
4848
libraries/FS/src/FS.cpp
4949
libraries/FS/src/vfs_api.cpp
50+
libraries/FunctionalInterrupt/src/FunctionalInterrupt.cpp
5051
libraries/HTTPClient/src/HTTPClient.cpp
5152
libraries/HTTPUpdate/src/HTTPUpdate.cpp
5253
libraries/NetBIOS/src/NetBIOS.cpp
@@ -187,6 +188,7 @@ set(COMPONENT_ADD_INCLUDEDIRS
187188
libraries/ESPmDNS/src
188189
libraries/FFat/src
189190
libraries/FS/src
191+
libraries/FunctionalInterrupt/src
190192
libraries/HTTPClient/src
191193
libraries/HTTPUpdate/src
192194
libraries/NetBIOS/src

libraries/ESP32/examples/GPIO/Functional/Functional.ino renamed to libraries/FunctionalInterrupt/examples/Functional/Functional.ino

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <Arduino.h>
2-
#include "Schedule.h"
3-
#include "FunctionalInterrupt.h"
2+
#include <FunctionalInterrupt.h>
43

54
#if defined(ESP32)
65
#define BUTTON1 16
@@ -18,12 +17,12 @@ class Button {
1817
Button(uint8_t reqPin) : PIN(reqPin) {
1918
pinMode(PIN, INPUT_PULLUP);
2019
// Arduino C API:
21-
attachInterruptArg(PIN, [](void* self) {
22-
static_cast<Button*>(self)->isr();
23-
}, this, FALLING); // works on ESP32; fails on ESP8266: "ISR not in IRAM"
20+
//attachInterruptArg(PIN, [](void* self) {
21+
// static_cast<Button*>(self)->isr();
22+
//}, this, FALLING); // works on ESP32; fails on ESP8266: "ISR not in IRAM"
2423
//attachInterruptArg(PIN, reinterpret_cast<void(*)(void*)>(&isr_static), this, FALLING); // works on ESP32; works on ESP8266
2524
// FunctionalInterrupts API:
26-
//attachInterrupt(PIN, [this]() { isr(); }, FALLING); // works on ESP32; works on ESP8266
25+
attachInterrupt(PIN, [this]() { isr(); }, FALLING); // works on ESP32; works on ESP8266
2726
//attachScheduledInterrupt(PIN, [this](InterruptInfo ii) { Serial.print("Pin "); Serial.println(ii.pin); isr(); }, FALLING); // works on ESP32; works on ESP8266
2827
};
2928
~Button() {
@@ -68,9 +67,6 @@ Button* button2;
6867

6968
void setup() {
7069
Serial.begin(115200);
71-
schedule_function([]() {
72-
Serial.println("Scheduled function");
73-
});
7470
Serial.println("FunctionalInterrupt test/example");
7571

7672
button1 = new Button(BUTTON1);
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#######################################
2+
# Datatypes (KEYWORD1)
3+
#######################################
4+
5+
FunctionalInterrupt KEYWORD1
6+
InterruptInfo KEYWORD1
7+
8+
#######################################
9+
# Methods and Functions (KEYWORD2)
10+
#######################################
11+
12+
attachInterrupt KEYWORD2
13+
attachScheduledInterrupt KEYWORD2
14+
detachFunctionalInterrupt KEYWORD2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name=FunctionalInterrupt
2+
version=1.0
3+
author=
4+
maintainer=
5+
sentence=
6+
paragraph=
7+
category=
8+
url=
9+
architectures=esp32

0 commit comments

Comments
 (0)