Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplifies conditional compilation in the Stm32Uart driver. #812

Merged
merged 7 commits into from
Jan 20, 2025

Conversation

balazsracz
Copy link
Collaborator

@balazsracz balazsracz commented Jan 18, 2025

Simplifies code by reducing the number of places where we need large sequences of ifdef conditionals.
Removes all negative ifdefs.
Removes interrupt handlers defined by the driver.cxx in favor of the interrupt handlers in HwInit.
Removes static interrupt handler; the interrupt handler goes now directly through the object declared in HwInit.

Fixes bug where the shared interrupt enable count was instance local insted of a static variable.

Removes interrupt handlers defined by the driver.cxx in favor of the
interrupt handlers in HwInit.
@balazsracz balazsracz requested a review from bakerstu January 18, 2025 21:12
Copy link
Owner

@bakerstu bakerstu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, but I actually suggest a slight tweak of this solution. I would get rid of the "instance" array altogether. The primary reason it existed was to not propagate dependencies between HwInit.cxx and the driver. We've thrown that out the window now, so I would rather have this pattern in HwInit.cxx:

Stm32Uart uart0(...);

uart1_interrupt_handler(void)
{
    uart0.interrupt_handler();
}

@balazsracz
Copy link
Collaborator Author

This works, but I actually suggest a slight tweak of this solution. I would get rid of the "instance" array altogether. The primary reason it existed was to not propagate dependencies between HwInit.cxx and the driver. We've thrown that out the window now, so I would rather have this pattern in HwInit.cxx:

Stm32Uart uart0(...);

uart1_interrupt_handler(void)
{
    uart0.interrupt_handler();
}

That's a good idea. Let me do that.

@balazsracz balazsracz merged commit 85d1e27 into master Jan 20, 2025
4 checks passed
@balazsracz balazsracz deleted the bracz-stm32-uart-cleanup branch January 20, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants