diff options
| author | Caleb Jamison <[email protected]> | 2024-01-31 16:26:11 -0500 |
|---|---|---|
| committer | Caleb Jamison <[email protected]> | 2024-01-31 16:26:11 -0500 |
| commit | 8b7d85619537fc20ad7ad533433d84ba4975ddc4 (patch) | |
| tree | 9ec05b932f1bcfb9d4d4f768654637320bb87b44 /examples/rp | |
| parent | 1e698af05bc6e7e520d3f35ef661f34ea6ea359e (diff) | |
Rename timeout_at to with_deadline
Diffstat (limited to 'examples/rp')
| -rw-r--r-- | examples/rp/src/bin/debounce.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/rp/src/bin/debounce.rs b/examples/rp/src/bin/debounce.rs index bf1579091..0077f19fc 100644 --- a/examples/rp/src/bin/debounce.rs +++ b/examples/rp/src/bin/debounce.rs | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | use defmt::info; | 7 | use defmt::info; |
| 8 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
| 9 | use embassy_rp::gpio::{Input, Level, Pull}; | 9 | use embassy_rp::gpio::{Input, Level, Pull}; |
| 10 | use embassy_time::{timeout_at, Duration, Instant, Timer}; | 10 | use embassy_time::{with_deadline, Duration, Instant, Timer}; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | pub struct Debouncer<'a> { | 13 | pub struct Debouncer<'a> { |
| @@ -49,7 +49,7 @@ async fn main(_spawner: Spawner) { | |||
| 49 | let start = Instant::now(); | 49 | let start = Instant::now(); |
| 50 | info!("Button Press"); | 50 | info!("Button Press"); |
| 51 | 51 | ||
| 52 | match timeout_at(start + Duration::from_secs(1), btn.debounce()).await { | 52 | match with_deadline(start + Duration::from_secs(1), btn.debounce()).await { |
| 53 | // Button Released < 1s | 53 | // Button Released < 1s |
| 54 | Ok(_) => { | 54 | Ok(_) => { |
| 55 | info!("Button pressed for: {}ms", start.elapsed().as_millis()); | 55 | info!("Button pressed for: {}ms", start.elapsed().as_millis()); |
| @@ -61,7 +61,7 @@ async fn main(_spawner: Spawner) { | |||
| 61 | } | 61 | } |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | match timeout_at(start + Duration::from_secs(5), btn.debounce()).await { | 64 | match with_deadline(start + Duration::from_secs(5), btn.debounce()).await { |
| 65 | // Button released <5s | 65 | // Button released <5s |
| 66 | Ok(_) => { | 66 | Ok(_) => { |
| 67 | info!("Button pressed for: {}ms", start.elapsed().as_millis()); | 67 | info!("Button pressed for: {}ms", start.elapsed().as_millis()); |
