nRF52840 only: Module with generic HID event data processing. More...
Modules | |
USB HID class types | |
nRF52840 only: Module with types and definitions used by HID modules. | |
USB HID class configuration | |
USB HID generic | |
nRF52840 only: Module with types, definitions, and API used by the HID generic class. | |
USB HID keyboard | |
nRF52840 only: Module with types, definitions, and API used by the HID keyboard class. | |
USB HID mouse | |
nRF52840 only: Module with types, definitions, and API used by the HID mouse class. | |
Data Structures | |
struct | app_usbd_hid_methods_t |
HID unified interface. More... | |
struct | app_usbd_hid_report_buffer_t |
HID report buffers. More... | |
struct | app_usbd_hid_subclass_desc_t |
HID subclass descriptor. More... | |
struct | app_usbd_hid_inst_t |
USB HID instance. More... | |
struct | app_usbd_hid_ctx_t |
HID internal context. More... | |
Macros | |
#define | APP_USBD_HID_IFACE_IDX 0 |
HID instance interface index. | |
#define | APP_USBD_HID_EPIN_IDX 0 |
HID instance endpoint IN index. | |
#define | APP_USBD_HID_EPOUT_IDX 1 |
HID instance endpoint OUT index. | |
#define | APP_USBD_HID_GENERIC_GLOBAL_OUT_REP_DEF(name, rep_size) |
Define OUT report buffer structure app_usbd_hid_report_buffer_t. More... | |
#define | APP_USBD_HID_GENERIC_SUBCLASS_REPORT_DESC(name,...) |
Initializer of HID report descriptor. More... | |
#define | APP_USBD_HID_GENERIC_SUBCLASS_PHYSICAL_DESC(name,...) |
Initializer of HID physical descriptor. More... | |
#define | APP_USBD_HID_INST_CONFIG(subclass_dsc,sub_boot,protocl,report_buff_in,report_buff_out,user_ev_handler,hid_methods,ep_list) |
USB HID instance initializer app_usbd_hid_inst_t. More... | |
Typedefs | |
typedef void(* | app_usbd_hid_user_ev_handler_t )(app_usbd_class_inst_t const *p_inst, app_usbd_hid_user_event_t event) |
User event handler. More... | |
typedef ret_code_t(* | app_usbd_hid_idle_handler_t )(app_usbd_class_inst_t const *p_inst, uint8_t report_id) |
Idle report handler. More... | |
Enumerations | |
enum | app_usbd_hid_state_flag_t { APP_USBD_HID_STATE_FLAG_APPENDED = 0, APP_USBD_HID_STATE_FLAG_STARTED = 1, APP_USBD_HID_STATE_FLAG_SUSPENDED = 2, APP_USBD_HID_STATE_FLAG_TRANS_IN_PROGRESS = 3 } |
HID context state flags. More... | |
enum | app_usbd_hid_user_event_t { APP_USBD_HID_USER_EVT_SET_BOOT_PROTO, APP_USBD_HID_USER_EVT_SET_REPORT_PROTO, APP_USBD_HID_USER_EVT_OUT_REPORT_READY, APP_USBD_HID_USER_EVT_IN_REPORT_DONE } |
Events passed to user event handler. More... | |
nRF52840 only: Module with generic HID event data processing.
#define APP_USBD_HID_GENERIC_GLOBAL_OUT_REP_DEF | ( | name, | |
rep_size | |||
) |
Define OUT report buffer structure app_usbd_hid_report_buffer_t.
name | Instance name. |
rep_size | Output report size. |
#define APP_USBD_HID_GENERIC_SUBCLASS_PHYSICAL_DESC | ( | name, | |
... | |||
) |
Initializer of HID physical descriptor.
name | Physical descriptor name |
... | Physical descriptor data |
#define APP_USBD_HID_GENERIC_SUBCLASS_REPORT_DESC | ( | name, | |
... | |||
) |
Initializer of HID report descriptor.
name | Report descriptor name |
... | Report descriptor data |
#define APP_USBD_HID_INST_CONFIG | ( | subclass_dsc, | |
sub_boot, | |||
protocl, | |||
report_buff_in, | |||
report_buff_out, | |||
user_ev_handler, | |||
hid_methods, | |||
ep_list | |||
) |
USB HID instance initializer app_usbd_hid_inst_t.
subclass_dsc | HID subclass descriptors. |
sub_boot | Subclass boot. (app_usbd_hid_subclass_t) |
protocl | HID protocol. (app_usbd_hid_protocol_t) |
report_buff_in | Input report buffer list. |
report_buff_out | Output report buffer. |
user_ev_handler | app_usbd_hid_user_ev_handler_t. |
hid_methods | app_usbd_hid_methods_t. |
ep_list | List of endpoints and intervals |
typedef ret_code_t(* app_usbd_hid_idle_handler_t)(app_usbd_class_inst_t const *p_inst, uint8_t report_id) |
Idle report handler.
[in] | p_inst | Class instance. |
[in] | report_id | Number of report ID that needs idle transfer. |
typedef void(* app_usbd_hid_user_ev_handler_t)(app_usbd_class_inst_t const *p_inst, app_usbd_hid_user_event_t event) |
User event handler.
[in] | p_inst | Class instance. |
[in] | event | User event. |
HID context state flags.
Bit numbers in app_usbd_hid_ctx_t::state_flags.
Events passed to user event handler.
|
inlinestatic |
Locks internal hid context.
Simple semaphore functionality to prevent concurrent access from application and interrupt to internal mouse data.
[in] | p_hid_ctx | Internal hid context |
|
inlinestatic |
Tests whether internal lock is acquired.
[in] | p_hid_ctx | Internal HID context. |
true | Locked. |
false | Unlocked. |
|
inlinestatic |
Unlocks internal hid context.
Simple semaphore functionality to prevent concurrent access from application and interrupt to internal mouse data.
[in] | p_hid_ctx | Internal hid context. |
|
inlinestatic |
Auxiliary function to access to HID IN endpoint address.
[in] | p_inst | Class instance data. |
<HID instance interface index.
<HID instance endpoint IN index.
|
inlinestatic |
Auxiliary function to access to HID generic OUT endpoint address.
[in] | p_inst | Class instance data. |
<HID instance interface index.
<HID instance endpoint OUT index.
ret_code_t app_usbd_hid_event_handler | ( | app_usbd_class_inst_t const * | p_inst, |
app_usbd_hid_inst_t const * | p_hinst, | ||
app_usbd_hid_ctx_t * | p_hid_ctx, | ||
app_usbd_complex_evt_t const * | p_event | ||
) |
HID generic event handler.
This handler should process every class event after specific class handler. This approach allow to handle some events in the same way in all HID sub-classes.
[in] | p_inst | Generic class instance. |
[in] | p_hinst | HID class instance. |
[in] | p_hid_ctx | HID context. |
[in] | p_event | Complex event structure. |
app_usbd_hid_report_buffer_t* app_usbd_hid_rep_buff_in_get | ( | app_usbd_hid_inst_t const * | p_hinst | ) |
Returns IN report buffer.
[in] | p_hinst | HID class instance. |
|
inlinestatic |
Returns OUT report buffer.
Output reports are handled in interrupt handler so only one buffer is required. Buffer returned by this function has predefined size, which should be equal (maximum OUTPUT report size + 1). To receive OUT report this function should be called on APP_USBD_HID_USER_EVT_OUT_REPORT_READY event.
[in] | p_hinst | HID class instance. |
|
inlinestatic |
Returns HID selected protocol.
[in] | p_hid_ctx | HID context. |
|
inlinestatic |
Clear one of the HID internal state flags.
[in] | p_hid_ctx | Internal HID context. |
[in] | flag | Flag to clear. |
|
inlinestatic |
Set one of the HID internal state flags.
[in] | p_hid_ctx | Internal HID context. |
[in] | flag | Flag to set. |
|
inlinestatic |
Test one of the HID internal state flags.
[in] | p_hid_ctx | Internal HID context. |
[in] | flag | Flag to test. |
true | Flag is set. |
false | Flag is not set. |
|
inlinestatic |
Validates internal hid state.
HID Mouse has to receive some USBD events before functions from this module could be used.
[in] | p_hid_ctx | Internal hid context. |
true | State is valid. |
false | State is invalid. |
|
inlinestatic |
Checks whether HID endpoint transfer required.
[in] | p_hid_ctx | Internal HID context. |
true | Input endpoint transfer required. |
false | Transfer in progress or not allowed. |