Class interface function set. More...
#include <app_usbd_class_base.h>
Data Fields |
|
| ret_code_t (* | event_handler )( app_usbd_class_inst_t const *const p_inst, app_usbd_complex_evt_t const *const p_event) |
|
Instance callback function.
More...
|
|
| bool(* | feed_descriptors )( app_usbd_class_descriptor_ctx_t *p_ctx, app_usbd_class_inst_t const *p_inst, uint8_t *p_buff, size_t max_size) |
|
Instance feed descriptors.
More...
|
|
| ret_code_t (* | iface_select )( app_usbd_class_inst_t const *const p_inst, uint8_t iface_idx, uint8_t alternate) |
|
Select interface.
More...
|
|
| void(* | iface_deselect )( app_usbd_class_inst_t const *const p_inst, uint8_t iface_idx) |
|
Deselect interface.
More...
|
|
| uint8_t(* | iface_selection_get )( app_usbd_class_inst_t const *const p_inst, uint8_t iface_idx) |
|
Get current interface.
More...
|
|
Detailed Description
Class interface function set.
Field Documentation
| ret_code_t (* app_usbd_class_methods_t::event_handler)( app_usbd_class_inst_t const *const p_inst, app_usbd_complex_evt_t const *const p_event) |
Instance callback function.
The function used by every class instance.
- Parameters
-
[in,out] p_inst Instance of the class. [in] p_event Event to process.
- Returns
- Standard error code.
- Note
- If given event is not supported by class, return NRF_ERROR_NOT_SUPPORTED
| bool(* app_usbd_class_methods_t::feed_descriptors)( app_usbd_class_descriptor_ctx_t *p_ctx, app_usbd_class_inst_t const *p_inst, uint8_t *p_buff, size_t max_size) |
Instance feed descriptors.
Feeds whole descriptor of the instance.
- Parameters
-
[in] p_ctx Class descriptor context. [in,out] p_inst Instance of the class. [out] p_buff Buffer for descriptor. [in] max_size Requested size of the descriptor.
- Returns
- True if not finished feeding the descriptor, false if done.
| void(* app_usbd_class_methods_t::iface_deselect)( app_usbd_class_inst_t const *const p_inst, uint8_t iface_idx) |
Deselect interface.
Function called when the class interface has to be deselected.
This function would be called for every interface when:
- Library start internal event is processed by the default handler
- RESET event is processed by the default handler
- SET_ADDRESS is processed by the default handler
- SET_CONFIG(0) is processed by the default handler
- Note
- Just after this function is called all the interface endpoints would be disabled. This function does not has to take care about it.
- If this function pointer is NULL default procedure would just disable all the interface endpoints.
- Parameters
-
[in,out] p_inst Instance of the class. [in] iface_idx Index of the interface inside class structure.
| ret_code_t (* app_usbd_class_methods_t::iface_select)( app_usbd_class_inst_t const *const p_inst, uint8_t iface_idx, uint8_t alternate) |
Select interface.
Function called when class interface has to be selected.
This function would be called for every interface when:
- SET_INTERFACE command is processed by the default handler
- SET_CONFIG(1) command is processed by the default handler
- Note
- Remember to disable all the endpoints that are not used in the selected configuration.
- If this function pointer is NULL default procedure would just enable all the interface endpoints and selecting alternate configurations other than 0 would generate error.
- Calling the function with alternate setting 0 has to always succeed.
- Parameters
-
[in,out] p_inst Instance of the class [in] iface_idx Index of the interface inside class structure [in] alternate Alternate setting that should be selected
- Returns
- Function has to return NRF_SUCCESS when it has successfully proceed interface selection. If it returns NRF_ERROR_NOT_SUPPORTED , default function would be used to proceed the request - just like there would be NULL pointer in this field. Any other kind of error would make library to STALL the request.
| uint8_t(* app_usbd_class_methods_t::iface_selection_get)( app_usbd_class_inst_t const *const p_inst, uint8_t iface_idx) |
Get current interface.
Function called when class interface has to return its alternate settings in reaction on GET_INTERFACE command. It should be defined in a pair with app_usbd_class_methods_t::iface_select .
- Parameters
-
[in] p_inst Instance of the class. [in] iface_idx Index of the interface inside class structure.
- Returns
- Current alternate setting of the selected interface.
- Note
- For the classes that support this function, when an interface that has not alternate configurations has been selected this function has to return 0 - default alternate setting.
- If this function pointer it NULL default procedure would return alternate interface value 0.
- components/libraries/usbd/app_usbd_class_base.h