feat: separate constructor for UsbDevice and UsbBusAllocator
This commit is contained in:
parent
f399278d2c
commit
995bfd0169
|
@ -83,14 +83,19 @@ pub(crate) const ONE_MS_16_MGHZ: u32 = 16000;
|
|||
|
||||
impl<const L: usize> UsbDevice<L> {
|
||||
#[inline]
|
||||
pub fn create_usb_allocator(pll: PLL, usb: USB_DEVICE) -> UsbBusAllocator<Self> {
|
||||
UsbBusAllocator::new(Self {
|
||||
pub fn new(pll: PLL, usb: USB_DEVICE) -> Self {
|
||||
Self {
|
||||
pll: Mutex::new(pll),
|
||||
usb: Mutex::new(usb),
|
||||
ep_table: [USBEndpoint::default(); L],
|
||||
pending_ins: Mutex::new(Cell::new(0u8)),
|
||||
dpram_already_used: 0,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn into_usb_allocator(self) -> UsbBusAllocator<Self> {
|
||||
UsbBusAllocator::new(self)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
|
Loading…
Reference in New Issue