embeddedstm32microcontroller

How can I re-enable the STM32F103's external interrupt after I disable it?


I use

NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE;
NVIC_Init(&NVIC_InitStructure);

to enable the interrupt and then use

NVIC_InitStructure.NVIC_IRQChannelCmd=DISABLE;
NVIC_Init(&NVIC_InitStructure);

to disable it. How can I re-enable the interrupt, use ICER,ISER or another way?


Solution

  • To enable and disable interrupts in NVIC, just use the relevant CMSIS functions:

    void NVIC_EnableIRQ(IRQn_Type IRQn);
    void NVIC_DisableIRQ(IRQn_Type IRQn);