Skip to content

Commit

Permalink
Fix PICO_STDIO_USB_SUPPORT_CHARS_AVAILABLE_CALLBACK
Browse files Browse the repository at this point in the history
  • Loading branch information
peterharperuk committed Feb 26, 2024
1 parent cbb669b commit 7399add
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/rp2_common/pico_stdio_usb/stdio_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,17 @@ static int64_t timer_task(__unused alarm_id_t id, __unused void *user_data) {

static void low_priority_worker_irq(void) {
if (mutex_try_enter(&stdio_usb_mutex, NULL)) {
#if PICO_STDIO_USB_SUPPORT_CHARS_AVAILABLE_CALLBACK
uint32_t chars_avail;
#endif
tud_task();
#if PICO_STDIO_USB_SUPPORT_CHARS_AVAILABLE_CALLBACK
chars_avail = tud_cdc_available();
#endif
mutex_exit(&stdio_usb_mutex);
if (chars_avail) chars_available_callback(chars_available_param);
#if PICO_STDIO_USB_SUPPORT_CHARS_AVAILABLE_CALLBACK
if (chars_avail) chars_available_callback(chars_available_param);
#endif
} else {
// if the mutex is already owned, then we are in non IRQ code in this file.
//
Expand Down

0 comments on commit 7399add

Please sign in to comment.