mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
EXTI - Ensure the exti line is disabled and pending bit cleared for all
MCUs. Prior to this commit there was no equivalent to EXTI_ClearITPendingBit for H7.
This commit is contained in:
parent
d0de9ac1f8
commit
c8ade4ee07
1 changed files with 2 additions and 4 deletions
|
@ -131,6 +131,8 @@ void EXTIConfig(IO_t io, extiCallbackRec_t *cb, int irqPriority, ioConfig_t conf
|
||||||
extiChannelRec_t *rec = &extiChannelRecs[chIdx];
|
extiChannelRec_t *rec = &extiChannelRecs[chIdx];
|
||||||
rec->handler = cb;
|
rec->handler = cb;
|
||||||
|
|
||||||
|
EXTIDisable(io);
|
||||||
|
|
||||||
#if defined(STM32F7) || defined(STM32H7) || defined(STM32G4)
|
#if defined(STM32F7) || defined(STM32H7) || defined(STM32G4)
|
||||||
GPIO_InitTypeDef init = {
|
GPIO_InitTypeDef init = {
|
||||||
.Pin = IO_Pin(io),
|
.Pin = IO_Pin(io),
|
||||||
|
@ -140,7 +142,6 @@ void EXTIConfig(IO_t io, extiCallbackRec_t *cb, int irqPriority, ioConfig_t conf
|
||||||
};
|
};
|
||||||
HAL_GPIO_Init(IO_GPIO(io), &init);
|
HAL_GPIO_Init(IO_GPIO(io), &init);
|
||||||
|
|
||||||
|
|
||||||
if (extiGroupPriority[group] > irqPriority) {
|
if (extiGroupPriority[group] > irqPriority) {
|
||||||
extiGroupPriority[group] = irqPriority;
|
extiGroupPriority[group] = irqPriority;
|
||||||
HAL_NVIC_SetPriority(extiGroupIRQn[group], NVIC_PRIORITY_BASE(irqPriority), NVIC_PRIORITY_SUB(irqPriority));
|
HAL_NVIC_SetPriority(extiGroupIRQn[group], NVIC_PRIORITY_BASE(irqPriority), NVIC_PRIORITY_SUB(irqPriority));
|
||||||
|
@ -158,11 +159,8 @@ void EXTIConfig(IO_t io, extiCallbackRec_t *cb, int irqPriority, ioConfig_t conf
|
||||||
#else
|
#else
|
||||||
# warning "Unknown CPU"
|
# warning "Unknown CPU"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t extiLine = IO_EXTI_Line(io);
|
uint32_t extiLine = IO_EXTI_Line(io);
|
||||||
|
|
||||||
EXTI_ClearITPendingBit(extiLine);
|
|
||||||
|
|
||||||
EXTI_InitTypeDef EXTIInit;
|
EXTI_InitTypeDef EXTIInit;
|
||||||
EXTIInit.EXTI_Line = extiLine;
|
EXTIInit.EXTI_Line = extiLine;
|
||||||
EXTIInit.EXTI_Mode = EXTI_Mode_Interrupt;
|
EXTIInit.EXTI_Mode = EXTI_Mode_Interrupt;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue