Skip to content

Add library for reset interface #2629

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

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

will-v-pi
Copy link
Contributor

@will-v-pi will-v-pi commented Aug 14, 2025

This separates the stdio_usb reset interface out into a separate library, which can be used by applications which use TinyUSB directly.

No change in behaviour when using the typical stdio_usb (eg in the hello_usb example).

Keeps the PICO_STDIO_USB_ prefix on the config defines to maintain compatibility, and also maintains compatibility with picotool.

Instructions to use this are added to the header file.

See implementation in debugprobe and the dev_multi_cdc example

#include "stdint.h"
#include "device/usbd_pvt.h"

void resetd_init(void);
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure resetd is a sufficient/good prefix for the public API

Copy link
Contributor

Choose a reason for hiding this comment

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

note also, on this and the below, this is peculiar to TinyUSB - as we think about CherryUSB etc, we (i haven't looked in detail) should consider what if any of this is exposed (and whether we should expose them again in a separate header - e.g. one for TinyUSB one for CherryUSB)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will rename them to pico_usb_reset_interface_...

Note that these functions are not supposed to be exposed as a public API - the only thing that should be used publicly is the _resetd_driver struct, I will try to refactor it so that's the case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made a separate TinyUSB header, and made it so this should be compatible with the CherryUSB PR (as that only uses the usb_reset_interface.h header)

I couldn't refactor the functions out of the header, because I think the pico_usb_reset_interface_driver has to be defined in the header as static const in order for the debugprobe inclusion to compile, and therefore the functions must be in the header too

Copy link
Contributor

Choose a reason for hiding this comment

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

I will rename them to pico_usb_reset_interface_...

Note that these functions are not supposed to be exposed as a public API - the only thing that should be used publicly is the _resetd_driver struct, I will try to refactor it so that's the case

note pico_/hardware_ is not included in function names; e.g. dma_foo

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.

2 participants