Skip to content

Commit 3a022a6

Browse files
committed
platform: Add USB device MaxPower default setting
The MaxPower field specifies the maximum power that a device can draw from the host, when the device is bus-powered. Define the default value of 100mA default in the platform to allow to override it from the board definition. Some mobile devices will only supply 20mA. If a device is known to draw less current, adding this to the board config will make it work: <boardname>.build.usb_power=20
1 parent e33ec1f commit 3a022a6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

platform.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/"
7373

7474
# USB Flags
7575
# ---------
76-
build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} -DUSBCON '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' {build.flags.usbstack} {build.flags.debug} "-I{build.core.path}/Adafruit_TinyUSB_Core" "-I{build.core.path}/Adafruit_TinyUSB_Core/tinyusb/src"
76+
build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} -DUSBCON -DUSB_CONFIG_POWER={build.usb_power} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' {build.flags.usbstack} {build.flags.debug} "-I{build.core.path}/Adafruit_TinyUSB_Core" "-I{build.core.path}/Adafruit_TinyUSB_Core/tinyusb/src"
77+
78+
# Default advertised device power setting in mA
79+
build.usb_power=100
7780

7881
# Default usb manufacturer will be replaced at compile time using
7982
# numeric vendor ID if available or by board's specific value.

0 commit comments

Comments
 (0)