mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 20:20:14 +01:00
stm32/usb: Add USB_VCP.irq method, to set a callback on USB data RX.
Usage:
usb = pyb.USB_VCP()
usb.irq(lambda u:print(u, u.read()), usb.IRQ_RX)
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -308,6 +308,8 @@ int8_t usbd_cdc_receive(usbd_cdc_state_t *cdc_in, size_t len) {
|
||||
}
|
||||
}
|
||||
|
||||
usbd_cdc_rx_event_callback(cdc);
|
||||
|
||||
if ((cdc->flow & USBD_CDC_FLOWCONTROL_RTS) && (usbd_cdc_rx_buffer_full(cdc))) {
|
||||
cdc->rx_buf_full = true;
|
||||
return USBD_BUSY;
|
||||
|
||||
Reference in New Issue
Block a user