Merge #495
495: Fix missing lifetime bounds r=lulf a=ithinuel Co-authored-by: Wilfried Chauveau <wilfried.chauveau@ithinuel.me>
This commit is contained in:
commit
920bb3690e
@ -338,7 +338,10 @@ impl<'d, T: GpioPin> InputPin for PortInput<'d, T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: GpioPin> WaitForHigh for PortInput<'d, T> {
|
impl<'d, T: GpioPin> WaitForHigh for PortInput<'d, T> {
|
||||||
type Future<'a> = PortInputFuture<'a>;
|
type Future<'a>
|
||||||
|
where
|
||||||
|
Self: 'a,
|
||||||
|
= PortInputFuture<'a>;
|
||||||
|
|
||||||
fn wait_for_high<'a>(&'a mut self) -> Self::Future<'a> {
|
fn wait_for_high<'a>(&'a mut self) -> Self::Future<'a> {
|
||||||
self.pin.pin.conf().modify(|_, w| w.sense().high());
|
self.pin.pin.conf().modify(|_, w| w.sense().high());
|
||||||
@ -351,7 +354,10 @@ impl<'d, T: GpioPin> WaitForHigh for PortInput<'d, T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: GpioPin> WaitForLow for PortInput<'d, T> {
|
impl<'d, T: GpioPin> WaitForLow for PortInput<'d, T> {
|
||||||
type Future<'a> = PortInputFuture<'a>;
|
type Future<'a>
|
||||||
|
where
|
||||||
|
Self: 'a,
|
||||||
|
= PortInputFuture<'a>;
|
||||||
|
|
||||||
fn wait_for_low<'a>(&'a mut self) -> Self::Future<'a> {
|
fn wait_for_low<'a>(&'a mut self) -> Self::Future<'a> {
|
||||||
self.pin.pin.conf().modify(|_, w| w.sense().low());
|
self.pin.pin.conf().modify(|_, w| w.sense().low());
|
||||||
@ -364,7 +370,11 @@ impl<'d, T: GpioPin> WaitForLow for PortInput<'d, T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: GpioPin> WaitForAnyEdge for PortInput<'d, T> {
|
impl<'d, T: GpioPin> WaitForAnyEdge for PortInput<'d, T> {
|
||||||
type Future<'a> = PortInputFuture<'a>;
|
type Future<'a>
|
||||||
|
where
|
||||||
|
Self: 'a,
|
||||||
|
= PortInputFuture<'a>;
|
||||||
|
|
||||||
fn wait_for_any_edge<'a>(&'a mut self) -> Self::Future<'a> {
|
fn wait_for_any_edge<'a>(&'a mut self) -> Self::Future<'a> {
|
||||||
if self.is_high().ok().unwrap() {
|
if self.is_high().ok().unwrap() {
|
||||||
self.pin.pin.conf().modify(|_, w| w.sense().low());
|
self.pin.pin.conf().modify(|_, w| w.sense().low());
|
||||||
|
@ -109,7 +109,10 @@ impl<'d, T: GpioPin> InputPin for ExtiInput<'d, T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: GpioPin> WaitForRisingEdge for ExtiInput<'d, T> {
|
impl<'d, T: GpioPin> WaitForRisingEdge for ExtiInput<'d, T> {
|
||||||
type Future<'a> = ExtiInputFuture<'a>;
|
type Future<'a>
|
||||||
|
where
|
||||||
|
Self: 'a,
|
||||||
|
= ExtiInputFuture<'a>;
|
||||||
|
|
||||||
fn wait_for_rising_edge<'a>(&'a mut self) -> Self::Future<'a> {
|
fn wait_for_rising_edge<'a>(&'a mut self) -> Self::Future<'a> {
|
||||||
ExtiInputFuture::new(self.pin.pin.pin(), self.pin.pin.port(), true, false)
|
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> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: GpioPin> WaitForFallingEdge for ExtiInput<'d, T> {
|
impl<'d, T: GpioPin> WaitForFallingEdge for ExtiInput<'d, T> {
|
||||||
type Future<'a> = ExtiInputFuture<'a>;
|
type Future<'a>
|
||||||
|
where
|
||||||
|
Self: 'a,
|
||||||
|
= ExtiInputFuture<'a>;
|
||||||
|
|
||||||
fn wait_for_falling_edge<'a>(&'a mut self) -> Self::Future<'a> {
|
fn wait_for_falling_edge<'a>(&'a mut self) -> Self::Future<'a> {
|
||||||
ExtiInputFuture::new(self.pin.pin.pin(), self.pin.pin.port(), false, true)
|
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> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, T: GpioPin> WaitForAnyEdge for ExtiInput<'d, T> {
|
impl<'d, T: GpioPin> WaitForAnyEdge for ExtiInput<'d, T> {
|
||||||
type Future<'a> = ExtiInputFuture<'a>;
|
type Future<'a>
|
||||||
|
where
|
||||||
|
Self: 'a,
|
||||||
|
= ExtiInputFuture<'a>;
|
||||||
|
|
||||||
fn wait_for_any_edge<'a>(&'a mut self) -> Self::Future<'a> {
|
fn wait_for_any_edge<'a>(&'a mut self) -> Self::Future<'a> {
|
||||||
ExtiInputFuture::new(self.pin.pin.pin(), self.pin.pin.port(), true, true)
|
ExtiInputFuture::new(self.pin.pin.pin(), self.pin.pin.port(), true, true)
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use core::future::Future;
|
use core::future::Future;
|
||||||
|
|
||||||
pub trait Delay {
|
pub trait Delay {
|
||||||
type DelayFuture<'a>: Future<Output = ()> + 'a;
|
type DelayFuture<'a>: Future<Output = ()> + 'a
|
||||||
|
where
|
||||||
|
Self: 'a;
|
||||||
|
|
||||||
/// Future that completes after now + millis
|
/// Future that completes after now + millis
|
||||||
fn delay_ms(&mut self, millis: u64) -> Self::DelayFuture<'_>;
|
fn delay_ms(&mut self, millis: u64) -> Self::DelayFuture<'_>;
|
||||||
|
@ -2,7 +2,9 @@ use core::future::Future;
|
|||||||
|
|
||||||
/// Wait for a pin to become high.
|
/// Wait for a pin to become high.
|
||||||
pub trait WaitForHigh {
|
pub trait WaitForHigh {
|
||||||
type Future<'a>: Future<Output = ()> + 'a;
|
type Future<'a>: Future<Output = ()> + 'a
|
||||||
|
where
|
||||||
|
Self: 'a;
|
||||||
|
|
||||||
/// Wait for a pin to become high.
|
/// Wait for a pin to become high.
|
||||||
///
|
///
|
||||||
@ -13,7 +15,9 @@ pub trait WaitForHigh {
|
|||||||
|
|
||||||
/// Wait for a pin to become low.
|
/// Wait for a pin to become low.
|
||||||
pub trait WaitForLow {
|
pub trait WaitForLow {
|
||||||
type Future<'a>: Future<Output = ()> + 'a;
|
type Future<'a>: Future<Output = ()> + 'a
|
||||||
|
where
|
||||||
|
Self: 'a;
|
||||||
|
|
||||||
/// Wait for a pin to become low.
|
/// Wait for a pin to become low.
|
||||||
///
|
///
|
||||||
@ -24,7 +28,9 @@ pub trait WaitForLow {
|
|||||||
|
|
||||||
/// Wait for a rising edge (transition from low to high)
|
/// Wait for a rising edge (transition from low to high)
|
||||||
pub trait WaitForRisingEdge {
|
pub trait WaitForRisingEdge {
|
||||||
type Future<'a>: Future<Output = ()> + 'a;
|
type Future<'a>: Future<Output = ()> + 'a
|
||||||
|
where
|
||||||
|
Self: 'a;
|
||||||
|
|
||||||
/// Wait for a rising edge (transition from low to high)
|
/// Wait for a rising edge (transition from low to high)
|
||||||
fn wait_for_rising_edge(&mut self) -> Self::Future<'_>;
|
fn wait_for_rising_edge(&mut self) -> Self::Future<'_>;
|
||||||
@ -32,7 +38,9 @@ pub trait WaitForRisingEdge {
|
|||||||
|
|
||||||
/// Wait for a falling edge (transition from high to low)
|
/// Wait for a falling edge (transition from high to low)
|
||||||
pub trait WaitForFallingEdge {
|
pub trait WaitForFallingEdge {
|
||||||
type Future<'a>: Future<Output = ()> + 'a;
|
type Future<'a>: Future<Output = ()> + 'a
|
||||||
|
where
|
||||||
|
Self: 'a;
|
||||||
|
|
||||||
/// Wait for a falling edge (transition from high to low)
|
/// Wait for a falling edge (transition from high to low)
|
||||||
fn wait_for_falling_edge(&'_ mut self) -> Self::Future<'_>;
|
fn wait_for_falling_edge(&'_ mut self) -> Self::Future<'_>;
|
||||||
@ -40,7 +48,9 @@ pub trait WaitForFallingEdge {
|
|||||||
|
|
||||||
/// Wait for any edge (any transition, high to low or low to high)
|
/// Wait for any edge (any transition, high to low or low to high)
|
||||||
pub trait WaitForAnyEdge {
|
pub trait WaitForAnyEdge {
|
||||||
type Future<'a>: Future<Output = ()> + 'a;
|
type Future<'a>: Future<Output = ()> + 'a
|
||||||
|
where
|
||||||
|
Self: 'a;
|
||||||
|
|
||||||
/// Wait for any edge (any transition, high to low or low to high)
|
/// Wait for any edge (any transition, high to low or low to high)
|
||||||
fn wait_for_any_edge(&mut self) -> Self::Future<'_>;
|
fn wait_for_any_edge(&mut self) -> Self::Future<'_>;
|
||||||
|
@ -27,7 +27,8 @@ pub trait Spi<Word> {
|
|||||||
pub trait FullDuplex<Word>: Spi<Word> + Write<Word> + Read<Word> {
|
pub trait FullDuplex<Word>: Spi<Word> + Write<Word> + Read<Word> {
|
||||||
type WriteReadFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a
|
type WriteReadFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a
|
||||||
where
|
where
|
||||||
Self: 'a;
|
Self: 'a,
|
||||||
|
Word: 'a;
|
||||||
|
|
||||||
/// The `read` array must be at least as long as the `write` array,
|
/// The `read` array must be at least as long as the `write` array,
|
||||||
/// but is guaranteed to only be filled with bytes equal to the
|
/// 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> {
|
|||||||
pub trait Write<Word>: Spi<Word> {
|
pub trait Write<Word>: Spi<Word> {
|
||||||
type WriteFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a
|
type WriteFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a
|
||||||
where
|
where
|
||||||
Self: 'a;
|
Self: 'a,
|
||||||
|
Word: 'a;
|
||||||
|
|
||||||
fn write<'a>(&'a mut self, data: &'a [Word]) -> Self::WriteFuture<'a>;
|
fn write<'a>(&'a mut self, data: &'a [Word]) -> Self::WriteFuture<'a>;
|
||||||
}
|
}
|
||||||
@ -50,7 +52,8 @@ pub trait Write<Word>: Spi<Word> {
|
|||||||
pub trait Read<Word>: Write<Word> {
|
pub trait Read<Word>: Write<Word> {
|
||||||
type ReadFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a
|
type ReadFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a
|
||||||
where
|
where
|
||||||
Self: 'a;
|
Self: 'a,
|
||||||
|
Word: 'a;
|
||||||
|
|
||||||
fn read<'a>(&'a mut self, data: &'a mut [Word]) -> Self::ReadFuture<'a>;
|
fn read<'a>(&'a mut self, data: &'a mut [Word]) -> Self::ReadFuture<'a>;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user