From 7e37bb3b1232e8d50745fbcdabf05db0fd981d4c Mon Sep 17 00:00:00 2001
From: Andreas Watterott <awatterott@users.noreply.github.com>
Date: Thu, 9 Nov 2017 19:50:41 +0100
Subject: [PATCH] No fixed value for USB power current.

---
 cores/arduino/USB/USBCore.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/cores/arduino/USB/USBCore.h b/cores/arduino/USB/USBCore.h
index cba8089a..75fd9e3d 100644
--- a/cores/arduino/USB/USBCore.h
+++ b/cores/arduino/USB/USBCore.h
@@ -100,6 +100,9 @@
 
 // bMaxPower in Configuration Descriptor
 #define USB_CONFIG_POWER_MA(mA)                ((mA)/2)
+#ifndef USB_CONFIG_POWER
+ #define USB_CONFIG_POWER                      (500)
+#endif
 
 #define CDC_V1_10                               0x0110
 #define CDC_COMMUNICATION_INTERFACE_CLASS       0x02
@@ -258,7 +261,7 @@ _Pragma("pack()")
  *    idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
 
 #define D_CONFIG(_totalLength,_interfaces) \
-	{ 9, 2, _totalLength,_interfaces, 1, 0, USB_CONFIG_BUS_POWERED | USB_CONFIG_REMOTE_WAKEUP, USB_CONFIG_POWER_MA(500) }
+	{ 9, 2, _totalLength,_interfaces, 1, 0, USB_CONFIG_BUS_POWERED | USB_CONFIG_REMOTE_WAKEUP, USB_CONFIG_POWER_MA(USB_CONFIG_POWER) }
 /* Table 9-10. Standard Configuration Descriptor
  * bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
  * bmAttributes, bMaxPower */
-- 
GitLab