Skip to content

Add new stdio_usb_call_chars_available_callback() function #2300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 22, 2025

Conversation

mbrase
Copy link

@mbrase mbrase commented Feb 18, 2025

When the user links in tinyUSB directly, the pico_stdio_usb library disables some of its functionality, including its built-in background processing thread. The user can implement their own background thread in order to continue using the stdio functionality, except that there is no wey to trigger the registered chars_available_callback. This commit adds a new stdio_usb_calls_chars_available_callback() method to allow user's background threads to call the callback.

When the user links in tinyUSB directly, the pico_stdio_usb library
disables some of its functionality, including its built-in background
processing thread. The user can implement their own background thread
in order to continue using the stdio functionality, except that there
is no wey to trigger the registered chars_available_callback. This
commit adds a new `stdio_usb_run_chars_available_callback()` method to
allow user's background threads to run the callback.
@kilograham kilograham self-requested a review March 18, 2025 18:28
@kilograham kilograham added this to the 2.1.2 milestone Mar 18, 2025
@@ -66,7 +66,7 @@ static void low_priority_worker_irq(void) {
#endif
mutex_exit(&stdio_usb_mutex);
#if PICO_STDIO_USB_SUPPORT_CHARS_AVAILABLE_CALLBACK
if (chars_avail && chars_available_callback) chars_available_callback(chars_available_param);
if (chars_avail && chars_available_callback) stdio_usb_run_chars_available_callback();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think i'd revert this line... no point in calling another method here (which also checks chars_avail_callback - id just call it directly to save introduction of the new function (which likely isn't otherwise called when this code is included

@kilograham kilograham changed the title Add new stdio_usb_run_chars_available_callback() function Add new stdio_usb_call_chars_available_callback() function Mar 22, 2025
@kilograham kilograham merged commit e43b753 into raspberrypi:develop Mar 22, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants