Skip to content

shared/tinyusb/tusb_config.h: Adding macro to override USBD_MAX_POWER…#19391

Open
tomtecola wants to merge 1 commit into
micropython:masterfrom
tomtecola:tinyusb-max-power-override
Open

shared/tinyusb/tusb_config.h: Adding macro to override USBD_MAX_POWER…#19391
tomtecola wants to merge 1 commit into
micropython:masterfrom
tomtecola:tinyusb-max-power-override

Conversation

@tomtecola

Copy link
Copy Markdown

…_MA.

If MICROPY_HW_USBD_MAX_POWER is defined it replaces default 250 mA.

Summary

Change to be able to report the correct power draw in the USB device descriptor for a specific board.

Testing

Tested on an out-of-tree rp2350 board.

Trade-offs and Alternatives

Code and data size remains the same.

Generative AI

I did not use generative AI tools when creating this PR.

@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.51%. Comparing base (552fd21) to head (1651b72).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #19391   +/-   ##
=======================================
  Coverage   98.51%   98.51%           
=======================================
  Files         177      177           
  Lines       22927    22927           
=======================================
  Hits        22586    22586           
  Misses        341      341           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

If MICROPY_HW_USBD_MAX_POWER is defined it replaces default 250 mA.

Signed-off-by: Anders Gärder <garder@teenage.engineering>
@tomtecola tomtecola force-pushed the tinyusb-max-power-override branch from a2d83c7 to 1651b72 Compare June 28, 2026 16:26
@github-actions

Copy link
Copy Markdown

Code size report:

Reference:  py/mpstate: Move mp_verbose_flag to MP_STATE_VM struct. [552fd21]
Comparison: shared/tinyusb/tusb_config: Add macro to override USBD_MAX_POWER_MA. [merge of 1651b72]
  mpy-cross:    +0 +0.000% 
   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
      esp32:    +0 +0.000% ESP32_GENERIC
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

@o-murphy

Copy link
Copy Markdown

@tomtecola

Also there should be customizable CFG_TUH_CDC, CFG_TUH_ENUMERATION_BUFSIZE

It should be added to allow large descriptors (like descriptors of composite devices) and handle second CDC ACM device acm device at least for RP2.

I did commented same proposal on adafruit/Adafruit_TinyUSB_Arduino#571

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