ch32v: Revamp the board-level usart setup design - #1021
Open
Grazfather wants to merge 2 commits into
Open
Conversation
mattnite
reviewed
Aug 30, 2026
| @compileError("board does not provide a default uart_setup"); | ||
|
|
||
| /// Apply 'setup' and 'config' | ||
| pub fn setup(comptime self: UartSetup, comptime config: Config) void { |
Contributor
There was a problem hiding this comment.
Should this be "apply" then? I like the distinction of setup vs config, but "apply up the setup and config" makes more sense than "setup the setup and config"
Contributor
There was a problem hiding this comment.
I agree apply is a better name
Other than that, looks good to me
Collaborator
Author
There was a problem hiding this comment.
I should have thought of that! The convo mentioned setup and I didn't think beyond that :)
Grazfather
commented
Aug 30, 2026
| pub const uart_config: ch32v.usart.UartConfig = .{}; | ||
| pub const uart_setup: ch32v.usart.UartSetup = .{ | ||
| .instance = .USART1, | ||
| .tx_pin = ch32v.gpio.Pin.init(0, 9), // PA9 |
Collaborator
Author
There was a problem hiding this comment.
will make this optional, support rx_pin, but I don't have access to hardware to test the rx functionality.
Contributor
There was a problem hiding this comment.
Okay let me know once that's tested and we'll merge.
Following up on discussion on discord, addressing some concerns. 1. 'Config' vs. 'Setup' 2. Stuff like baud should not be in the board file. It is an 'application level' configuration. 3. The setup function is clunky. Put it into a method. 4. The `@hasDecl` is clunky. Move it into the method.
mattnite
force-pushed
the
ch32_uart_2
branch
from
September 2, 2026 18:29
70caa3c to
e7dbe15
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following up on discussion on discord, addressing some concerns.
@hasDeclis clunky. Move it into the method.