nRF5 SDK v17.1.0
Files | Data Structures | Macros | Typedefs | Enumerations
USB Device high level library variable types definition

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...
 

Enumerations

enum  app_usbd_event_type_t {
  APP_USBD_EVT_DRV_SOF = NRF_DRV_USBD_EVT_SOF,
  APP_USBD_EVT_DRV_RESET = NRF_DRV_USBD_EVT_RESET,
  APP_USBD_EVT_DRV_SUSPEND = NRF_DRV_USBD_EVT_SUSPEND,
  APP_USBD_EVT_DRV_RESUME = NRF_DRV_USBD_EVT_RESUME,
  APP_USBD_EVT_DRV_WUREQ = NRF_DRV_USBD_EVT_WUREQ,
  APP_USBD_EVT_DRV_SETUP = NRF_DRV_USBD_EVT_SETUP,
  APP_USBD_EVT_DRV_EPTRANSFER = NRF_DRV_USBD_EVT_EPTRANSFER,
  APP_USBD_EVT_FIRST_POWER,
  APP_USBD_EVT_POWER_DETECTED,
  APP_USBD_EVT_POWER_REMOVED,
  APP_USBD_EVT_POWER_READY,
  APP_USBD_EVT_FIRST_APP,
  APP_USBD_EVT_INST_APPEND = APP_USBD_EVT_FIRST_APP,
  APP_USBD_EVT_INST_REMOVE,
  APP_USBD_EVT_STARTED,
  APP_USBD_EVT_STOPPED,
  APP_USBD_EVT_STATE_CHANGED,
  APP_USBD_EVT_FIRST_INTERNAL = 0x80,
  APP_USBD_EVT_HFCLK_READY = APP_USBD_EVT_FIRST_INTERNAL,
  APP_USBD_EVT_START_REQ,
  APP_USBD_EVT_STOP_REQ,
  APP_USBD_EVT_SUSPEND_REQ,
  APP_USBD_EVT_WAKEUP_REQ,
  APP_USBD_EVT_SETUP_SETADDRESS
}
 Events codes. 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]valThe 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]majorMajor version.
[in]minorMinor version.
[in]subSub-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]addressEndpoint address
[in]intervalEndpoint 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_instInstance of the class.
[in]p_eventEvent 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]framecntNumber 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


Documentation feedback | Developer Zone | Subscribe | Updated