exposing pac items kind of undermines the unstable-pac feature. directly exposing register structure is also pretty inconvenient since the clock switching code takes care of the src/aux difference in behavior, so a user needn't really be forced to write down decomposed register values.
35 lines
902 B
Rust
35 lines
902 B
Rust
#![no_std]
|
|
#![no_main]
|
|
#![feature(type_alias_impl_trait)]
|
|
|
|
use defmt::*;
|
|
use embassy_executor::Spawner;
|
|
use embassy_rp::clocks;
|
|
use embassy_time::{Duration, Timer};
|
|
use {defmt_rtt as _, panic_probe as _};
|
|
|
|
#[embassy_executor::main]
|
|
async fn main(_spawner: Spawner) {
|
|
let p = embassy_rp::init(Default::default());
|
|
|
|
let gpout3 = clocks::Gpout::new(p.PIN_25);
|
|
gpout3.set_div(1000, 0);
|
|
gpout3.enable();
|
|
|
|
loop {
|
|
gpout3.set_src(clocks::GpoutSrc::Sys);
|
|
info!(
|
|
"Pin 25 is now outputing CLK_SYS/1000, should be toggling at {}",
|
|
gpout3.get_freq()
|
|
);
|
|
Timer::after(Duration::from_secs(2)).await;
|
|
|
|
gpout3.set_src(clocks::GpoutSrc::Ref);
|
|
info!(
|
|
"Pin 25 is now outputing CLK_REF/1000, should be toggling at {}",
|
|
gpout3.get_freq()
|
|
);
|
|
Timer::after(Duration::from_secs(2)).await;
|
|
}
|
|
}
|