rp-rs / rp2040-pac

A Rust PAC for the RP2040 Microcontroller
142 stars 28 forks source link

Add VSEL_A, enum for setting on-chip voltage regulator voltage #89

Closed AkiyukiOkayasu closed 8 months ago

AkiyukiOkayasu commented 8 months ago

The increase in core voltage is mainly used for overclocking. At first I sent a PR https://github.com/rp-rs/rp-hal/pull/757 to rp-hal, but on @ithinuel's advice I decided to contribute to the PAC first.

This allows the voltage to be set in this way.
pac.VREG_AND_CHIP_RESET.write(|w| w.vsel.variant(VSEL_A::VOLTAGE1_20));

Previously, unsafe was required :( pac.VREG_AND_CHIP_RESET.write(|w| unsafe { w.vsel().bits(12u8) });