diff options
| author | 1-rafael-1 <[email protected]> | 2025-05-02 23:51:28 +0200 |
|---|---|---|
| committer | 1-rafael-1 <[email protected]> | 2025-05-02 23:51:28 +0200 |
| commit | 3441e805070c7efb7cad20a84d1986e215b4de3d (patch) | |
| tree | 7bdc5ad9c015ad02e07ff45531b22095cabf2632 /examples/rp/src/bin/overclock.rs | |
| parent | a33e7172f6bf7dc9590432dd62c2b71d0215d99d (diff) | |
first batch of changes after review
Diffstat (limited to 'examples/rp/src/bin/overclock.rs')
| -rw-r--r-- | examples/rp/src/bin/overclock.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/rp/src/bin/overclock.rs b/examples/rp/src/bin/overclock.rs index e3ac77340..f9a8c94d0 100644 --- a/examples/rp/src/bin/overclock.rs +++ b/examples/rp/src/bin/overclock.rs | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | //! # Overclocking the RP2040 to 200 MHz | 1 | //! # Overclocking the RP2040 to 200 MHz |
| 2 | //! | 2 | //! |
| 3 | //! This example demonstrates how to configure the RP2040 to run at 200 MHz using a higher level API. | 3 | //! This example demonstrates how to configure the RP2040 to run at 200 MHz. |
| 4 | 4 | ||
| 5 | #![no_std] | 5 | #![no_std] |
| 6 | #![no_main] | 6 | #![no_main] |
| @@ -17,19 +17,18 @@ const COUNT_TO: i64 = 10_000_000; | |||
| 17 | 17 | ||
| 18 | #[embassy_executor::main] | 18 | #[embassy_executor::main] |
| 19 | async fn main(_spawner: Spawner) -> ! { | 19 | async fn main(_spawner: Spawner) -> ! { |
| 20 | // Set up for clock frequency of 200 MHz | 20 | // Set up for clock frequency of 200 MHz, setting all necessary defaults. |
| 21 | // This will set all the necessary defaults including slightly raised voltage | 21 | let config = Config::new(ClockConfig::crystal_freq(200_000_000)); |
| 22 | let config = Config::new(ClockConfig::at_sys_frequency_mhz(200)); | ||
| 23 | 22 | ||
| 24 | // Show the voltage scale for verification | 23 | // Show the voltage scale for verification |
| 25 | info!("System core voltage: {}", Debug2Format(&config.clocks.voltage_scale)); | 24 | info!("System core voltage: {}", Debug2Format(&config.clocks.core_voltage)); |
| 26 | 25 | ||
| 27 | // Initialize the peripherals | 26 | // Initialize the peripherals |
| 28 | let p = embassy_rp::init(config); | 27 | let p = embassy_rp::init(config); |
| 29 | 28 | ||
| 30 | // Show CPU frequency for verification | 29 | // Show CPU frequency for verification |
| 31 | let sys_freq = clk_sys_freq(); | 30 | let sys_freq = clk_sys_freq(); |
| 32 | info!("System clock frequency: {} Hz", sys_freq); | 31 | info!("System clock frequency: {} MHz", sys_freq / 1_000_000); |
| 33 | 32 | ||
| 34 | // LED to indicate the system is running | 33 | // LED to indicate the system is running |
| 35 | let mut led = Output::new(p.PIN_25, Level::Low); | 34 | let mut led = Output::new(p.PIN_25, Level::Low); |
