diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/nvic.h | 5 | ||||
-rw-r--r-- | src/lib/util.c | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/nvic.h b/src/lib/nvic.h index a2d5c24..5908e9c 100644 --- a/src/lib/nvic.h +++ b/src/lib/nvic.h @@ -26,6 +26,8 @@ #ifndef _NVIC_H_ #define _NVIC_H_ +#define NVIC_INT_USBHP 19 +#define NVIC_INT_USBLP 20 #define NVIC_EXTI1_OFFSET (NVIC_ISER0 + 0x07) #define NVIC_EXTI9_5_OFFSET (NVIC_ISER0 + 0x17) @@ -47,11 +49,14 @@ #define NVIC_VectTab_RAM ((u32)0x20000000) #define NVIC_VectTab_FLASH ((u32)0x08000000) +#define NVIC_NR_INTERRUPTS 60 + #ifdef __cplusplus extern "C"{ #endif void nvic_disable_interrupts(void); +void nvic_enable_interrupt(uint32); #ifdef __cplusplus } diff --git a/src/lib/util.c b/src/lib/util.c index c75031f..d323611 100644 --- a/src/lib/util.c +++ b/src/lib/util.c @@ -75,6 +75,10 @@ void _fail(const char* file, int line, const char* exp) { /* Turn on the error LED */ gpio_set_mode(ERROR_LED_PORT, ERROR_LED_PIN, GPIO_MODE_OUTPUT_PP); + /* Turn the USB interrupt back on so the bootloader keeps on functioning */ + nvic_enable_interrupt(NVIC_INT_USBHP); + nvic_enable_interrupt(NVIC_INT_USBLP); + /* Error fade */ while (1) { if (CC == TOP_CNT) { |