diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-03-26 16:01:37 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-03-27 15:18:06 +0100 |
| commit | d41eeeae79388f219bf6a84e2f7bde9f6b532516 (patch) | |
| tree | 678b6fc732216e529dc38e6f65b72a309917ac32 /embassy-rp/src/bootsel.rs | |
| parent | 9edf5b7f049f95742b60b041e4443967d8a6b708 (diff) | |
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'embassy-rp/src/bootsel.rs')
| -rw-r--r-- | embassy-rp/src/bootsel.rs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/embassy-rp/src/bootsel.rs b/embassy-rp/src/bootsel.rs index d24ce7bd8..14f9e46aa 100644 --- a/embassy-rp/src/bootsel.rs +++ b/embassy-rp/src/bootsel.rs | |||
| @@ -8,20 +8,19 @@ | |||
| 8 | //! This module provides functionality to poll BOOTSEL from an embassy application. | 8 | //! This module provides functionality to poll BOOTSEL from an embassy application. |
| 9 | 9 | ||
| 10 | use crate::flash::in_ram; | 10 | use crate::flash::in_ram; |
| 11 | use crate::Peri; | ||
| 11 | 12 | ||
| 12 | impl crate::peripherals::BOOTSEL { | 13 | /// Reads the BOOTSEL button. Returns true if the button is pressed. |
| 13 | /// Polls the BOOTSEL button. Returns true if the button is pressed. | 14 | /// |
| 14 | /// | 15 | /// Reading isn't cheap, as this function waits for core 1 to finish it's current |
| 15 | /// Polling isn't cheap, as this function waits for core 1 to finish it's current | 16 | /// task and for any DMAs from flash to complete |
| 16 | /// task and for any DMAs from flash to complete | 17 | pub fn is_bootsel_pressed(_p: Peri<'_, crate::peripherals::BOOTSEL>) -> bool { |
| 17 | pub fn is_pressed(&mut self) -> bool { | 18 | let mut cs_status = Default::default(); |
| 18 | let mut cs_status = Default::default(); | ||
| 19 | 19 | ||
| 20 | unsafe { in_ram(|| cs_status = ram_helpers::read_cs_status()) }.expect("Must be called from Core 0"); | 20 | unsafe { in_ram(|| cs_status = ram_helpers::read_cs_status()) }.expect("Must be called from Core 0"); |
| 21 | 21 | ||
| 22 | // bootsel is active low, so invert | 22 | // bootsel is active low, so invert |
| 23 | !cs_status.infrompad() | 23 | !cs_status.infrompad() |
| 24 | } | ||
| 25 | } | 24 | } |
| 26 | 25 | ||
| 27 | mod ram_helpers { | 26 | mod ram_helpers { |
