ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
Loading...
Searching...
No Matches
usbd_desc.c File Reference

USB descriptors of the ACwing FC (CDC virtual COM port). More...

#include "usbd_core.h"
#include "usbd_conf.h"
#include "usbd_desc.h"
Include dependency graph for usbd_desc.c:

Go to the source code of this file.

Macros

#define USBD_VID   0x0483u
 
#define USBD_PID   0x5740u
 
#define USBD_LANGID   0x0409u
 
#define STR_MANUFACTURER   "ACwing"
 
#define STR_PRODUCT   "ACwing FC"
 
#define STR_CONFIG   "CDC Config"
 
#define STR_INTERFACE   "CDC Interface"
 
#define USB_SIZ_STRING_SERIAL   0x1Au
 

Functions

static uint8_t * dev_desc (USBD_SpeedTypeDef s, uint16_t *len)
 
static uint8_t * lang_desc (USBD_SpeedTypeDef s, uint16_t *len)
 
static uint8_t * mfr_desc (USBD_SpeedTypeDef s, uint16_t *len)
 
static uint8_t * prod_desc (USBD_SpeedTypeDef s, uint16_t *len)
 
static uint8_t * serial_desc (USBD_SpeedTypeDef s, uint16_t *len)
 
static uint8_t * config_desc (USBD_SpeedTypeDef s, uint16_t *len)
 
static uint8_t * itf_desc (USBD_SpeedTypeDef s, uint16_t *len)
 
static void hex_unicode (uint32_t v, uint8_t *p, uint8_t n)
 

Variables

USBD_DescriptorsTypeDef ACW_FS_Desc
 
static uint8_t s_dev [USB_LEN_DEV_DESC]
 
static uint8_t s_lang [USB_LEN_LANGID_STR_DESC]
 
static uint8_t s_str [USBD_MAX_STR_DESC_SIZ]
 
static uint8_t s_serial [USB_SIZ_STRING_SERIAL] = { USB_SIZ_STRING_SERIAL, USB_DESC_TYPE_STRING }
 

Detailed Description

USB descriptors of the ACwing FC (CDC virtual COM port).

VID/PID: 0x0483/0x5740, ST's "Virtual COM Port" pair used by the STM32Cube CDC examples, so the standard CDC-ACM drivers bind on every OS. It is fine for development; a product needs its own VID/PID. Written after the ST template usbd_desc_template.c.

Definition in file usbd_desc.c.

Macro Definition Documentation

◆ USBD_VID

#define USBD_VID   0x0483u

Definition at line 14 of file usbd_desc.c.

◆ USBD_PID

#define USBD_PID   0x5740u

Definition at line 15 of file usbd_desc.c.

◆ USBD_LANGID

#define USBD_LANGID   0x0409u

Definition at line 16 of file usbd_desc.c.

◆ STR_MANUFACTURER

#define STR_MANUFACTURER   "ACwing"

Definition at line 17 of file usbd_desc.c.

◆ STR_PRODUCT

#define STR_PRODUCT   "ACwing FC"

Definition at line 18 of file usbd_desc.c.

◆ STR_CONFIG

#define STR_CONFIG   "CDC Config"

Definition at line 19 of file usbd_desc.c.

◆ STR_INTERFACE

#define STR_INTERFACE   "CDC Interface"

Definition at line 20 of file usbd_desc.c.

◆ USB_SIZ_STRING_SERIAL

#define USB_SIZ_STRING_SERIAL   0x1Au

Definition at line 21 of file usbd_desc.c.

Function Documentation

◆ dev_desc()

static uint8_t * dev_desc ( USBD_SpeedTypeDef  s,
uint16_t *  len 
)
static

Definition at line 55 of file usbd_desc.c.

References s, and s_dev.

◆ lang_desc()

static uint8_t * lang_desc ( USBD_SpeedTypeDef  s,
uint16_t *  len 
)
static

Definition at line 56 of file usbd_desc.c.

References s, and s_lang.

◆ mfr_desc()

static uint8_t * mfr_desc ( USBD_SpeedTypeDef  s,
uint16_t *  len 
)
static

Definition at line 57 of file usbd_desc.c.

References s, s_str, and STR_MANUFACTURER.

◆ prod_desc()

static uint8_t * prod_desc ( USBD_SpeedTypeDef  s,
uint16_t *  len 
)
static

Definition at line 58 of file usbd_desc.c.

References s, s_str, and STR_PRODUCT.

◆ serial_desc()

static uint8_t * serial_desc ( USBD_SpeedTypeDef  s,
uint16_t *  len 
)
static

Definition at line 73 of file usbd_desc.c.

References hex_unicode(), s, s_serial, and USB_SIZ_STRING_SERIAL.

Here is the call graph for this function:

◆ config_desc()

static uint8_t * config_desc ( USBD_SpeedTypeDef  s,
uint16_t *  len 
)
static

Definition at line 59 of file usbd_desc.c.

References s, s_str, and STR_CONFIG.

◆ itf_desc()

static uint8_t * itf_desc ( USBD_SpeedTypeDef  s,
uint16_t *  len 
)
static

Definition at line 60 of file usbd_desc.c.

References s, s_str, and STR_INTERFACE.

◆ hex_unicode()

static void hex_unicode ( uint32_t  v,
uint8_t *  p,
uint8_t  n 
)
static

Definition at line 62 of file usbd_desc.c.

References n.

Referenced by serial_desc().

Here is the caller graph for this function:

Variable Documentation

◆ ACW_FS_Desc

USBD_DescriptorsTypeDef ACW_FS_Desc
Initial value:
= {
}
static uint8_t * itf_desc(USBD_SpeedTypeDef s, uint16_t *len)
Definition usbd_desc.c:60
static uint8_t * mfr_desc(USBD_SpeedTypeDef s, uint16_t *len)
Definition usbd_desc.c:57
static uint8_t * serial_desc(USBD_SpeedTypeDef s, uint16_t *len)
Definition usbd_desc.c:73
static uint8_t * dev_desc(USBD_SpeedTypeDef s, uint16_t *len)
Definition usbd_desc.c:55
static uint8_t * config_desc(USBD_SpeedTypeDef s, uint16_t *len)
Definition usbd_desc.c:59
static uint8_t * prod_desc(USBD_SpeedTypeDef s, uint16_t *len)
Definition usbd_desc.c:58
static uint8_t * lang_desc(USBD_SpeedTypeDef s, uint16_t *len)
Definition usbd_desc.c:56

Definition at line 31 of file usbd_desc.c.

Referenced by usb_cdc_init().

◆ s_dev

uint8_t s_dev[USB_LEN_DEV_DESC]
static
Initial value:
= {
0x12, USB_DESC_TYPE_DEVICE, 0x00, 0x02,
0x02, 0x02, 0x00,
USB_MAX_EP0_SIZE,
LOBYTE(USBD_VID), HIBYTE(USBD_VID), LOBYTE(USBD_PID), HIBYTE(USBD_PID),
0x00, 0x02,
USBD_IDX_MFC_STR, USBD_IDX_PRODUCT_STR, USBD_IDX_SERIAL_STR,
}
#define USBD_MAX_NUM_CONFIGURATION
Definition usbd_conf.h:17
#define USBD_PID
Definition usbd_desc.c:15
#define USBD_VID
Definition usbd_desc.c:14

Definition at line 38 of file usbd_desc.c.

Referenced by dev_desc().

◆ s_lang

uint8_t s_lang[USB_LEN_LANGID_STR_DESC]
static
Initial value:
= {
USB_LEN_LANGID_STR_DESC, USB_DESC_TYPE_STRING, LOBYTE(USBD_LANGID), HIBYTE(USBD_LANGID)
}
#define USBD_LANGID
Definition usbd_desc.c:16

Definition at line 48 of file usbd_desc.c.

Referenced by lang_desc().

◆ s_str

uint8_t s_str[USBD_MAX_STR_DESC_SIZ]
static

Definition at line 52 of file usbd_desc.c.

Referenced by config_desc(), itf_desc(), mfr_desc(), and prod_desc().

◆ s_serial

uint8_t s_serial[USB_SIZ_STRING_SERIAL] = { USB_SIZ_STRING_SERIAL, USB_DESC_TYPE_STRING }
static

Definition at line 53 of file usbd_desc.c.

Referenced by serial_desc().