rp/pio: tighten variance of particle structs
all of these exist in 1:1 correspondence to their parent hal objects, so let's make all of their lifetimes invariant.
This commit is contained in:
parent
09f078a1cc
commit
ed843b519b
@ -181,7 +181,7 @@ impl<'a, 'd, PIO: Instance, const SM: usize> Drop for FifoInFuture<'a, 'd, PIO,
|
|||||||
/// Future that waits for IRQ
|
/// Future that waits for IRQ
|
||||||
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
pub struct IrqFuture<'a, 'd, PIO: Instance> {
|
pub struct IrqFuture<'a, 'd, PIO: Instance> {
|
||||||
pio: PhantomData<&'a Irq<'d, PIO, 0>>,
|
pio: PhantomData<&'a mut Irq<'d, PIO, 0>>,
|
||||||
irq_no: u8,
|
irq_no: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,7 +287,7 @@ impl<'l, PIO: Instance> Pin<'l, PIO> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct StateMachineRx<'d, PIO: Instance, const SM: usize> {
|
pub struct StateMachineRx<'d, PIO: Instance, const SM: usize> {
|
||||||
pio: PhantomData<&'d PIO>,
|
pio: PhantomData<&'d mut PIO>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, PIO: Instance, const SM: usize> StateMachineRx<'d, PIO, SM> {
|
impl<'d, PIO: Instance, const SM: usize> StateMachineRx<'d, PIO, SM> {
|
||||||
@ -364,7 +364,7 @@ impl<'d, PIO: Instance, const SM: usize> StateMachineRx<'d, PIO, SM> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct StateMachineTx<'d, PIO: Instance, const SM: usize> {
|
pub struct StateMachineTx<'d, PIO: Instance, const SM: usize> {
|
||||||
pio: PhantomData<&'d PIO>,
|
pio: PhantomData<&'d mut PIO>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, PIO: Instance, const SM: usize> StateMachineTx<'d, PIO, SM> {
|
impl<'d, PIO: Instance, const SM: usize> StateMachineTx<'d, PIO, SM> {
|
||||||
@ -777,7 +777,7 @@ impl<'d, PIO: Instance + 'd, const SM: usize> StateMachine<'d, PIO, SM> {
|
|||||||
|
|
||||||
pub struct Common<'d, PIO: Instance> {
|
pub struct Common<'d, PIO: Instance> {
|
||||||
instructions_used: u32,
|
instructions_used: u32,
|
||||||
pio: PhantomData<&'d PIO>,
|
pio: PhantomData<&'d mut PIO>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, PIO: Instance> Drop for Common<'d, PIO> {
|
impl<'d, PIO: Instance> Drop for Common<'d, PIO> {
|
||||||
@ -788,7 +788,7 @@ impl<'d, PIO: Instance> Drop for Common<'d, PIO> {
|
|||||||
|
|
||||||
pub struct InstanceMemory<'d, PIO: Instance> {
|
pub struct InstanceMemory<'d, PIO: Instance> {
|
||||||
used_mask: u32,
|
used_mask: u32,
|
||||||
pio: PhantomData<&'d PIO>,
|
pio: PhantomData<&'d mut PIO>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, PIO: Instance> Common<'d, PIO> {
|
impl<'d, PIO: Instance> Common<'d, PIO> {
|
||||||
@ -859,7 +859,7 @@ impl<'d, PIO: Instance> Common<'d, PIO> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct Irq<'d, PIO: Instance, const N: usize> {
|
pub struct Irq<'d, PIO: Instance, const N: usize> {
|
||||||
pio: PhantomData<&'d PIO>,
|
pio: PhantomData<&'d mut PIO>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, PIO: Instance, const N: usize> Irq<'d, PIO, N> {
|
impl<'d, PIO: Instance, const N: usize> Irq<'d, PIO, N> {
|
||||||
@ -873,7 +873,7 @@ impl<'d, PIO: Instance, const N: usize> Irq<'d, PIO, N> {
|
|||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct IrqFlags<'d, PIO: Instance> {
|
pub struct IrqFlags<'d, PIO: Instance> {
|
||||||
pio: PhantomData<&'d PIO>,
|
pio: PhantomData<&'d mut PIO>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, PIO: Instance> IrqFlags<'d, PIO> {
|
impl<'d, PIO: Instance> IrqFlags<'d, PIO> {
|
||||||
@ -920,6 +920,7 @@ pub struct Pio<'d, PIO: Instance> {
|
|||||||
pub sm1: StateMachine<'d, PIO, 1>,
|
pub sm1: StateMachine<'d, PIO, 1>,
|
||||||
pub sm2: StateMachine<'d, PIO, 2>,
|
pub sm2: StateMachine<'d, PIO, 2>,
|
||||||
pub sm3: StateMachine<'d, PIO, 3>,
|
pub sm3: StateMachine<'d, PIO, 3>,
|
||||||
|
_pio: PhantomData<&'d mut PIO>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, PIO: Instance> Pio<'d, PIO> {
|
impl<'d, PIO: Instance> Pio<'d, PIO> {
|
||||||
@ -952,6 +953,7 @@ impl<'d, PIO: Instance> Pio<'d, PIO> {
|
|||||||
rx: StateMachineRx { pio: PhantomData },
|
rx: StateMachineRx { pio: PhantomData },
|
||||||
tx: StateMachineTx { pio: PhantomData },
|
tx: StateMachineTx { pio: PhantomData },
|
||||||
},
|
},
|
||||||
|
_pio: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user