diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-12-21 09:31:23 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-12-21 09:31:23 +0000 |
| commit | 79cbad501c6e6166d0e53ab33b2401a674ee9f31 (patch) | |
| tree | f40189ea47351acc04ad0a616c316cf59ac02ebd /docs/modules/ROOT/examples/basic | |
| parent | fcb43caa36bcf2fb62ddd1c334c46bd6bc876a9e (diff) | |
| parent | 22bc1e4ae17fbc76442d4ee1375cf3a86e0b4757 (diff) | |
Merge #551
551: nrf/gpio: add infallible inherent methods, remove some duplication. r=Dirbaio a=Dirbaio
Add infallible inherent methods, so that users don't have to import a trait, or `.unwrap()`.
This implements Input and Output using FlexPin, to avoid some code duplication.
Co-authored-by: Dario Nieuwenhuis <[email protected]>
Diffstat (limited to 'docs/modules/ROOT/examples/basic')
| -rw-r--r-- | docs/modules/ROOT/examples/basic/src/main.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/docs/modules/ROOT/examples/basic/src/main.rs b/docs/modules/ROOT/examples/basic/src/main.rs index 2a9b1facc..8394f73b7 100644 --- a/docs/modules/ROOT/examples/basic/src/main.rs +++ b/docs/modules/ROOT/examples/basic/src/main.rs | |||
| @@ -14,14 +14,13 @@ use embassy_nrf::{ | |||
| 14 | peripherals::P0_13, | 14 | peripherals::P0_13, |
| 15 | Peripherals, | 15 | Peripherals, |
| 16 | }; | 16 | }; |
| 17 | use embedded_hal::digital::v2::OutputPin; | ||
| 18 | 17 | ||
| 19 | #[embassy::task] | 18 | #[embassy::task] |
| 20 | async fn blinker(mut led: Output<'static, P0_13>, interval: Duration) { | 19 | async fn blinker(mut led: Output<'static, P0_13>, interval: Duration) { |
| 21 | loop { | 20 | loop { |
| 22 | unwrap!(led.set_high()); | 21 | led.set_high(); |
| 23 | Timer::after(interval).await; | 22 | Timer::after(interval).await; |
| 24 | unwrap!(led.set_low()); | 23 | led.set_low(); |
| 25 | Timer::after(interval).await; | 24 | Timer::after(interval).await; |
| 26 | } | 25 | } |
| 27 | } | 26 | } |
