Skip to content

Conversation

@unicab369
Copy link
Contributor

added lib_pvd that share code between the v00x to v30x.

added lib_pvd that share code between the v00x to v30x.

#include "ch32fun.h"

void PVD_init(u8 threshold) {
Copy link
Owner

Choose a reason for hiding this comment

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

These should be static.

}

// Get threshold setting: the PLS[1:0] bits
u8 PVD_getThreshold() {
Copy link
Owner

Choose a reason for hiding this comment

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

in general, make these ints so that the compiler doesn't do any extra masking.

Here, it's fine it's not a big deal, and the compiler will produce fine code, but in other cases it may not.

@cnlohr
Copy link
Owner

cnlohr commented Nov 21, 2025

@unicab369 I really like this, if you can address both comments, that would be great and then I can merge it.

@cnlohr
Copy link
Owner

cnlohr commented Nov 22, 2025

Looks good

@cnlohr cnlohr merged commit d3bc702 into cnlohr:master Nov 22, 2025
6 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.

2 participants