| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
I have accidentally added an extra commit (Merge branch 'stm32duino:main' into hal-irqhandler-flagdisabling) that i do not know how to remove. |
Sorry, something went wrong.
Hi @Santynolo |
Sorry, something went wrong.
|
I've updated your branch. Simply do a git fetch. |
Sorry, something went wrong.
|
Thanks. |
Sorry, something went wrong.
|
One issue is to disable some handler managing several U(S)ART. In that case you can't use Arduino part for all impacted one. |
Sorry, something went wrong.
|
That could be possible, but i think it would require a deeper integration into the Serial implementation that i'm not that familiar with, and a way to switch between calling HAL_USART_IRQHandler() or HAL_UART_IRQHandler() |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
This PR implements build flags for disabling IRQHandlers used in the uart.c file in the SrcWrapper/src/stm32 folder allowing the user to write and use their own implementations of different USARTx_IRQHandler definitions while keeping HardwareSerial functionality in other USART/UART peripherals.
New build flags
I propose implementing the following build flags:
A build flag for each IRQHandler.
Why
This change would allow using custom implementations of for example, the USART2 and USART3 peripherals in synchronous mode (using a clock signal), while leaving the USART1 interface or others as a HardwareSerial port for printing to a serial monitor, or for use by libraries that use the standard Print class for debugging.
Here's an example of a build flag (in platformio) and a standard USART3_IRQHandler user definition (that compiles).


This code compiles (and the USART3_IRQHandler triggers correctly) with no errors (that i know of), and allows using USART1 as the Serial port and printing with no issues.

This is my first PR, please suggest improvements.
Implementation
I have implemented this by surrounding all of the IRQHandlers defined in uart.c in #ifndef [FLAG]
NOTE that this can break or cause unexpected behaviour if this build flag is defined and the user attempts to use the corresponding HardwareSerial class. Trying to use HardwareSerial on the USART2 while the build flag HAL_DISABLE_USART2_IRQHANDLER is defined will cause crashes and other behaviour i'm sure (Have not attempted). So i would suggest warning about this on the Wiki if this PR is merged.
Fixes
Fixes #2899