diff options
| author | Curly <[email protected]> | 2025-02-23 07:33:58 -0800 |
|---|---|---|
| committer | Curly <[email protected]> | 2025-02-23 07:33:58 -0800 |
| commit | 3932835998802fc3abf7cce4f736e072858ebfd1 (patch) | |
| tree | 5dd714b99bc74a03556c58809237c88691c293bb /examples/rp235x/src/bin/otp.rs | |
| parent | c3c67db93e627a4fafe5e1a1123e5cbb4abafe47 (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.rs | 31 |
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 | |||
| 6 | use defmt::*; | ||
| 7 | use embassy_executor::Spawner; | ||
| 8 | use embassy_rp::otp; | ||
| 9 | use embassy_time::Timer; | ||
| 10 | use {defmt_rtt as _, panic_probe as _}; | ||
| 11 | |||
| 12 | #[embassy_executor::main] | ||
| 13 | async 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 | } | ||
