Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ body:
- type: input
attributes:
label: TinyUSB Library version
placeholder: "Release version or github latest"
placeholder: "Release version or commit SHA"
validations:
required: true

Expand Down
15 changes: 15 additions & 0 deletions src/arduino/Adafruit_USBD_Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,21 @@ class Adafruit_USBD_Device {
// Clear/Reset configuration descriptor
void clearConfiguration(void);

// Set configuration attribute
void setConfigurationAttribute(uint8_t attribute) {
_desc_cfg[offsetof(tusb_desc_configuration_t, bmAttributes)] = attribute;
}

// Set max power consumption in mA (absolute max is 510ma)
bool setConfigurationMaxPower(uint16_t power_ma) {
if (power_ma > 255 * 2u) {
return false;
}
_desc_cfg[offsetof(tusb_desc_configuration_t, bMaxPower)] =
(uint8_t)(power_ma / 2);
return true;
}

// Provide user buffer for configuration descriptor, if total length > 256
void setConfigurationBuffer(uint8_t *buf, uint32_t buflen);

Expand Down