USB Device high level library variable types definition

nRF5 SDK v17.0.2

nRF52840 only: All types used by USB Device high level library are defined here. This helps to avoid cross referencing into types in different files. More...

Files

file app_usbd_class_base.h
Base instance of a USBD class.

Data Structures

struct app_usbd_evt_t
Specific application event structure. More...
struct app_usbd_setup_evt_t
Specific application event structure with setup structure included. More...
union app_usbd_complex_evt_t
Complex event variable type. More...
union app_usbd_internal_evt_t
Internal event variable type. More...
struct app_usbd_class_inst_t

Macros

#define APP_USBD_BCD_2_MAKE (val)
Change given value to 2 digits in BCD notation. More...
#define APP_USBD_BCD_VER_MAKE (major, minor, sub)   (( APP_USBD_BCD_2_MAKE (major) << 8) | (minor) << 4 | (sub))
Change given decimal version values to 4 digits in BCD notation. More...
#define APP_USBD_EP_WITH_INTERVAL (address, interval)   ((1UL << 16) | ((interval) << 8) | (address))
Combine endpoint address and its interval. More...
#define APP_USBD_EXTRACT_INTERVAL_VALUE (combined)   (((combined) & 0xFF00) >> 8)
#define APP_USBD_EXTRACT_INTERVAL_FLAG (combined)   (((combined) >> 16) & 0x01)

Typedefs

typedef ret_code_t (* app_usbd_ep_event_handler_t )( app_usbd_class_inst_t const *const p_inst, app_usbd_complex_evt_t const *const p_event)
Endpoint callback function. More...
typedef void(* app_usbd_sof_interrupt_handler_t )(uint16_t framecnt)
SOF interrupt callback function. More...

Detailed Description

nRF52840 only: All types used by USB Device high level library are defined here. This helps to avoid cross referencing into types in different files.

Macro Definition Documentation

#define APP_USBD_BCD_2_MAKE ( val )
Value:
( \
((((val) % 100) / 10) * 0x10) + \
((((val) % 10) / 1) * 0x1) \
)

Change given value to 2 digits in BCD notation.

Parameters
[in] val The decimal value to be converted in the range from 0 to 99.
Returns
Calculated BCD value.
#define APP_USBD_BCD_VER_MAKE ( major,
minor,
sub
) (( APP_USBD_BCD_2_MAKE (major) << 8) | (minor) << 4 | (sub))

Change given decimal version values to 4 digits in BCD notation.

USB specification uses 4 digits BCD version notation in many descriptors. This macro changes 3 values to 4 BCD digits (one 16 bit value) that describes version in USB standard.

Parameters
[in] major Major version.
[in] minor Minor version.
[in] sub Sub-minor version.
Returns
Calculated 16 bit value with BCD representation of the version.
#define APP_USBD_EP_WITH_INTERVAL ( address,
interval
) ((1UL << 16) | ((interval) << 8) | (address))

Combine endpoint address and its interval.

Parameters
[in] address Endpoint address
[in] interval Endpoint interval
Returns
Combined address and interval.

Typedef Documentation

typedef ret_code_t (* app_usbd_ep_event_handler_t)( app_usbd_class_inst_t const *const p_inst, app_usbd_complex_evt_t const *const p_event)

Endpoint callback function.

The function used by every class instance.

Parameters
[in,out] p_inst Instance of the class.
[in] p_event Event to process.
Note
If given event is not supported by class, return NRF_ERROR_NOT_SUPPORTED
typedef void(* app_usbd_sof_interrupt_handler_t)(uint16_t framecnt)

SOF interrupt callback function.

Parameters
[in] framecnt Number of current SOF frame.
See Also
app_usbd_class_sof_register

Enumeration Type Documentation

Events codes.

Redefined application event codes.

Enumerator
APP_USBD_EVT_DRV_SOF

See documentation for NRF_DRV_USBD_EVT_SOF

APP_USBD_EVT_DRV_RESET

See documentation for NRF_DRV_USBD_EVT_RESET

APP_USBD_EVT_DRV_SUSPEND

See documentation for NRF_DRV_USBD_EVT_SUSPEND

APP_USBD_EVT_DRV_RESUME

See documentation for NRF_DRV_USBD_EVT_RESUME

APP_USBD_EVT_DRV_WUREQ

See documentation for NRF_DRV_USBD_EVT_WUREQ

APP_USBD_EVT_DRV_SETUP

This event type has special structure. See app_usbd_setup_evt_t

APP_USBD_EVT_DRV_EPTRANSFER

See documentation for NRF_DRV_USBD_EVT_EPTRANSFER

APP_USBD_EVT_FIRST_POWER

First power event code - for internal static assert checking

APP_USBD_EVT_POWER_DETECTED

See documentation for NRF_DRV_POWER_USB_EVT_DETECTED

APP_USBD_EVT_POWER_REMOVED

See documentation for NRF_DRV_POWER_USB_EVT_REMOVED

APP_USBD_EVT_POWER_READY

See documentation for NRF_DRV_POWER_USB_EVT_READY

APP_USBD_EVT_FIRST_APP

First application event code - for internal static assert checking

APP_USBD_EVT_INST_APPEND

The instance was attached to the library, any configuration action can be done now

APP_USBD_EVT_INST_REMOVE

The instance is going to be removed, this event is called just before removing the instance. This removing cannot be stopped.

APP_USBD_EVT_STARTED

USBD library has just been started and functional - event passed to all instances, before USBD interrupts have been enabled

APP_USBD_EVT_STOPPED

USBD library has just been stopped and is not functional - event passed to all instances, after USBD interrupts have been disabled

APP_USBD_EVT_STATE_CHANGED

Informs all the classes that base state has been changed. This event is processed before setup stage that caused the state change finishes (before acknowledging it).

APP_USBD_EVT_FIRST_INTERNAL

First internal event, used by the APP library internally.

APP_USBD_EVT_HFCLK_READY

High frequency clock started

APP_USBD_EVT_START_REQ

Start requested

APP_USBD_EVT_STOP_REQ

Stop requested

APP_USBD_EVT_SUSPEND_REQ

Suspend request - HFCLK would be released and USBD peripheral clock would be disconnected

APP_USBD_EVT_WAKEUP_REQ

Wakeup request - start the whole wakeup generation.

APP_USBD_EVT_SETUP_SETADDRESS

Setup request to set address, separated from regular EVT_SETUP because this request is fully handled by hardware and for the software it is only a notification about what happened