Begin functionality for EXTI callbacks

This commit is contained in:
2025-09-05 21:21:35 -07:00
parent 64fb4e4a23
commit 8b4402e4c8
6 changed files with 120 additions and 3 deletions

View File

@@ -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
}