Begin functionality for EXTI callbacks
This commit is contained in:
@@ -72,4 +72,21 @@ GPIO& GPIOManager::get(GPIO_Key key, PinMode pinMode) {
|
||||
}
|
||||
|
||||
return m_gpios[gpioPort][gpioPin];
|
||||
}
|
||||
}
|
||||
|
||||
void GPIOManager::getInterruptGPIO(GPIO_Key key, TriggerMode mode, EXTICallback callback) {
|
||||
unsigned int gpioPort = getGPIOPortNumber(key);
|
||||
unsigned long gpioPin = getGPIORegister(key).global_offset; //Use existing structs to get offset
|
||||
|
||||
if (m_gpios[gpioPort][gpioPin].m_GPIO_KEY == GPIO_Key::INVALID){
|
||||
m_gpios[gpioPort][gpioPin] = GPIO(key,PinMode::INPUT_MODE); //Hardcode input mode for interrupt
|
||||
}
|
||||
|
||||
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGCOMPEN; //TODO check if this is different across STM32 models, enable EXT
|
||||
|
||||
SHAL_EXTIO_Register EXTILineEnable = getGPIOEXTICR(key);
|
||||
|
||||
*EXTILineEnable.EXT_ICR |= EXTILineEnable.mask; //Set bits to enable correct port on correct line
|
||||
|
||||
|
||||
}
|
||||
|
||||
35
SHAL/Src/Peripheral/SHAL_EXTI_CALLBACK.cpp
Normal file
35
SHAL/Src/Peripheral/SHAL_EXTI_CALLBACK.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Created by Luca on 9/3/2025.
|
||||
//
|
||||
|
||||
#include "SHAL_EXTI_CALLBACK.h"
|
||||
|
||||
#if defined(STM32F030x6)
|
||||
#elif defined(STM32F030x8)
|
||||
#elif defined(STM32F031x6)
|
||||
#elif defined(STM32F038xx)
|
||||
#elif defined(STM32F042x6)
|
||||
#elif defined(STM32F048xx)
|
||||
#elif defined(STM32F051x8)
|
||||
#elif defined(STM32F058xx)
|
||||
#elif defined(STM32F070x6)
|
||||
#elif defined(STM32F070xB)
|
||||
#elif defined(STM32F071xB)
|
||||
#elif defined(STM32F072xB)
|
||||
|
||||
DEFINE_MULTI_EXTI_IRQ(0,1);
|
||||
DEFINE_MULTI_EXTI_IRQ(2,3);
|
||||
DEFINE_MULTI_EXTI_IRQ(4,15);
|
||||
|
||||
#elif defined(STM32F078xx)
|
||||
#include "stm32f078xx.h"
|
||||
#elif defined(STM32F091xC)
|
||||
#include "stm32f091xc.h"
|
||||
#elif defined(STM32F098xx)
|
||||
#include "stm32f098xx.h"
|
||||
#elif defined(STM32F030xC)
|
||||
#include "stm32f030xc.h"
|
||||
#else
|
||||
#error "Please select first the target STM32F0xx device used in your application (in stm32f0xx.h file)"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user