summaryrefslogtreecommitdiff
path: root/src/common
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/common
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/common')
-rw-r--r--src/common/tusb_types.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/common/tusb_types.h b/src/common/tusb_types.h
index d49d277ed..fa4d67df1 100644
--- a/src/common/tusb_types.h
+++ b/src/common/tusb_types.h
@@ -244,7 +244,7 @@ enum {
TUSB_DESC_CONFIG_ATT_SELF_POWERED = 1 << 6,
};
-#define TUSB_DESC_CONFIG_POWER_MA(x) ((x)/2)
+#define TUSB_DESC_CONFIG_POWER_MA(x) ((uint8_t)TU_MIN((x)/2, UINT8_MAX))
// USB 2.0 Spec Table 9-7: Test Mode Selectors
typedef enum {