This module provides highly customisable, multilingual string descriptor module.
The configuration is stored in the app_usbd_string_config.h
file. In the top of the file, a list of supported languages must be defined. Use the values defined in app_usbd_langid.h
. The first defined language is always the default one.
To create string descriptors, use the APP_USBD_STRING_DESC macro. If more than one language is supported, every string should contain two comma-separated values. If only one string is defined, NULL will be set for all other strings and the library will use the string from the default language.
Standard descriptors supported:
Any of these string descriptors may be set using APP_USBD_STRING_DESC or a comma-separated list of these macros, if multilingual support is used. For example:
Standard strings can be simply placed outside of the string module. This allows for generating a serial number. The USB CDC ACM Example uses this functionality.
Every standard string in a configuration file, has an additional definition in the form of: APP_USBD_STRINGS_<string>_EXTERN
. If you set this macro to a value other than 0, then you will be responsible for memory allocation and initialisation of the selected string. Use it in the following way:
In another file:
It is also possible to declare any number of user descriptors. You can define them using the X macro technique. See the following example of declaring three user descriptors, one of which has an ID that equals 12:
It is universal enough to define any user descriptor with any identifier. For example, the WinUSB driver requires a descriptor to be present on the 0xEE index: