add Adafruit_USBD_Device::setConfigurationMaxPower() and setConfigurationAttribute
This commit is contained in:
parent
cdc07c1d96
commit
60fb663caa
2 changed files with 16 additions and 1 deletions
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -80,6 +80,21 @@ public:
|
|||
// 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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue