summaryrefslogtreecommitdiff
path: root/src/device/usbd.h
diff options
context:
space:
mode:
authorZixun LI <[email protected]>2026-07-26 22:47:23 +0200
committerGitHub <[email protected]>2026-07-26 22:47:23 +0200
commitc83e3376588f2d87df80e6fd7de9e7ab6d99d5c1 (patch)
treed253a31eb2a498df4e90912940e017b65e14e17d /src/device/usbd.h
parent43b23195ac7d70d510dc14e222fe622c1bc83576 (diff)
parent05f19ab438641823d047c811e7426177788d0490 (diff)
Merge pull request #3785 from TenGui/tud_descriptor_narrowing
Cast BMaxPower in TUD_CONFIG_DESCRIPTOR to uint8_t
Diffstat (limited to 'src/device/usbd.h')
-rw-r--r--src/device/usbd.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/device/usbd.h b/src/device/usbd.h
index 9be12ed0a..2015d1869 100644
--- a/src/device/usbd.h
+++ b/src/device/usbd.h
@@ -229,7 +229,7 @@ bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_requ
// Config number, interface count, string index, total length, attribute, power in mA
#define TUD_CONFIG_DESCRIPTOR(config_num, _itfcount, _stridx, _total_len, _attribute, _power_ma) \
- 9, TUSB_DESC_CONFIGURATION, U16_TO_U8S_LE(_total_len), _itfcount, config_num, _stridx, TU_BIT(7) | _attribute, (_power_ma)/2
+ 9, TUSB_DESC_CONFIGURATION, U16_TO_U8S_LE(_total_len), _itfcount, config_num, _stridx, TU_BIT(7) | _attribute, (uint8_t)TU_MIN((_power_ma)/2, UINT8_MAX)
//--------------------------------------------------------------------+
// CDC Descriptor Templates