nRF5 SDK v13.0.0
Modules | Macros | Enumerations | Functions
USBD string descriptors

nRF52840 only: USBD string descriptors management. More...

Modules

 USBD string configuration
 nRF52840 only: Configuration of the string module that can be easily affected by the final user.
 

Macros

#define APP_USBD_STRING_DESC(...)
 USB string initialization. More...
 

Enumerations

enum  app_usbd_string_desc_idx_t {
  APP_USBD_STRING_ID_LANGIDS = 0,
  APP_USBD_STRING_ID_MANUFACTURER,
  APP_USBD_STRING_ID_PRODUCT,
  APP_USBD_STRING_ID_SERIAL,
  APP_USBD_STRING_ID_CNT
}
 USB string descriptors ID's. More...
 

Functions

uint16_t const * app_usbd_string_desc_get (app_usbd_string_desc_idx_t idx, uint16_t langid)
 Get string descriptor. More...
 
static size_t app_usbd_string_desc_length (uint16_t const *p_str)
 Get string length. More...
 

Detailed Description

nRF52840 only: USBD string descriptors management.

Macro Definition Documentation

#define APP_USBD_STRING_DESC (   ...)
Value:
(const uint16_t[]){ \
(0xff & (sizeof((uint16_t[]){__VA_ARGS__}) + 2)) | \
((uint16_t)APP_USBD_DESCRIPTOR_STRING) << 8, \
__VA_ARGS__ }

USB string initialization.

Macro that creates initialization values for USB string. The format contains header and string itself. The string should be declared as an array of uint16_t type.

Parameters
[in]...Comma separated string letters or language ID.
Returns
String descriptor initialization data.

Enumeration Type Documentation

USB string descriptors ID's.

Enumerator
APP_USBD_STRING_ID_LANGIDS 

Supported language identifiers

APP_USBD_STRING_ID_MANUFACTURER 

Manufacturer name

APP_USBD_STRING_ID_PRODUCT 

Product name

APP_USBD_STRING_ID_SERIAL 

Serial number

APP_USBD_STRING_ID_CNT 

Total number of identifiers

Function Documentation

uint16_t const* app_usbd_string_desc_get ( app_usbd_string_desc_idx_t  idx,
uint16_t  langid 
)

Get string descriptor.

Parameters
[in]idxString descriptor index
[in]langidSelected language for the string
Returns
String descriptor or NULL if not exist
static size_t app_usbd_string_desc_length ( uint16_t const *  p_str)
inlinestatic

Get string length.

Function to get string length from descriptor (descriptor returned by app_usbd_string_desc_get)

Parameters
[in]p_strString descriptor pointer
Returns
Total descriptor length in bytes

Documentation feedback | Developer Zone | Subscribe | Updated