MCU/lib/USB.c
void USB_LP_CAN1_RX0_IRQ(void) {
    uint16_t ISTR = USB->ISTR;

    if (ISTR & USB_ISTR_RESET) {
        /* RESET */
        USB->ISTR = ~USB_ISTR_RESET; //Clear interrupt
        USB_Reset();

    } else if (ISTR & USB_ISTR_CTR) {
        /* CTR */
        USB->ISTR = (uint16_t)~USB_ISTR_CTR; //Clear interrupt

        if (ISTR & USB_ISTR_DIR) {
            /* CTR_RX bit is set */
            USB_EP_Clear_CTR_RX(EP0); //Clear endpoint RX flag

            if (USB_EP(0) & EP_SETUP) {
                /* SETUP TRANSACTION */
                USB_Handle_SETUP();

            } else {
                /* OUT TRANSACTION */
                USB_Handle_OUT();
            }

        } else {
            /* CTR_TX should be set */
            USB_Handle_IN();
        }
    }
}
/* USB Low-Priority Interrupt Handler */
USB Low-Priority Interrupt Handler
USB Low - Priority Interrupt Handler
void USB_LP_CAN1_RX0_IRQ(void) {
    uint16_t ISTR = USB->ISTR;
    if (ISTR & USB_ISTR_RESET) {
        USB->ISTR = ~USB_ISTR_RESET; 
        USB_Reset();
    } else if (ISTR & USB_ISTR_CTR) {
        USB->ISTR = (uint16_t)~USB_ISTR_CTR; 
        if (ISTR & USB_ISTR_DIR) {
            USB_EP_Clear_CTR_RX(EP0); 
            if (USB_EP(0) & EP_SETUP) {
                USB_Handle_SETUP();
            } else {
                USB_Handle_OUT();
            }
        } else {
            USB_Handle_IN();
        }
    }
}
void USB_LP_CAN1_RX0_IRQ ( void ) { uint16_t ISTR = USB -> ISTR ; if ( ISTR & USB_ISTR_RESET ) { USB -> ISTR = ~ USB_ISTR_RESET ; USB_Reset ( ) ; } else if ( ISTR & USB_ISTR_CTR ) { USB -> ISTR = ( uint16_t ) ~ USB_ISTR_CTR ; if ( ISTR & USB_ISTR_DIR ) { USB_EP_Clear_CTR_RX ( EP0 ) ; if ( USB_EP ( 0 ) & EP_SETUP ) { USB_Handle_SETUP ( ) ; } else { USB_Handle_OUT ( ) ; } } else { USB_Handle_IN ( ) ; } } }
USB Low-Priority Interrupt Handler
USB Low - Priority Interrupt Handler
/* RESET */ //Clear interrupt /* CTR */ //Clear interrupt /* CTR_RX bit is set */ //Clear endpoint RX flag /* SETUP TRANSACTION */ /* OUT TRANSACTION */ /* CTR_TX should be set */