/// Borrows the global singleton `UsbSerial` for a brief period with interrupts
/// disabled
///
/// # Arguments
/// `borrower`: The closure that gets run borrowing the global `UsbSerial`
///
/// # Safety
/// the global singleton `UsbSerial` can be safely borrowed because we disable
/// interrupts while it is being borrowed, guaranteeing that interrupt handlers
/// like `USB` cannot mutate `UsbSerial` while we are as well.
///
/// # Panic
/// If `init` has not been called and we haven't initialized our global
/// singleton `UsbSerial`, we will panic.
Borrows the global singleton `UsbSerial` for a brief period with interrupts
disabled
Borrows the global singleton ` UsbSerial ` for a brief period with interrupts disabled
fn usbserial_get<T, R>(borrower: T) -> R
where
    T: Fn(&mut SerialPort<UsbBus>) -> R,
{
    usb_free(|_| unsafe {
        let usb_serial = USB_SERIAL.as_mut().expect("UsbSerial not initialized");
        borrower(usb_serial)
    })
}
fn usbserial_get < T , R > ( borrower : T ) -> R where T : Fn ( & mut SerialPort < UsbBus > ) -> R , { usb_free ( | _ | unsafe { let usb_serial = USB_SERIAL . as_mut ( ) . expect ( " " ) ; borrower ( usb_serial ) } ) }
Borrows the global singleton `UsbSerial` for a brief period with interrupts
disabled
Borrows the global singleton ` UsbSerial ` for a brief period with interrupts disabled
borrower
T
safety
the global singleton `UsbSerial` can be safely borrowed because we disable
interrupts while it is being borrowed, guaranteeing that interrupt handlers
like `USB` cannot mutate `UsbSerial` while we are as well.
the global singleton ` UsbSerial ` can be safely borrowed because we disable interrupts while it is being borrowed guaranteeing that interrupt handlers like ` USB ` cannot mutate ` UsbSerial ` while we are as well .
panic
If `init` has not been called and we haven't initialized our global
singleton `UsbSerial`, we will panic.
If ` init ` has not been called and we haven ' t initialized our global singleton ` UsbSerial ` we will panic .