diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-11-21 11:10:44 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-11-21 11:10:44 +0000 |
| commit | 920bb3690e33b864bde517233b58c999e69be0dc (patch) | |
| tree | 4575eede12c271a17d1977545e086cae3279d782 | |
| parent | 8d108d875394a08d6cb42d06a9c55a4c8e0833ac (diff) | |
| parent | d5a2462cbaa02b8a98f573a36bdcf22f6136ab1c (diff) | |
Merge #495
495: Fix missing lifetime bounds r=lulf a=ithinuel
Co-authored-by: Wilfried Chauveau <[email protected]>
| -rw-r--r-- | embassy-nrf/src/gpiote.rs | 16 | ||||
| -rw-r--r-- | embassy-stm32/src/exti.rs | 15 | ||||
| -rw-r--r-- | embassy-traits/src/delay.rs | 4 | ||||
| -rw-r--r-- | embassy-traits/src/gpio.rs | 20 | ||||
| -rw-r--r-- | embassy-traits/src/spi.rs | 9 |
5 files changed, 49 insertions, 15 deletions
diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs index ee638aeac..2e9a73564 100644 --- a/embassy-nrf/src/gpiote.rs +++ b/embassy-nrf/src/gpiote.rs | |||
| @@ -338,7 +338,10 @@ impl<'d, T: GpioPin> InputPin for PortInput<'d, T> { | |||
| 338 | } | 338 | } |
| 339 | 339 | ||
| 340 | impl<'d, T: GpioPin> WaitForHigh for PortInput<'d, T> { | 340 | impl<'d, T: GpioPin> WaitForHigh for PortInput<'d, T> { |
| 341 | type Future<'a> = PortInputFuture<'a>; | 341 | type Future<'a> |
| 342 | where | ||
| 343 | Self: 'a, | ||
| 344 | = PortInputFuture<'a>; | ||
| 342 | 345 | ||
| 343 | fn wait_for_high<'a>(&'a mut self) -> Self::Future<'a> { | 346 | fn wait_for_high<'a>(&'a mut self) -> Self::Future<'a> { |
| 344 | self.pin.pin.conf().modify(|_, w| w.sense().high()); | 347 | self.pin.pin.conf().modify(|_, w| w.sense().high()); |
| @@ -351,7 +354,10 @@ impl<'d, T: GpioPin> WaitForHigh for PortInput<'d, T> { | |||
| 351 | } | 354 | } |
| 352 | 355 | ||
| 353 | impl<'d, T: GpioPin> WaitForLow for PortInput<'d, T> { | 356 | impl<'d, T: GpioPin> WaitForLow for PortInput<'d, T> { |
| 354 | type Future<'a> = PortInputFuture<'a>; | 357 | type Future<'a> |
| 358 | where | ||
| 359 | Self: 'a, | ||
| 360 | = PortInputFuture<'a>; | ||
| 355 | 361 | ||
| 356 | fn wait_for_low<'a>(&'a mut self) -> Self::Future<'a> { | 362 | fn wait_for_low<'a>(&'a mut self) -> Self::Future<'a> { |
| 357 | self.pin.pin.conf().modify(|_, w| w.sense().low()); | 363 | self.pin.pin.conf().modify(|_, w| w.sense().low()); |
| @@ -364,7 +370,11 @@ impl<'d, T: GpioPin> WaitForLow for PortInput<'d, T> { | |||
| 364 | } | 370 | } |
| 365 | 371 | ||
| 366 | impl<'d, T: GpioPin> WaitForAnyEdge for PortInput<'d, T> { | 372 | impl<'d, T: GpioPin> WaitForAnyEdge for PortInput<'d, T> { |
| 367 | type Future<'a> = PortInputFuture<'a>; | 373 | type Future<'a> |
| 374 | where | ||
| 375 | Self: 'a, | ||
| 376 | = PortInputFuture<'a>; | ||
| 377 | |||
| 368 | fn wait_for_any_edge<'a>(&'a mut self) -> Self::Future<'a> { | 378 | fn wait_for_any_edge<'a>(&'a mut self) -> Self::Future<'a> { |
| 369 | if self.is_high().ok().unwrap() { | 379 | if self.is_high().ok().unwrap() { |
| 370 | self.pin.pin.conf().modify(|_, w| w.sense().low()); | 380 | self.pin.pin.conf().modify(|_, w| w.sense().low()); |
diff --git a/embassy-stm32/src/exti.rs b/embassy-stm32/src/exti.rs index d63af76be..5af51cd11 100644 --- a/embassy-stm32/src/exti.rs +++ b/embassy-stm32/src/exti.rs | |||
| @@ -109,7 +109,10 @@ impl<'d, T: GpioPin> InputPin for ExtiInput<'d, T> { | |||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | impl<'d, T: GpioPin> WaitForRisingEdge for ExtiInput<'d, T> { | 111 | impl<'d, T: GpioPin> WaitForRisingEdge for ExtiInput<'d, T> { |
| 112 | type Future<'a> = ExtiInputFuture<'a>; | 112 | type Future<'a> |
| 113 | where | ||
| 114 | Self: 'a, | ||
| 115 | = ExtiInputFuture<'a>; | ||
| 113 | 116 | ||
| 114 | fn wait_for_rising_edge<'a>(&'a mut self) -> Self::Future<'a> { | 117 | fn wait_for_rising_edge<'a>(&'a mut self) -> Self::Future<'a> { |
| 115 | ExtiInputFuture::new(self.pin.pin.pin(), self.pin.pin.port(), true, false) | 118 | ExtiInputFuture::new(self.pin.pin.pin(), self.pin.pin.port(), true, false) |
| @@ -117,7 +120,10 @@ impl<'d, T: GpioPin> WaitForRisingEdge for ExtiInput<'d, T> { | |||
| 117 | } | 120 | } |
| 118 | 121 | ||
| 119 | impl<'d, T: GpioPin> WaitForFallingEdge for ExtiInput<'d, T> { | 122 | impl<'d, T: GpioPin> WaitForFallingEdge for ExtiInput<'d, T> { |
| 120 | type Future<'a> = ExtiInputFuture<'a>; | 123 | type Future<'a> |
| 124 | where | ||
| 125 | Self: 'a, | ||
| 126 | = ExtiInputFuture<'a>; | ||
| 121 | 127 | ||
| 122 | fn wait_for_falling_edge<'a>(&'a mut self) -> Self::Future<'a> { | 128 | fn wait_for_falling_edge<'a>(&'a mut self) -> Self::Future<'a> { |
| 123 | ExtiInputFuture::new(self.pin.pin.pin(), self.pin.pin.port(), false, true) | 129 | ExtiInputFuture::new(self.pin.pin.pin(), self.pin.pin.port(), false, true) |
| @@ -125,7 +131,10 @@ impl<'d, T: GpioPin> WaitForFallingEdge for ExtiInput<'d, T> { | |||
| 125 | } | 131 | } |
| 126 | 132 | ||
| 127 | impl<'d, T: GpioPin> WaitForAnyEdge for ExtiInput<'d, T> { | 133 | impl<'d, T: GpioPin> WaitForAnyEdge for ExtiInput<'d, T> { |
| 128 | type Future<'a> = ExtiInputFuture<'a>; | 134 | type Future<'a> |
| 135 | where | ||
| 136 | Self: 'a, | ||
| 137 | = ExtiInputFuture<'a>; | ||
| 129 | 138 | ||
| 130 | fn wait_for_any_edge<'a>(&'a mut self) -> Self::Future<'a> { | 139 | fn wait_for_any_edge<'a>(&'a mut self) -> Self::Future<'a> { |
| 131 | ExtiInputFuture::new(self.pin.pin.pin(), self.pin.pin.port(), true, true) | 140 | ExtiInputFuture::new(self.pin.pin.pin(), self.pin.pin.port(), true, true) |
diff --git a/embassy-traits/src/delay.rs b/embassy-traits/src/delay.rs index caa0b100a..c4ef155ee 100644 --- a/embassy-traits/src/delay.rs +++ b/embassy-traits/src/delay.rs | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | use core::future::Future; | 1 | use core::future::Future; |
| 2 | 2 | ||
| 3 | pub trait Delay { | 3 | pub trait Delay { |
| 4 | type DelayFuture<'a>: Future<Output = ()> + 'a; | 4 | type DelayFuture<'a>: Future<Output = ()> + 'a |
| 5 | where | ||
| 6 | Self: 'a; | ||
| 5 | 7 | ||
| 6 | /// Future that completes after now + millis | 8 | /// Future that completes after now + millis |
| 7 | fn delay_ms(&mut self, millis: u64) -> Self::DelayFuture<'_>; | 9 | fn delay_ms(&mut self, millis: u64) -> Self::DelayFuture<'_>; |
diff --git a/embassy-traits/src/gpio.rs b/embassy-traits/src/gpio.rs index b8f31fc6c..3752c8d60 100644 --- a/embassy-traits/src/gpio.rs +++ b/embassy-traits/src/gpio.rs | |||
| @@ -2,7 +2,9 @@ use core::future::Future; | |||
| 2 | 2 | ||
| 3 | /// Wait for a pin to become high. | 3 | /// Wait for a pin to become high. |
| 4 | pub trait WaitForHigh { | 4 | pub trait WaitForHigh { |
| 5 | type Future<'a>: Future<Output = ()> + 'a; | 5 | type Future<'a>: Future<Output = ()> + 'a |
| 6 | where | ||
| 7 | Self: 'a; | ||
| 6 | 8 | ||
| 7 | /// Wait for a pin to become high. | 9 | /// Wait for a pin to become high. |
| 8 | /// | 10 | /// |
| @@ -13,7 +15,9 @@ pub trait WaitForHigh { | |||
| 13 | 15 | ||
| 14 | /// Wait for a pin to become low. | 16 | /// Wait for a pin to become low. |
| 15 | pub trait WaitForLow { | 17 | pub trait WaitForLow { |
| 16 | type Future<'a>: Future<Output = ()> + 'a; | 18 | type Future<'a>: Future<Output = ()> + 'a |
| 19 | where | ||
| 20 | Self: 'a; | ||
| 17 | 21 | ||
| 18 | /// Wait for a pin to become low. | 22 | /// Wait for a pin to become low. |
| 19 | /// | 23 | /// |
| @@ -24,7 +28,9 @@ pub trait WaitForLow { | |||
| 24 | 28 | ||
| 25 | /// Wait for a rising edge (transition from low to high) | 29 | /// Wait for a rising edge (transition from low to high) |
| 26 | pub trait WaitForRisingEdge { | 30 | pub trait WaitForRisingEdge { |
| 27 | type Future<'a>: Future<Output = ()> + 'a; | 31 | type Future<'a>: Future<Output = ()> + 'a |
| 32 | where | ||
| 33 | Self: 'a; | ||
| 28 | 34 | ||
| 29 | /// Wait for a rising edge (transition from low to high) | 35 | /// Wait for a rising edge (transition from low to high) |
| 30 | fn wait_for_rising_edge(&mut self) -> Self::Future<'_>; | 36 | fn wait_for_rising_edge(&mut self) -> Self::Future<'_>; |
| @@ -32,7 +38,9 @@ pub trait WaitForRisingEdge { | |||
| 32 | 38 | ||
| 33 | /// Wait for a falling edge (transition from high to low) | 39 | /// Wait for a falling edge (transition from high to low) |
| 34 | pub trait WaitForFallingEdge { | 40 | pub trait WaitForFallingEdge { |
| 35 | type Future<'a>: Future<Output = ()> + 'a; | 41 | type Future<'a>: Future<Output = ()> + 'a |
| 42 | where | ||
| 43 | Self: 'a; | ||
| 36 | 44 | ||
| 37 | /// Wait for a falling edge (transition from high to low) | 45 | /// Wait for a falling edge (transition from high to low) |
| 38 | fn wait_for_falling_edge(&'_ mut self) -> Self::Future<'_>; | 46 | fn wait_for_falling_edge(&'_ mut self) -> Self::Future<'_>; |
| @@ -40,7 +48,9 @@ pub trait WaitForFallingEdge { | |||
| 40 | 48 | ||
| 41 | /// Wait for any edge (any transition, high to low or low to high) | 49 | /// Wait for any edge (any transition, high to low or low to high) |
| 42 | pub trait WaitForAnyEdge { | 50 | pub trait WaitForAnyEdge { |
| 43 | type Future<'a>: Future<Output = ()> + 'a; | 51 | type Future<'a>: Future<Output = ()> + 'a |
| 52 | where | ||
| 53 | Self: 'a; | ||
| 44 | 54 | ||
| 45 | /// Wait for any edge (any transition, high to low or low to high) | 55 | /// Wait for any edge (any transition, high to low or low to high) |
| 46 | fn wait_for_any_edge(&mut self) -> Self::Future<'_>; | 56 | fn wait_for_any_edge(&mut self) -> Self::Future<'_>; |
diff --git a/embassy-traits/src/spi.rs b/embassy-traits/src/spi.rs index 04322dddc..14f79b059 100644 --- a/embassy-traits/src/spi.rs +++ b/embassy-traits/src/spi.rs | |||
| @@ -27,7 +27,8 @@ pub trait Spi<Word> { | |||
| 27 | pub trait FullDuplex<Word>: Spi<Word> + Write<Word> + Read<Word> { | 27 | pub trait FullDuplex<Word>: Spi<Word> + Write<Word> + Read<Word> { |
| 28 | type WriteReadFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a | 28 | type WriteReadFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a |
| 29 | where | 29 | where |
| 30 | Self: 'a; | 30 | Self: 'a, |
| 31 | Word: 'a; | ||
| 31 | 32 | ||
| 32 | /// The `read` array must be at least as long as the `write` array, | 33 | /// The `read` array must be at least as long as the `write` array, |
| 33 | /// but is guaranteed to only be filled with bytes equal to the | 34 | /// but is guaranteed to only be filled with bytes equal to the |
| @@ -42,7 +43,8 @@ pub trait FullDuplex<Word>: Spi<Word> + Write<Word> + Read<Word> { | |||
| 42 | pub trait Write<Word>: Spi<Word> { | 43 | pub trait Write<Word>: Spi<Word> { |
| 43 | type WriteFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a | 44 | type WriteFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a |
| 44 | where | 45 | where |
| 45 | Self: 'a; | 46 | Self: 'a, |
| 47 | Word: 'a; | ||
| 46 | 48 | ||
| 47 | fn write<'a>(&'a mut self, data: &'a [Word]) -> Self::WriteFuture<'a>; | 49 | fn write<'a>(&'a mut self, data: &'a [Word]) -> Self::WriteFuture<'a>; |
| 48 | } | 50 | } |
| @@ -50,7 +52,8 @@ pub trait Write<Word>: Spi<Word> { | |||
| 50 | pub trait Read<Word>: Write<Word> { | 52 | pub trait Read<Word>: Write<Word> { |
| 51 | type ReadFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a | 53 | type ReadFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a |
| 52 | where | 54 | where |
| 53 | Self: 'a; | 55 | Self: 'a, |
| 56 | Word: 'a; | ||
| 54 | 57 | ||
| 55 | fn read<'a>(&'a mut self, data: &'a mut [Word]) -> Self::ReadFuture<'a>; | 58 | fn read<'a>(&'a mut self, data: &'a mut [Word]) -> Self::ReadFuture<'a>; |
| 56 | } | 59 | } |
