Fix tusb init warning, add AGENTS.md#577
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates TinyUSB stack initialization calls across the Arduino wrapper/port layers to avoid deprecated tud_init() / tuh_init() warnings by using tusb_init(rhport, tusb_rhport_init_t*) with explicit role and speed, and adds an AGENTS.md contributor/agent guide for build and architecture context.
Changes:
- Added
AGENTS.mdwith project overview, build instructions, code-quality hooks, and porting/contracts notes. - Updated
Adafruit_USBH_Host::begin()to usetusb_init()with atusb_rhport_init_t(host role). - Updated multiple MCU port
TinyUSB_Port_InitDevice()implementations to usetusb_init()with atusb_rhport_init_t(device role).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/arduino/ports/stm32/Adafruit_TinyUSB_stm32.cpp |
Switch STM32 device init from tud_init() to tusb_init() with explicit role/speed. |
src/arduino/ports/samd/Adafruit_TinyUSB_samd.cpp |
Switch SAMD device init from tud_init() to tusb_init() with explicit role/speed. |
src/arduino/ports/rp2040/Adafruit_TinyUSB_rp2040.cpp |
Switch RP2040 device init from tud_init() to tusb_init() with explicit role/speed. |
src/arduino/ports/nrf/Adafruit_TinyUSB_nrf.cpp |
Switch nRF device init from tud_init() to tusb_init() with explicit role/speed. |
src/arduino/ports/ch32/Adafruit_TinyUSB_ch32.cpp |
Switch CH32 device init from tud_init() to tusb_init() with explicit role/speed. |
src/arduino/Adafruit_USBH_Host.cpp |
Switch host init from deprecated tuh_init() to tusb_init() with explicit role/speed. |
AGENTS.md |
Add repository guidance for contributors and AI agents (build/CI/formatting/architecture/port contracts). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+83
to
+87
| const tusb_rhport_init_t rh_init = { | ||
| .role = TUSB_ROLE_DEVICE, | ||
| .speed = TUD_OPT_HIGH_SPEED ? TUSB_SPEED_HIGH : TUSB_SPEED_FULL, | ||
| }; | ||
| tusb_init(rhport, &rh_init); |
Comment on lines
+166
to
+170
| const tusb_rhport_init_t rh_init = { | ||
| .role = TUSB_ROLE_DEVICE, | ||
| .speed = TUD_OPT_HIGH_SPEED ? TUSB_SPEED_HIGH : TUSB_SPEED_FULL, | ||
| }; | ||
| tusb_init(rhport, &rh_init); |
Comment on lines
139
to
145
| _rhport = rhport; | ||
| return tuh_init(rhport); | ||
| const tusb_rhport_init_t rh_init = { | ||
| .role = TUSB_ROLE_HOST, | ||
| .speed = TUH_OPT_HIGH_SPEED ? TUSB_SPEED_HIGH : TUSB_SPEED_FULL, | ||
| }; | ||
| return tusb_init(rhport, &rh_init); | ||
| } |
9f3967b to
b69d1f0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added
AGENTS.mdto provide an overview of the project, build instructions, code quality guidelines, architecture diagrams, porting contracts, and integration details for contributors and AI agents.fix Deprecated warning(error) in tuh_init call on RP2040 Arduino-Pico #575 Updated
Adafruit_USBH_Host::begininAdafruit_USBH_Host.cppto usetusb_initwith atusb_rhport_init_tstruct, specifying host role and speed, replacing the previoustuh_initcall.