I've just integrated the code from ST's STM32 USB Virtual Com Port example (stm32_usb-fs-device_lib.zip from here) with my project in order to get the STM32 to appear as a Virtual Serial Port.
However the code example throttles the data it receives by having the callback function EP3_OUT_Callback block (in an interrupt) until all data is dealt with. The exact comment in the code is "USB data will be immediately processed, this allow next USB traffic being NAKed till the end of the USART Xfer"
In my project, I need to process the data that has been received in the main loop (outside of an interrupt), so I need a way of throttling the data that I get from USB without blocking in EP3_OUT_Callback.
What I would like is a function:
Do_Not_Call_EP3_OUT_Callback_Right_Now(bool yes_or_no);