Description
Is your feature request/improvement related to a problem? Please describe.
Attempts to make full use of timer features in applications (i.e brushless motor control) require direct access to Timer IRQ Handlers. Current design of HardwareTimer.cpp takes full control of Timer IRQ Handlers. No user level compile switch is available to turn off these features. Any attempts to define sketch level Timer IRQ Handlers generates multiple definition of `TIMx_IRQHandler' errors.
Describe the solution you'd like to see
Provide user level build_opt.h switches to turn off IRQ based HardwareTimer (and associated pin PWM) functionality for advanced user applications.
I've hacked a quick and dirty solution with a user flag in build_opt.h with #ifndef EXCLUDE_HARDWARE_TIMER_MODULE in HardwareTimer.cpp, analog.cpp and wiring_digital.c files to get rid of the multiple definition errors, but have not thoroughly tested yet. I basically replaced #ifdef HAL_TIM_MODULE_ENABLED with my #ifndef so that feature can be turned off while still leaving the HAL_TIM_MODULE enabled. From there I can implement TIMx_IRQ_Handler at the sketch level.
There may be undesirable side effects I am unaware of. I'm guessing there may be a better way.
STM32 Core Design Philosophy Proposal
STM32 peripherals have many powerful features. A design philosophy to be considered for this core would be that features that take over IRQ Handlers (TIM, I2C, etc.) to provide base functionality are on by default but can optionally be switched off by users looking to take full control of the peripheral at the sketch level to gain more advanced functionality. This should also include HAL_XXX_MspInit() functions used to initialize HAL low level hardware initialization (i.e. if MspInit functions are implemented in core library functions then they should also be switchable off by user defines).