/*
 * EXTIHandler_STM32.hpp
 *
 *  Created on: Apr 20, 2024
 *      Author: Gabriel
 */

#ifndef SRC_COMPONENTS_EXTIHANDLER_STM32_HPP_
#define SRC_COMPONENTS_EXTIHANDLER_STM32_HPP_

#include "main.h"
#include "GPIO_Pin_STM32.hpp"

class EXTIHandler_STM32 {
public:
	EXTIHandler_STM32();
	virtual ~EXTIHandler_STM32();
	static void EXTI_Callback(uint16_t GPIO_Pin);
protected:
	int32_t registerCallback(GPIO_Pin_STM32* pin);
	int32_t deregisterCallback(GPIO_Pin_STM32* pin);
private:
	virtual void irqHandler(void* parameter) = 0;
	static int8_t gpioPinToPinNumber(uint16_t GPIO_Pin);
	static inline EXTIHandler_STM32* objects[15];
	void* _parameter =  nullptr;
};

#endif /* SRC_COMPONENTS_EXTIHANDLER_STM32_HPP_ */
