mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
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:
@@ -60,6 +60,12 @@
|
|||||||
#define MICROPY_BOARD_END_SOFT_RESET boardctrl_end_soft_reset
|
#define MICROPY_BOARD_END_SOFT_RESET boardctrl_end_soft_reset
|
||||||
#endif
|
#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.
|
// Constants to return from boardctrl_run_boot_py, boardctrl_run_main_py.
|
||||||
enum {
|
enum {
|
||||||
BOARDCTRL_CONTINUE,
|
BOARDCTRL_CONTINUE,
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "boardctrl.h"
|
||||||
#include "usbd_cdc_msc_hid.h"
|
#include "usbd_cdc_msc_hid.h"
|
||||||
#include "usbd_cdc_interface.h"
|
#include "usbd_cdc_interface.h"
|
||||||
#include "pendsv.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))) {
|
if ((cdc->flow & USBD_CDC_FLOWCONTROL_RTS) && (usbd_cdc_rx_buffer_full(cdc))) {
|
||||||
cdc->rx_buf_full = true;
|
cdc->rx_buf_full = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user