Skip to content

Conversation

@Grazfather
Copy link
Collaborator

A lot of this functionality was informed by https://github.com/robinjanssens/WCH-Toolchain

Copy link
Contributor

@mattnite mattnite left a comment

Choose a reason for hiding this comment

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

Besides weighing in, looks good to me, pull the trigger when you're ready.

Damn that multi-second delay when typing comments.

@Grazfather
Copy link
Collaborator Author

Let me fix this up. Don't merge yet please

@Grazfather
Copy link
Collaborator Author

I bricked my board (doing something else). I have to wait for a new one to arrive to properly test everything

@Grazfather Grazfather force-pushed the wch_hals branch 3 times, most recently from 9a987ca to 6374220 Compare December 10, 2025 21:18
@Grazfather Grazfather marked this pull request as draft December 12, 2025 21:24
@Grazfather Grazfather changed the title ch32v: Add get_freqs, USART hal, I2C hal ch32v: Add I2C hal Dec 14, 2025
@Grazfather Grazfather force-pushed the wch_hals branch 3 times, most recently from b3b7bd3 to ed4bb8a Compare December 17, 2025 00:04
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

🔍 Lint Results

Found 1 issue on changed lines in 1 file:

  • port/wch/ch32v/src/hals/i2c.zig: 1 issue

@Grazfather Grazfather marked this pull request as ready for review January 2, 2026 14:48

pub fn main() !void {
// Board brings up clocks and time
microzig.board.init();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we should call this automatically in microzig_main as we do for hal.init?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The nordic examples also follow this pattern of calling it explicitly. Would you propose that we add a extra case with the order of app -> board -> hal?, or should hal and board both have a chance to get called.

We do board-specific here because some boards would have different clock config based on whether they have an external clock, but I think that at the moment all of the existing boards are simply configured to use the internal oscillator.

Copy link
Collaborator

Choose a reason for hiding this comment

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

app -> board -> hal

exactly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK. I can do that, but since it will affect other boards and I'd have to remove the explicit invocation in a bunch of examples I'll do it in another PR.

@github-actions github-actions bot dismissed their stale review January 2, 2026 15:23

Updating with new lint results

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

🔍 Lint Results

Found 6 issues on changed lines in 2 files:

  • port/wch/ch32v/src/hals/drivers.zig: 5 issues
  • port/wch/ch32v/src/hals/i2c.zig: 1 issue

Copy link
Contributor

@mattnite mattnite left a comment

Choose a reason for hiding this comment

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

He's back!

@mattnite mattnite merged commit ded1f1b into main Jan 2, 2026
52 checks passed
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.

4 participants