format services/ticktimer-test-client

This commit is contained in:
bunnie 2024-01-14 22:46:17 +08:00
parent a8bd47cc51
commit a4d3f8bc5e

View file

@ -1,29 +1,30 @@
#![cfg_attr(target_os = "none", no_std)] #![cfg_attr(target_os = "none", no_std)]
#![cfg_attr(target_os = "none", no_main)] #![cfg_attr(target_os = "none", no_main)]
use log::info;
use std::thread::sleep; use std::thread::sleep;
use std::time::Duration; use std::time::Duration;
use log::info;
fn main() -> ! { fn main() -> ! {
log_server::init_wait().unwrap(); log_server::init_wait().unwrap();
log::set_max_level(log::LevelFilter::Trace); log::set_max_level(log::LevelFilter::Trace);
info!("my PID is {}", xous::process::id()); info!("my PID is {}", xous::process::id());
#[cfg(feature="susres-testing")] #[cfg(feature = "susres-testing")]
const DELAY_MS: u64 = 2000; const DELAY_MS: u64 = 2000;
#[cfg(not(feature="susres-testing"))] #[cfg(not(feature = "susres-testing"))]
const DELAY_MS: u64 = 5000; const DELAY_MS: u64 = 5000;
#[cfg(feature="susres-testing")] #[cfg(feature = "susres-testing")]
let xns = xous_names::XousNames::new().unwrap(); let xns = xous_names::XousNames::new().unwrap();
#[cfg(feature="susres-testing")] #[cfg(feature = "susres-testing")]
let susres = susres::Susres::new_without_hook(&xns).unwrap(); let susres = susres::Susres::new_without_hook(&xns).unwrap();
for i in 0.. { for i in 0.. {
info!("Loop #{}, waiting {} ms", i, DELAY_MS); info!("Loop #{}, waiting {} ms", i, DELAY_MS);
sleep(Duration::from_millis(DELAY_MS)); sleep(Duration::from_millis(DELAY_MS));
#[cfg(feature="susres-testing")] #[cfg(feature = "susres-testing")]
{ {
info!("initiate suspend"); info!("initiate suspend");
susres.initiate_suspend().unwrap(); susres.initiate_suspend().unwrap();