Search code examples
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. So how can I re-enable the interrupt, use ICER,ISER or any other ways?


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);