diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-10-06 23:56:00 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-06 23:56:00 +0000 |
| commit | 9c6a2d9cbdc22aa82b3fd26f42eb2b37c919fef4 (patch) | |
| tree | 44fc4692b9fa3491b923840bf7c9c3c33212d4fe /tests | |
| parent | 3bf8e4de5ffba9428752835b45a546a8e420a288 (diff) | |
| parent | b67b179933806f270465dcf5f246c605eba15dd9 (diff) | |
Merge pull request #1880 from phire/rp_bootsel
rp2040: BOOTSEL button support
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/rp/src/bin/bootsel.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/rp/src/bin/bootsel.rs b/tests/rp/src/bin/bootsel.rs new file mode 100644 index 000000000..df1ed8d2e --- /dev/null +++ b/tests/rp/src/bin/bootsel.rs | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | teleprobe_meta::target!(b"rpi-pico"); | ||
| 5 | |||
| 6 | use defmt::{assert_eq, *}; | ||
| 7 | use embassy_executor::Spawner; | ||
| 8 | use embassy_time::{Duration, Timer}; | ||
| 9 | use {defmt_rtt as _, panic_probe as _}; | ||
| 10 | |||
| 11 | #[embassy_executor::main] | ||
| 12 | async fn main(_spawner: Spawner) { | ||
| 13 | let mut p = embassy_rp::init(Default::default()); | ||
| 14 | info!("Hello World!"); | ||
| 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(Duration::from_millis(10)).await; | ||
| 21 | |||
| 22 | assert_eq!(p.BOOTSEL.is_pressed(), false); | ||
| 23 | |||
| 24 | info!("Test OK"); | ||
| 25 | cortex_m::asm::bkpt(); | ||
| 26 | } | ||
