Refactor overclock test for RP2040: add unused imports conditionally and ensure placeholder main function for non-RP2040 targets

This commit is contained in:
1-rafael-1 2025-05-01 18:38:03 +02:00
parent 3c559378a5
commit 7fa59a6b31

View File

@ -1,14 +1,23 @@
#![no_std]
#![no_main]
#![cfg_attr(not(feature = "rp2040"), allow(unused_imports))]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp2040")]
use defmt::{assert, assert_eq, info};
#[cfg(feature = "rp2040")]
use embassy_executor::Spawner;
#[cfg(feature = "rp2040")]
use embassy_rp::config::Config;
#[cfg(feature = "rp2040")]
use embassy_rp::gpio::{Input, Pull};
#[cfg(feature = "rp2040")]
use embassy_rp::pwm::{Config as PwmConfig, Pwm};
#[cfg(feature = "rp2040")]
use embassy_time::{Instant, Timer};
#[cfg(feature = "rp2040")]
use {defmt_rtt as _, panic_probe as _};
#[cfg(feature = "rp2040")]
@ -60,3 +69,11 @@ async fn main(_spawner: Spawner) {
info!("Overclock test successful");
cortex_m::asm::bkpt();
}
#[cfg(not(feature = "rp2040"))]
#[embassy_executor::main]
async fn main(_spawner: embassy_executor::Spawner) {
// This is an empty placeholder main function for non-RP2040 targets
// It should never be called since the test only runs on RP2040
cortex_m::asm::bkpt();
}