/ src / usb / usb_config.h
usb_config.h
 1  #pragma once
 2  
 3  #include <stdint.h>
 4  #include "app_usbd_langid.h"
 5  #include "global/global_strings.h"
 6  
 7  #ifdef __cplusplus
 8  extern "C" {
 9  #endif
10  
11  #define USB_VID									PRODUCT_USB_VID
12  #define USB_PID									PRODUCT_USB_PID
13  
14  #define USB_DEVICE_VERSION_MAJOR				PRODUCT_VERSION_MAJOR
15  #define USB_DEVICE_VERSION_MINIOR				PRODUCT_VERSION_MINOR
16  #define USB_DEVICE_VERSION_SUB_MINOR			PRODUCT_VERSION_SUB_MINOR
17  
18  #define USB_DEVICE_SELF_POWERED					1 // 1 for yes 'self powered', 0 for needs power
19  #define USB_DEVICE_MAX_POWER					500 // in mA
20  
21  #define USB_DEVICE_USE_UTF8_STRINGS				1 // 1 for yes 'uses utf8', 0 for ASCII only
22  
23  #define USB_DEVICE_LANGUAGE_IDS					APP_USBD_LANG_AND_SUBLANG(APP_USBD_LANG_ENGLISH, APP_USBD_SUBLANG_ENGLISH_US)
24  
25  extern uint8_t g_extern_usb_device_manufacturer[];
26  extern uint8_t g_extern_usb_device_product[];
27  extern uint8_t g_extern_serial_number[];
28  
29  #define USB_DEVICE_MANUFACTURER					g_extern_usb_device_manufacturer
30  #define USB_DEVICE_PRODUCT						g_extern_usb_device_product
31  #define USB_DEVICE_SERIAL						g_extern_serial_number
32  #define USB_DEVICE_CONFIGURATION_MODE_STRING	"Default configuration"
33  
34  // Default values for user strings.
35  // This value stores all application specific user strings with the default initialization.
36  // The setup is done by X-macros.
37  //  Expected macro parameters:
38  //  X(mnemonic, [=str_idx], ...)
39  //  -  mnemonic: Mnemonic of the string descriptor that would be added to
40  //               @ref app_usbd_string_desc_idx_t enumerator.
41  //  -  str_idx : String index value, can be set or left empty.
42  //               For example, WinUSB driver requires descriptor to be present on 0xEE index.
43  //               Then use X(USBD_STRING_WINUSB, =0xEE, (APP_USBD_STRING_DESC(...)))
44  //  -  ...     : List of string descriptors for each defined language.
45  #define USB_STRINGS_USER \
46  	X(APP_USER_1, , APP_USBD_STRING_DESC(PRODUCT_MANUFACTURER_URL)) \
47  	X(APP_USER_2, , APP_USBD_STRING_DESC(PRODUCT_MANUFACTURER))
48  
49  
50  void app_usbd_product_strings_generate(void);
51  
52  #ifdef __cplusplus
53  }
54  #endif