revert feat: separate constructor for UsbDevice and UsbBusAllocator
This commit is contained in:
doryan 2025-04-28 18:50:45 +03:00
parent 79d01f8571
commit 29b3bff247

View File

@ -83,19 +83,14 @@ pub(crate) const ONE_MS_16_MGHZ: u32 = 16000;
impl<const L: usize> UsbDevice<L> { impl<const L: usize> UsbDevice<L> {
#[inline] #[inline]
pub fn new(pll: PLL, usb: USB_DEVICE) -> Self { pub fn create_usb_allocator(pll: PLL, usb: USB_DEVICE) -> UsbBusAllocator<Self> {
Self { UsbBusAllocator::new(Self {
pll: Mutex::new(pll), pll: Mutex::new(pll),
usb: Mutex::new(usb), usb: Mutex::new(usb),
ep_table: [USBEndpoint::default(); L], ep_table: [USBEndpoint::default(); L],
pending_ins: Mutex::new(Cell::new(0u8)), pending_ins: Mutex::new(Cell::new(0u8)),
dpram_already_used: 0, dpram_already_used: 0,
} })
}
#[inline]
pub fn into_usb_allocator(self) -> UsbBusAllocator<Self> {
UsbBusAllocator::new(self)
} }
#[inline] #[inline]