Skip to content

Commit

Permalink
renesas-ra/mphalport: Use shared/tinyusb cdc functions.
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Leech <[email protected]>
  • Loading branch information
andrewleech committed May 10, 2024
1 parent 75a60d6 commit d3345d7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ports/renesas-ra/mphalport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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
Expand Down

0 comments on commit d3345d7

Please sign in to comment.