mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
ports/stm32: Reset CDC buffers after disabling IRQs.
* Fixes #1637 for good. * Reset USB CDC buffers after disabling IRQs, when stopping scripts, to avoid overflows or blocking when printing IDE exception traceback.
This commit is contained in:
parent
b7c0440d3f
commit
52a0c44275
@ -1 +1 @@
|
||||
Subproject commit 6ee9ecd25f431e9a6906217602cf4322abe1b4a7
|
||||
Subproject commit 74f9806fe7c279cef9f2ad314439194fe0864111
|
||||
@ -41,6 +41,10 @@ static mp_obj_t mp_const_ide_interrupt = MP_OBJ_NULL;
|
||||
// These functions must be implemented in MicroPython CDC driver.
|
||||
extern uint32_t usb_cdc_buf_len();
|
||||
extern uint32_t usb_cdc_get_buf(uint8_t *buf, uint32_t len);
|
||||
void __attribute__((weak)) usb_cdc_reset_buffers()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void usbdbg_init()
|
||||
{
|
||||
@ -339,6 +343,9 @@ void usbdbg_control(void *buffer, uint8_t request, uint32_t length)
|
||||
// Disable IDE IRQ (re-enabled by pyexec or main).
|
||||
usbdbg_set_irq_enabled(false);
|
||||
|
||||
// Reset CDC buffers after disabling IRQs.
|
||||
usb_cdc_reset_buffers();
|
||||
|
||||
// interrupt running code by raising an exception
|
||||
mp_obj_exception_clear_traceback(mp_const_ide_interrupt);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user