diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-03-29 21:33:46 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-03-29 21:35:25 +0200 |
| commit | 403b308279fe626dee979fd780fab4380b82569f (patch) | |
| tree | 3f6f76f11bc5864554f1b173ce06aa9510b387d2 /embassy-rp-examples/src/example_common.rs | |
| parent | 5f6f1c38d925c4ddc1df31e00bb9038e1c1875bb (diff) | |
rp/gpio: implement Input
Diffstat (limited to 'embassy-rp-examples/src/example_common.rs')
| -rw-r--r-- | embassy-rp-examples/src/example_common.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/embassy-rp-examples/src/example_common.rs b/embassy-rp-examples/src/example_common.rs new file mode 100644 index 000000000..89f35736b --- /dev/null +++ b/embassy-rp-examples/src/example_common.rs | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | use core::sync::atomic::{AtomicUsize, Ordering}; | ||
| 2 | use defmt_rtt as _; | ||
| 3 | use panic_probe as _; | ||
| 4 | |||
| 5 | #[link_section = ".boot2"] | ||
| 6 | #[used] | ||
| 7 | pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER; | ||
| 8 | |||
| 9 | defmt::timestamp! {"{=u64}", { | ||
| 10 | static COUNT: AtomicUsize = AtomicUsize::new(0); | ||
| 11 | // NOTE(no-CAS) `timestamps` runs with interrupts disabled | ||
| 12 | let n = COUNT.load(Ordering::Relaxed); | ||
| 13 | COUNT.store(n + 1, Ordering::Relaxed); | ||
| 14 | n as u64 | ||
| 15 | } | ||
| 16 | } | ||
