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

Add 3.3V and 5V output control #72

Merged
merged 12 commits into from
Oct 3, 2024
Merged

Add 3.3V and 5V output control #72

merged 12 commits into from
Oct 3, 2024

Conversation

21km43
Copy link
Contributor

@21km43 21km43 commented Sep 28, 2024

I added these commands, and already tested on WCH-LinkE.

> wlink set-power --help 
Enable or disable power output

Usage: wlink set-power [OPTIONS] <COMMAND>

Commands:
  enable3v3   Enable 3.3V output
  disable3v3  Disable 3.3V output
  enable5v    Enable 5V output
  disable5v   Disable 5V output
  help        Print this message or the help of the given subcommand(s)

example

> wlink set-power enable3v3
13:31:46 [INFO] Connected to WCH-Link v2.12(v32) (WCH-LinkE-CH32V305)
13:31:46 [INFO] Enable 3.3V Output

> wlink set-power disable3v3
13:31:52 [INFO] Connected to WCH-Link v2.12(v32) (WCH-LinkE-CH32V305)
13:31:52 [INFO] Disable 3.3V Output

> wlink set-power enable5v
13:32:03 [INFO] Connected to WCH-Link v2.12(v32) (WCH-LinkE-CH32V305)
13:32:03 [INFO] Enable 5V Output

> wlink set-power disable5v
13:32:07 [INFO] Connected to WCH-Link v2.12(v32) (WCH-LinkE-CH32V305)
13:32:07 [INFO] Disable 5V Output

When merge this PR, I recommend that squash and merge.

@21km43
Copy link
Contributor Author

21km43 commented Sep 28, 2024

Debug done.
If someone have a idea of command fotmat, feel free to comment to this PR

@21km43 21km43 marked this pull request as ready for review September 28, 2024 14:45
src/main.rs Outdated
/// Enable 5V output
Enable5v {},
/// Disable 5V output
Disable5v {},
Copy link
Contributor

Choose a reason for hiding this comment

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

Better make them grouped into a SetPower(commands::SetPower) sub-command.

Copy link
Contributor Author

@21km43 21km43 Oct 2, 2024

Choose a reason for hiding this comment

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

Thank you for review.
I grouped them into sub-command.
Detail: 35b3713

Copy link
Contributor

@andelf andelf left a comment

Choose a reason for hiding this comment

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

Looks great! Approved.

@andelf andelf merged commit d3b3caa into ch32-rs:main Oct 3, 2024
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