diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 8cc00fa2..d5b89029 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -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 diff --git a/src/arduino/Adafruit_USBD_Device.h b/src/arduino/Adafruit_USBD_Device.h index 0033ca96..48c4d384 100644 --- a/src/arduino/Adafruit_USBD_Device.h +++ b/src/arduino/Adafruit_USBD_Device.h @@ -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);