By default subpriorities are not used and are almost useless anyway. Therefore they are not recommended. And, when subpriorities are not used, NVIC_SetPriority() doesn't need any bit shifting. As often, in real life usage ST's code is practically almost useless.
Many thanks, I will read, today , in Italy, is a holiday ... However, I had other unclear news: while traveling the web I found an email from 2020 that where a possible error is reported in the HAL_EXTI_xxxx:
I rewrote the code for a STM32F4 and in fact a perennial interrupt is generated. The question is now more general: when to use and why the HAL_NVIC_***, and when to use the HAL_EXTI_***? I have been using the HAL_NVIC_*** for a couple of years and have had no problems. I wanted to try the generation of software interrupts and I wanted to try the HAL_EXTI_*** (there is a specific call), but they were born many issues: The documentation does not seem very accurate, for example in the document UM1725-2021 on page 346, point 25.1.2 is written: "The Exti GPIO multiplexer selection to be configured. This parameter is only possible for line 0 to 15. It can be a value of EXTI_GPIOSel " Does it mean that I can activate at some time, for example PA0 and at another time PB0? It is not clear to me ... I have to do other tests or look for clearer documents. LV