Skip to content

Fix tusb init warning, add AGENTS.md#577

Merged
hathach merged 3 commits into
masterfrom
fix-warning-tusb-init
May 11, 2026
Merged

Fix tusb init warning, add AGENTS.md#577
hathach merged 3 commits into
masterfrom
fix-warning-tusb-init

Conversation

@hathach

@hathach hathach commented May 8, 2026

Copy link
Copy Markdown
Member
  • Added AGENTS.md to 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::begin in Adafruit_USBH_Host.cpp to use tusb_init with a tusb_rhport_init_t struct, specifying host role and speed, replacing the previous tuh_init call.

Copilot AI review requested due to automatic review settings May 8, 2026 15:05
@hathach hathach changed the title Fix warning tusb init Fix tusb init warning, add AGENTS.md May 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.md with project overview, build instructions, code-quality hooks, and porting/contracts notes.
  • Updated Adafruit_USBH_Host::begin() to use tusb_init() with a tusb_rhport_init_t (host role).
  • Updated multiple MCU port TinyUSB_Port_InitDevice() implementations to use tusb_init() with a tusb_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);
}
@hathach hathach force-pushed the fix-warning-tusb-init branch from 9f3967b to b69d1f0 Compare May 11, 2026 02:51
@hathach hathach merged commit 3e0da82 into master May 11, 2026
24 checks passed
@hathach hathach deleted the fix-warning-tusb-init branch May 11, 2026 03:10
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.

Deprecated warning(error) in tuh_init call on RP2040 Arduino-Pico

2 participants