Compare commits
No commits in common. "29e5edde8abbb286d9fac38eeb0d8074589b1706" and "5ac1a07c6bc821eb574de533b2373bcefdcbfc8b" have entirely different histories.
29e5edde8a
...
5ac1a07c6b
|
@ -38,14 +38,16 @@ impl<const L: usize> UsbBus for UsbDevice<L> {
|
|||
|
||||
// If ep_aadr not provided, or current endpoint is allocated, try to find next free endpoint, otherwise return UsbError. //
|
||||
_ => {
|
||||
let index = self.ep_table[1..]
|
||||
let index = self
|
||||
.ep_table
|
||||
.iter()
|
||||
.enumerate()
|
||||
.skip(1)
|
||||
.find(|(index, ep)| {
|
||||
!ep.is_allocated && max_packet_size <= ENDPOINTS_ALLOC_LAYOUT[*index]
|
||||
})
|
||||
.map(|(index, _)| index)
|
||||
.ok_or(UsbError::EndpointOverflow)?;
|
||||
.ok_or(UsbError::EndpointOverflow)?
|
||||
.0;
|
||||
|
||||
EndpointAddress::from_parts(index, ep_dir)
|
||||
}
|
||||
|
|
|
@ -84,7 +84,6 @@ pub(crate) const ONE_MS_16_MGHZ: u32 = 16000;
|
|||
impl<const L: usize> UsbDevice<L> {
|
||||
#[inline]
|
||||
pub fn new(pll: PLL, usb: USB_DEVICE) -> UsbBusAllocator<Self> {
|
||||
if L > 1 {
|
||||
UsbBusAllocator::new(Self {
|
||||
pll: Mutex::new(pll),
|
||||
usb: Mutex::new(usb),
|
||||
|
@ -92,9 +91,6 @@ impl<const L: usize> UsbDevice<L> {
|
|||
pending_ins: Mutex::new(Cell::new(0u8)),
|
||||
dpram_already_used: 0,
|
||||
})
|
||||
} else {
|
||||
panic!("Endpoint table cannot be with length <= 1")
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
|
Loading…
Reference in New Issue