Closed suikan4github closed 4 years ago
Hi Suikan4GitHub,
First of all, thank you for asking the question.
Actually, the EXTI enabling and disabling are handled at HAL_GPIO_Init() and HAL_GPIO_DeInit() levels respectively. I hope you find in the explanations below a satisfying answer to your question.
As for the EXTI enabling, let's examine the GPIO_EXTI example:
With regards,
HI ALABSTM
Thank you very much for your explanation.
I still have difficulties to use the HAL_GPIO_Init() and HAL_GPIO_DeInit() as enable / disable the EXTI. The problem is the GPIO_Init parameter of the HAL_GPIO_Init(). This parameter is made by CubeIDE but discarded when the program returns from MX_GPIO_Init(). As a result, the application cannot use the initialization parameter ( Similar parameter exists for the other peripherals, as Init member variable of the peripheral handle ).
So, from the application point of view, explicit enable/disable API is explicit and useful.
Regards, Seiichi
Hi Seiichi,
I hope you are doing well. Depending on the use case you are thinking about, you point might be relevant. However, in this case, it is no more related to the firmware published within this repository. It is rather related to Cube MX or even way you think to design you application.
In both cases, please allow me to redirect you to the ST Community:
Anyway, about the "GPIO_InitStructure" declared locally, may I suggest something? I will use the GPIO_EXTI as example.
I hope this hint is helpful. Do not hesitate to visit the ST Community Forum. There, you will also find support and answers to your questions hopefully.
With regards,
Hi ALABSTM
Thank you for your kind reply. I will think of some other way to disable/enable interrupt.
Regards
The EXTI interrupt is caught by the HAL_GPIO_EXTI_Callback(). But there is not HAL_GPIO API to enable / disable EXTI.
This is not appropriate design. Some API to enable / disable EXTI for each line should be provided.