Files
F407-SX1280-FreeRTOS/Core/Src/Components/EXTIHandler.hpp

28 lines
717 B
C++

/*
* EXTIHandler.hpp
*
* Created on: Feb 24, 2024
* Author: gabriel
*/
#ifndef SRC_COMPONENTS_EXTIHANDLER_HPP_
#define SRC_COMPONENTS_EXTIHANDLER_HPP_
#include <inttypes.h>
#include "GPIO_Pin.hpp"
#include <functional>
class EXTIHandler {
public:
static EXTIHandler* getInstance(){return singletonPointer;};
virtual int32_t registerCallback(std::function<void(void*)> callbackFunction, void* argument, GPIO_Pin* irqPin) = 0;
virtual int32_t setCallbackEnabled(GPIO_Pin* irqPin, bool enabled) = 0;
protected:
std::function<void(void*)> functionArray[16];
void* argumentArray[16];
bool enabledArray[16];
inline static EXTIHandler* singletonPointer;
};
#endif /* SRC_COMPONENTS_EXTIHANDLER_HPP_ */