8000 USB: allow changing maxPower field from variant · arduino/ArduinoCore-mbed@b0ea6ed · GitHub
[go: up one dir, main page]

Skip to content

Commit b0ea6ed

Browse files
committed
USB: allow changing maxPower field from variant
1 parent 5bb6362 commit b0ea6ed

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

cores/arduino/USB/PluggableUSBDevice.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,10 @@ const uint8_t *arduino::PluggableUSBDevice::string_iserial_desc()
257257
}
258258
#endif
259259

260+
#ifndef USB_MAX_POWER
261+
#define USB_MAX_POWER (100)
262+
#endif
263+
260264
const uint8_t *arduino::PluggableUSBDevice::configuration_desc(uint8_t index)
261265
{
262266
#define TOTAL_DESCRIPTOR_LENGTH 0xFFFF
@@ -271,7 +275,7 @@ const uint8_t *arduino::PluggableUSBDevice::configuration_desc(uint8_t index)
271275
0x01, // bConfigurationValue
272276
0x00, // iConfiguration
273277
C_RESERVED | C_SELF_POWERED, // bmAttributes
274-
C_POWER(100), // bMaxPower
278+
C_POWER(USB_MAX_POWER), // bMaxPower
275279
};
276280
memcpy(_config_descriptor, configuration_descriptor_temp, sizeof(configuration_descriptor_temp));
277281
int size = sizeof(configuration_descriptor_temp);

variants/PORTENTA_H7_M7/pins_arduino.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,6 @@ void _ontouch1200bps_();
121121

122122
#define CRYPTO_WIRE Wire1
123123

124+
#define USB_MAX_POWER (500)
125+
124126
#endif //__PINS_ARDUINO__

0 commit comments

Comments
 (0)
0