nrf52840: use higher priority for USB-CDC code

This ensures that stdout (println etc) keeps working in interrupts.

Generally you shouldn't print anything in an interrupt. However,
printing things for debugging is very useful and printing panic messages
can be critical when the code doesn't work for some reason.
Этот коммит содержится в:
Ayke van Laethem 2020-09-09 16:34:29 +02:00 коммит произвёл Ron Evans
родитель e7227df80d
коммит f20c932bb9

Просмотреть файл

@ -87,9 +87,12 @@ func exitCriticalSection() {
// Configure the USB CDC interface. The config is here for compatibility with the UART interface. // Configure the USB CDC interface. The config is here for compatibility with the UART interface.
func (usbcdc *USBCDC) Configure(config UARTConfig) { func (usbcdc *USBCDC) Configure(config UARTConfig) {
// enable IRQ // Enable IRQ. Make sure this is higher than the SWI2 interrupt handler so
// that it is possible to print to the console from a BLE interrupt. You
// shouldn't generally do that but it is useful for debugging and panic
// logging.
usbcdc.interrupt = interrupt.New(nrf.IRQ_USBD, USB.handleInterrupt) usbcdc.interrupt = interrupt.New(nrf.IRQ_USBD, USB.handleInterrupt)
usbcdc.interrupt.SetPriority(0xD0) usbcdc.interrupt.SetPriority(0x40) // interrupt priority 2 (lower number means more important)
usbcdc.interrupt.Enable() usbcdc.interrupt.Enable()
// enable USB // enable USB