mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-13 02:22:55 +03:00
Scheduled Interrupt (#4609)
* Scheduled Interrupt * use capital letter for Schedule.h * Prevent memory leak when attach is called multiple times without detach * Add improved schedule_function * WIP : Integrate FunctionalInterrupt & ScheduledInterrupt * Fix travis error
This commit is contained in:
@ -4,12 +4,34 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <functional>
|
||||
#include <ScheduledFunctions.h>
|
||||
|
||||
extern "C" {
|
||||
#include "c_types.h"
|
||||
#include "ets_sys.h"
|
||||
}
|
||||
|
||||
// Structures for communication
|
||||
|
||||
struct InterruptInfo {
|
||||
uint8_t pin = 0;
|
||||
uint8_t value = 0;
|
||||
uint32_t micro = 0;
|
||||
};
|
||||
|
||||
struct FunctionInfo {
|
||||
std::function<void(void)> reqFunction = nullptr;
|
||||
std::function<void(InterruptInfo)> reqScheduledFunction = nullptr;
|
||||
};
|
||||
|
||||
struct ArgStructure {
|
||||
InterruptInfo* interruptInfo = nullptr;
|
||||
FunctionInfo* functionInfo = nullptr;
|
||||
};
|
||||
|
||||
static ScheduledFunctions* scheduledInterrupts;
|
||||
void attachInterrupt(uint8_t pin, std::function<void(void)> intRoutine, int mode);
|
||||
void attachScheduledInterrupt(uint8_t pin, std::function<void(InterruptInfo)> scheduledIntRoutine, int mode);
|
||||
|
||||
|
||||
#endif //INTERRUPTS_H
|
||||
|
Reference in New Issue
Block a user