mirror of
https://github.com/hathach/tinyusb.git
synced 2026-08-18 11:02:16 +00:00
Merge pull request #3785 from TenGui/tud_descriptor_narrowing
Cast BMaxPower in TUD_CONFIG_DESCRIPTOR to uint8_t
This commit is contained in:
@ -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 {
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user