aboutsummaryrefslogtreecommitdiff
path: root/examples/rp235x/src/bin/gpout.rs
diff options
context:
space:
mode:
authorCurly <[email protected]>2025-02-23 07:33:58 -0800
committerCurly <[email protected]>2025-02-23 07:33:58 -0800
commit3932835998802fc3abf7cce4f736e072858ebfd1 (patch)
tree5dd714b99bc74a03556c58809237c88691c293bb /examples/rp235x/src/bin/gpout.rs
parentc3c67db93e627a4fafe5e1a1123e5cbb4abafe47 (diff)
rename `rp23` (?) folder to `rp235x`; fix `ci.sh` to use `rp235x` folder
Diffstat (limited to 'examples/rp235x/src/bin/gpout.rs')
-rw-r--r--examples/rp235x/src/bin/gpout.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/examples/rp235x/src/bin/gpout.rs b/examples/rp235x/src/bin/gpout.rs
new file mode 100644
index 000000000..011359253
--- /dev/null
+++ b/examples/rp235x/src/bin/gpout.rs
@@ -0,0 +1,37 @@
1//! This example shows how GPOUT (General purpose clock outputs) can toggle a output pin.
2//!
3//! The LED on the RP Pico W board is connected differently. Add a LED and resistor to another pin.
4
5#![no_std]
6#![no_main]
7
8use defmt::*;
9use embassy_executor::Spawner;
10use embassy_rp::clocks;
11use embassy_time::Timer;
12use {defmt_rtt as _, panic_probe as _};
13
14#[embassy_executor::main]
15async fn main(_spawner: Spawner) {
16 let p = embassy_rp::init(Default::default());
17
18 let gpout3 = clocks::Gpout::new(p.PIN_25);
19 gpout3.set_div(1000, 0);
20 gpout3.enable();
21
22 loop {
23 gpout3.set_src(clocks::GpoutSrc::Sys);
24 info!(
25 "Pin 25 is now outputing CLK_SYS/1000, should be toggling at {}",
26 gpout3.get_freq()
27 );
28 Timer::after_secs(2).await;
29
30 gpout3.set_src(clocks::GpoutSrc::Ref);
31 info!(
32 "Pin 25 is now outputing CLK_REF/1000, should be toggling at {}",
33 gpout3.get_freq()
34 );
35 Timer::after_secs(2).await;
36 }
37}