How to enable interrupts in the USBSerial read/write ISRs

For my project I have data being sent from my computer to my STM32f1, with an occasional interrupt happening on one of the pins. When the interrupt happens, I use the data that was sent to set a pin either high or low depending on some simple arithmetic with that data.

Now, when the interrupt is triggered, it is very important that I respond to it within a couple microseconds, otherwise I don't respond in time on the pin. I don't have time to wait for a the serial read or write to finish, if one is happening.

If the read is interrupted I can just ask the program on my computer to send the data again, and if the write is interrupted, I can just try again. I just need to know how to enable interrupts inside the serial ISRs and what things I should be cautious of while doing it. Thanks!

Is this in the wrong topic?

You should try the STM32duino forums (or the forums for whatever core you're using) - I don't see much discussion of STM32 here.

I wouldn't think that the USBSerial ISRs would take that long.

In theory, you can set your higher-priority interrupt to a ... higher interrupt priority. Unlike the AVR, the ARM CM3 has multiple interrupt levels. I don't know how you'd do this with the STM32duino environment, though.