Merge pull request #4 from trussed-dev/alloc

Remove `'static` requirement on the bus
This commit is contained in:
Robin Krahl
2023-01-25 12:02:03 +01:00
committed by GitHub
2 changed files with 11 additions and 11 deletions
+6 -6
View File
@@ -13,19 +13,19 @@ use crate::{
use usb_device::class_prelude::*;
type Result<T> = core::result::Result<T, UsbError>;
pub struct Ccid<Bus, I, const N: usize>
pub struct Ccid<'bus, Bus, I, const N: usize>
where
Bus: 'static + UsbBus,
I: 'static + Interchange<REQUEST = Vec<u8, N>, RESPONSE = Vec<u8, N>>,
{
interface_number: InterfaceNumber,
string_index: StringIndex,
read: EndpointOut<'static, Bus>,
read: EndpointOut<'bus, Bus>,
// interrupt: EndpointIn<'static, Bus>,
pipe: Pipe<Bus, I, N>,
pipe: Pipe<'bus, Bus, I, N>,
}
impl<Bus, I, const N: usize> Ccid<Bus, I, N>
impl<'bus, Bus, I, const N: usize> Ccid<'bus, Bus, I, N>
where
Bus: 'static + UsbBus,
I: 'static + Interchange<REQUEST = Vec<u8, N>, RESPONSE = Vec<u8, N>>,
@@ -36,7 +36,7 @@ where
/// and allows personalizing the Answer-to-Reset, for instance by
/// ASCII-encoding vendor or model information.
pub fn new(
allocator: &'static UsbBusAllocator<Bus>,
allocator: &'bus UsbBusAllocator<Bus>,
request_pipe: Requester<I>,
card_issuers_data: Option<&[u8]>,
) -> Self {
@@ -84,7 +84,7 @@ where
}
}
impl<Bus, I, const N: usize> UsbClass<Bus> for Ccid<Bus, I, N>
impl<'bus, Bus, I, const N: usize> UsbClass<Bus> for Ccid<'bus, Bus, I, N>
where
Bus: 'static + UsbBus,
I: 'static + Interchange<REQUEST = Vec<u8, N>, RESPONSE = Vec<u8, N>>,
+5 -5
View File
@@ -35,12 +35,12 @@ enum Error {
CommandNotSupported = 0x00,
}
pub struct Pipe<Bus, I, const N: usize>
pub struct Pipe<'bus, Bus, I, const N: usize>
where
Bus: 'static + UsbBus,
I: 'static + Interchange<REQUEST = Vec<u8, N>, RESPONSE = Vec<u8, N>>,
{
pub(crate) write: EndpointIn<'static, Bus>,
pub(crate) write: EndpointIn<'bus, Bus>,
// pub(crate) rpc: TransportEndpoint<'rpc>,
seq: u8,
state: State,
@@ -58,13 +58,13 @@ where
atr: Vec<u8, 32>,
}
impl<Bus, I, const N: usize> Pipe<Bus, I, N>
impl<'bus, Bus, I, const N: usize> Pipe<'bus, Bus, I, N>
where
Bus: 'static + UsbBus,
I: 'static + Interchange<REQUEST = Vec<u8, N>, RESPONSE = Vec<u8, N>>,
{
pub(crate) fn new(
write: EndpointIn<'static, Bus>,
write: EndpointIn<'bus, Bus>,
request_pipe: Requester<I>,
card_issuers_data: Option<&[u8]>,
) -> Self {
@@ -128,7 +128,7 @@ where
}
}
impl<Bus, I, const N: usize> Pipe<Bus, I, N>
impl<'bus, Bus, I, const N: usize> Pipe<'bus, Bus, I, N>
where
Bus: 'static + UsbBus,
I: 'static + Interchange<REQUEST = Vec<u8, N>, RESPONSE = Vec<u8, N>>,