stm32/usbd_cdc_interface: Allow a board to hook into USBD CDC RX events.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
cc42b7c88b
commit
5f2f9044ff
@ -60,6 +60,12 @@
|
||||
#define MICROPY_BOARD_END_SOFT_RESET boardctrl_end_soft_reset
|
||||
#endif
|
||||
|
||||
// Called when USBD CDC data is available.
|
||||
// Default function defined in usbd_cdc_interface.h.
|
||||
#ifndef MICROPY_BOARD_USBD_CDC_RX_EVENT
|
||||
#define MICROPY_BOARD_USBD_CDC_RX_EVENT usbd_cdc_rx_event_callback
|
||||
#endif
|
||||
|
||||
// Constants to return from boardctrl_run_boot_py, boardctrl_run_main_py.
|
||||
enum {
|
||||
BOARDCTRL_CONTINUE,
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "boardctrl.h"
|
||||
#include "usbd_cdc_msc_hid.h"
|
||||
#include "usbd_cdc_interface.h"
|
||||
#include "pendsv.h"
|
||||
@ -308,7 +309,7 @@ int8_t usbd_cdc_receive(usbd_cdc_state_t *cdc_in, size_t len) {
|
||||
}
|
||||
}
|
||||
|
||||
usbd_cdc_rx_event_callback(cdc);
|
||||
MICROPY_BOARD_USBD_CDC_RX_EVENT(cdc);
|
||||
|
||||
if ((cdc->flow & USBD_CDC_FLOWCONTROL_RTS) && (usbd_cdc_rx_buffer_full(cdc))) {
|
||||
cdc->rx_buf_full = true;
|
||||
|
Loading…
Reference in New Issue
Block a user