diff options
| author | 1-rafael-1 <[email protected]> | 2025-05-01 18:38:03 +0200 |
|---|---|---|
| committer | 1-rafael-1 <[email protected]> | 2025-05-01 18:38:03 +0200 |
| commit | 7fa59a6b31c7c9744e5cdef3826bc4e726736606 (patch) | |
| tree | 12e8a9531afc831ed30b9a10eac1edca861a6110 /tests | |
| parent | 3c559378a5f3662134cb7db2d902302d7cb8f937 (diff) | |
Refactor overclock test for RP2040: add unused imports conditionally and ensure placeholder main function for non-RP2040 targets
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/rp/src/bin/overclock.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/rp/src/bin/overclock.rs b/tests/rp/src/bin/overclock.rs index c7b9180a0..c4393dde4 100644 --- a/tests/rp/src/bin/overclock.rs +++ b/tests/rp/src/bin/overclock.rs | |||
| @@ -1,14 +1,23 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![cfg_attr(not(feature = "rp2040"), allow(unused_imports))] | ||
| 4 | |||
| 3 | #[cfg(feature = "rp2040")] | 5 | #[cfg(feature = "rp2040")] |
| 4 | teleprobe_meta::target!(b"rpi-pico"); | 6 | teleprobe_meta::target!(b"rpi-pico"); |
| 5 | 7 | ||
| 8 | #[cfg(feature = "rp2040")] | ||
| 6 | use defmt::{assert, assert_eq, info}; | 9 | use defmt::{assert, assert_eq, info}; |
| 10 | #[cfg(feature = "rp2040")] | ||
| 7 | use embassy_executor::Spawner; | 11 | use embassy_executor::Spawner; |
| 12 | #[cfg(feature = "rp2040")] | ||
| 8 | use embassy_rp::config::Config; | 13 | use embassy_rp::config::Config; |
| 14 | #[cfg(feature = "rp2040")] | ||
| 9 | use embassy_rp::gpio::{Input, Pull}; | 15 | use embassy_rp::gpio::{Input, Pull}; |
| 16 | #[cfg(feature = "rp2040")] | ||
| 10 | use embassy_rp::pwm::{Config as PwmConfig, Pwm}; | 17 | use embassy_rp::pwm::{Config as PwmConfig, Pwm}; |
| 18 | #[cfg(feature = "rp2040")] | ||
| 11 | use embassy_time::{Instant, Timer}; | 19 | use embassy_time::{Instant, Timer}; |
| 20 | #[cfg(feature = "rp2040")] | ||
| 12 | use {defmt_rtt as _, panic_probe as _}; | 21 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 22 | ||
| 14 | #[cfg(feature = "rp2040")] | 23 | #[cfg(feature = "rp2040")] |
| @@ -60,3 +69,11 @@ async fn main(_spawner: Spawner) { | |||
| 60 | info!("Overclock test successful"); | 69 | info!("Overclock test successful"); |
| 61 | cortex_m::asm::bkpt(); | 70 | cortex_m::asm::bkpt(); |
| 62 | } | 71 | } |
| 72 | |||
| 73 | #[cfg(not(feature = "rp2040"))] | ||
| 74 | #[embassy_executor::main] | ||
| 75 | async fn main(_spawner: embassy_executor::Spawner) { | ||
| 76 | // This is an empty placeholder main function for non-RP2040 targets | ||
| 77 | // It should never be called since the test only runs on RP2040 | ||
| 78 | cortex_m::asm::bkpt(); | ||
| 79 | } | ||
