Compare commits
2 Commits
a1e180b451
...
c4686aafc4
Author | SHA1 | Date | |
---|---|---|---|
|
c4686aafc4 | ||
|
ba319eecff |
|
@ -82,13 +82,6 @@ pub(crate) const ENDPOINTS_ALLOC_LAYOUT: [u16; MAX_ENDPOINTS] = [64, 256, 64, 64
|
|||
pub(crate) const ONE_MS_16_MGHZ: u32 = 16000;
|
||||
|
||||
impl<const L: usize> UsbDevice<L> {
|
||||
#[inline]
|
||||
pub(crate) fn get_size(&self, cs: CriticalSection<'_>) -> usize {
|
||||
let usb = self.usb.borrow(cs);
|
||||
|
||||
(((usb.uebchx.read().bits() as u16) << 8) | (usb.uebclx.read().bits() as u16)).into()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn new(pll: PLL, usb: USB_DEVICE) -> UsbBusAllocator<Self> {
|
||||
UsbBusAllocator::new(Self {
|
||||
|
@ -100,7 +93,12 @@ impl<const L: usize> UsbDevice<L> {
|
|||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
pub fn plug_in_detect(&self, cs: CriticalSection<'_>) -> bool {
|
||||
self.usb.borrow(cs).usbsta.read().vbus().bit_is_set()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub(crate) fn allocated_endpoints(&self) -> impl Iterator<Item = (usize, &USBEndpoint)> {
|
||||
self.ep_table
|
||||
.iter()
|
||||
|
@ -178,4 +176,11 @@ impl<const L: usize> UsbDevice<L> {
|
|||
Err(exception) => Err(exception),
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub(crate) fn get_size(&self, cs: CriticalSection<'_>) -> usize {
|
||||
let usb = self.usb.borrow(cs);
|
||||
|
||||
(((usb.uebchx.read().bits() as u16) << 8) | (usb.uebclx.read().bits() as u16)).into()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue