kopia lustrzana https://github.com/micropython/micropython
renesas-ra/mphalport: Use shared/tinyusb cdc functions.
Signed-off-by: Andrew Leech <andrew@alelec.net>
rodzic
75a60d6aa4
commit
d3345d7511
|
@ -34,6 +34,7 @@
|
|||
#include "py/ringbuf.h"
|
||||
#include "extmod/misc.h"
|
||||
#include "shared/runtime/interrupt_char.h"
|
||||
#include "shared/tinyusb/mp_cdc_common.h"
|
||||
#include "tusb.h"
|
||||
#include "uart.h"
|
||||
|
||||
|
@ -49,7 +50,6 @@ void flash_cache_commit(void);
|
|||
|
||||
static uint8_t stdin_ringbuf_array[MICROPY_HW_STDIN_BUFFER_LEN];
|
||||
ringbuf_t stdin_ringbuf = { stdin_ringbuf_array, sizeof(stdin_ringbuf_array) };
|
||||
|
||||
#endif
|
||||
|
||||
// this table converts from HAL_StatusTypeDef to POSIX errno
|
||||
|
@ -68,7 +68,7 @@ NORETURN void mp_hal_raise(HAL_StatusTypeDef status) {
|
|||
|
||||
uint8_t cdc_itf_pending; // keep track of cdc interfaces which need attention to poll
|
||||
|
||||
void poll_cdc_interfaces(void) {
|
||||
void tud_cdc_poll_interfaces(void) {
|
||||
// any CDC interfaces left to poll?
|
||||
if (cdc_itf_pending && ringbuf_free(&stdin_ringbuf)) {
|
||||
for (uint8_t itf = 0; itf < 8; ++itf) {
|
||||
|
@ -106,7 +106,7 @@ void tud_cdc_rx_cb(uint8_t itf) {
|
|||
uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) {
|
||||
uintptr_t ret = 0;
|
||||
#if MICROPY_HW_USB_CDC
|
||||
poll_cdc_interfaces();
|
||||
tud_cdc_poll_interfaces();
|
||||
#endif
|
||||
#if MICROPY_HW_ENABLE_UART_REPL || MICROPY_HW_USB_CDC
|
||||
if ((poll_flags & MP_STREAM_POLL_RD) && ringbuf_peek(&stdin_ringbuf) != -1) {
|
||||
|
@ -132,7 +132,7 @@ uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) {
|
|||
int mp_hal_stdin_rx_chr(void) {
|
||||
for (;;) {
|
||||
#if MICROPY_HW_USB_CDC
|
||||
poll_cdc_interfaces();
|
||||
tud_cdc_poll_interfaces();
|
||||
#endif
|
||||
|
||||
#if MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
|
||||
|
|
Ładowanie…
Reference in New Issue