14#define USBD_VID 0x0483u
15#define USBD_PID 0x5740u
16#define USBD_LANGID 0x0409u
17#define STR_MANUFACTURER "ACwing"
18#define STR_PRODUCT "ACwing FC"
19#define STR_CONFIG "CDC Config"
20#define STR_INTERFACE "CDC Interface"
21#define USB_SIZ_STRING_SERIAL 0x1Au
23static uint8_t *
dev_desc(USBD_SpeedTypeDef
s, uint16_t *len);
24static uint8_t *
lang_desc(USBD_SpeedTypeDef
s, uint16_t *len);
25static uint8_t *
mfr_desc(USBD_SpeedTypeDef
s, uint16_t *len);
26static uint8_t *
prod_desc(USBD_SpeedTypeDef
s, uint16_t *len);
27static uint8_t *
serial_desc(USBD_SpeedTypeDef
s, uint16_t *len);
28static uint8_t *
config_desc(USBD_SpeedTypeDef
s, uint16_t *len);
29static uint8_t *
itf_desc(USBD_SpeedTypeDef
s, uint16_t *len);
33#if (USBD_LPM_ENABLED == 1U)
38static uint8_t
s_dev[USB_LEN_DEV_DESC] __attribute__((aligned(4))) = {
39 0x12, USB_DESC_TYPE_DEVICE, 0x00, 0x02,
44 USBD_IDX_MFC_STR, USBD_IDX_PRODUCT_STR, USBD_IDX_SERIAL_STR,
48static uint8_t
s_lang[USB_LEN_LANGID_STR_DESC] __attribute__((aligned(4))) = {
55static uint8_t *
dev_desc(USBD_SpeedTypeDef
s, uint16_t *len) { (void)
s; *len =
sizeof s_dev;
return s_dev; }
64 for (uint8_t i = 0; i <
n; ++i) {
65 const uint8_t d = (uint8_t)(v >> 28);
66 p[2u * i] = (uint8_t)(d < 10u ?
'0' + d :
'A' + d - 10u);
76 const uint32_t w0 = HAL_GetUIDw0() + HAL_GetUIDw2(), w1 = HAL_GetUIDw1();
Configuration of the ST USB device library (third_party/st_usb) for the ACwing FC firmware: one CDC i...
#define USBD_MAX_STR_DESC_SIZ
#define USBD_MAX_NUM_CONFIGURATION
static uint8_t s_lang[USB_LEN_LANGID_STR_DESC]
static uint8_t * itf_desc(USBD_SpeedTypeDef s, uint16_t *len)
static uint8_t * mfr_desc(USBD_SpeedTypeDef s, uint16_t *len)
static uint8_t * serial_desc(USBD_SpeedTypeDef s, uint16_t *len)
#define USB_SIZ_STRING_SERIAL
static uint8_t * dev_desc(USBD_SpeedTypeDef s, uint16_t *len)
USBD_DescriptorsTypeDef ACW_FS_Desc
static uint8_t * config_desc(USBD_SpeedTypeDef s, uint16_t *len)
static uint8_t * prod_desc(USBD_SpeedTypeDef s, uint16_t *len)
static uint8_t s_str[USBD_MAX_STR_DESC_SIZ]
static void hex_unicode(uint32_t v, uint8_t *p, uint8_t n)
static uint8_t * lang_desc(USBD_SpeedTypeDef s, uint16_t *len)
static uint8_t s_dev[USB_LEN_DEV_DESC]
static uint8_t s_serial[USB_SIZ_STRING_SERIAL]
USB descriptors of the ACwing FC (see usbd_desc.c).