aboutsummaryrefslogtreecommitdiff
path: root/examples/rp235x/src/bin/otp.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/otp.rs
parentc3c67db93e627a4fafe5e1a1123e5cbb4abafe47 (diff)
rename `rp23` (?) folder to `rp235x`; fix `ci.sh` to use `rp235x` folder
Diffstat (limited to 'examples/rp235x/src/bin/otp.rs')
-rw-r--r--examples/rp235x/src/bin/otp.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/rp235x/src/bin/otp.rs b/examples/rp235x/src/bin/otp.rs
new file mode 100644
index 000000000..5ffbb7610
--- /dev/null
+++ b/examples/rp235x/src/bin/otp.rs
@@ -0,0 +1,31 @@
1//! This example shows reading the OTP constants on the RP235x.
2
3#![no_std]
4#![no_main]
5
6use defmt::*;
7use embassy_executor::Spawner;
8use embassy_rp::otp;
9use embassy_time::Timer;
10use {defmt_rtt as _, panic_probe as _};
11
12#[embassy_executor::main]
13async fn main(_spawner: Spawner) {
14 let _ = embassy_rp::init(Default::default());
15 //
16 // add some delay to give an attached debug probe time to parse the
17 // defmt RTT header. Reading that header might touch flash memory, which
18 // interferes with flash write operations.
19 // https://github.com/knurling-rs/defmt/pull/683
20 Timer::after_millis(10).await;
21
22 let chip_id = unwrap!(otp::get_chipid());
23 info!("Unique id:{:X}", chip_id);
24
25 let private_rand = unwrap!(otp::get_private_random_number());
26 info!("Private Rand:{:X}", private_rand);
27
28 loop {
29 Timer::after_secs(1).await;
30 }
31}