aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/rp/src/bin/gpout.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/examples/rp/src/bin/gpout.rs b/examples/rp/src/bin/gpout.rs
new file mode 100644
index 000000000..236a653ac
--- /dev/null
+++ b/examples/rp/src/bin/gpout.rs
@@ -0,0 +1,34 @@
1#![no_std]
2#![no_main]
3#![feature(type_alias_impl_trait)]
4
5use defmt::*;
6use embassy_executor::Spawner;
7use embassy_rp::clocks;
8use embassy_time::{Duration, Timer};
9use {defmt_rtt as _, panic_probe as _};
10
11#[embassy_executor::main]
12async fn main(_spawner: Spawner) {
13 let p = embassy_rp::init(Default::default());
14
15 let gpout3 = clocks::Gpout::new(p.PIN_25);
16 gpout3.set_div(1000, 0);
17 gpout3.enable();
18
19 loop {
20 gpout3.set_src(clocks::GpoutSrc::CLK_SYS);
21 info!(
22 "Pin 25 is now outputing CLK_SYS/1000, should be toggling at {}",
23 gpout3.get_freq()
24 );
25 Timer::after(Duration::from_secs(2)).await;
26
27 gpout3.set_src(clocks::GpoutSrc::CLK_REF);
28 info!(
29 "Pin 25 is now outputing CLK_REF/1000, should be toggling at {}",
30 gpout3.get_freq()
31 );
32 Timer::after(Duration::from_secs(2)).await;
33 }
34}