![]() |
USB Component
Version 6.0
MDK-Professional Middleware for USB Device and Host
|
Enable the USB Host to support Custom Class Devices. More...
Functions | |
int8_t | USBH_CustomClass_Configure (USBH_DEV *ptr_dev, USB_CONFIGURATION_DESCRIPTOR *ptr_cfg_desc) |
Callback function called when custom class device is connected and needs to configure resources used by custom class device instance. | |
usbStatus | USBH_CustomClass_Unconfigure (int8_t instance) |
Callback function called when custom class device is disconnected and needs to unconfigure resources used by custom class device instance. | |
usbStatus | USBH_CustomClass_Initialize (int8_t instance) |
Callback function called when custom class device is connected and needs to initialize custom class device instance. | |
usbStatus | USBH_CustomClass_Uninitialize (int8_t instance) |
Callback function called when custom class device is disconnected and needs to uninitialize custom class device instance. | |
Enable the USB Host to support Custom Class Devices.
The Custom Class in the USB Host Component is used for attaching USB Devices with a specific USB Class to your system. This can either be one of the standard classes that are not directly supported by the Middleware or a vendor specific custom class. Using these functions, you can add support for any USB Device class to the system.
Refer to:
To create an USB Host with support for the Custom class:
Configuration File USBH_Config_CustomClass.h
The USB Host Component has one configuration file for the Custom Device class: USBH_Config_CustomClass.h. This configuration file defines the maximum number of concurrent Custom Class Devices that may be attached to the system.
Code Example
int8_t USBH_CustomClass_Configure | ( | USBH_DEV * | ptr_dev, |
USB_CONFIGURATION_DESCRIPTOR * | ptr_cfg_desc | ||
) |
Callback function called when custom class device is connected and needs to configure resources used by custom class device instance.
[in] | ptr_dev | pointer to device structure. |
[in] | ptr_cfg_desc | pointer to configuration descriptor. |
The function USBH_Class_Configure should create all necessary endpoints for the custom class. It needs to be adapted to the specific needs of the Custom Class that is to be supported. For more information on the USB_CONFIGURATION_DESCRIPTOR
, please refer to Configuration Descriptor.
The argument ptr_dev specifies the pointer to the connected device.
The argument ptr_cfg_desc specifies the pointer to the configuration descriptor of the Custom Class.
usbStatus USBH_CustomClass_Initialize | ( | int8_t | instance | ) |
Callback function called when custom class device is connected and needs to initialize custom class device instance.
[in] | instance | index of custom class device instance. |
The function USBH_Class_Initialize initializes the Custom Class device when connected to the system. It needs to be adapted to the specific needs of the Custom Class that is to be supported.
The argument instance specifies device instance of the Custom Class USB Device.
usbStatus USBH_CustomClass_Unconfigure | ( | int8_t | instance | ) |
Callback function called when custom class device is disconnected and needs to unconfigure resources used by custom class device instance.
[in] | instance | index of custom class device instance. |
The function USBH_Class_Unconfigure should release all resources that were used by the Custom Class device after it has been uninitialized using USBH_CustomClass_Uninitialize. All endpoints relating to the Custom Class should be removed. It needs to be adapted to the specific needs of the Custom Class that is to be supported.
The argument instance specifies device instance of the Custom Class USB Device.
usbStatus USBH_CustomClass_Uninitialize | ( | int8_t | instance | ) |
Callback function called when custom class device is disconnected and needs to uninitialize custom class device instance.
[in] | instance | index of custom class device instance. |
The function USBH_Class_Uninitialize uninitializes the Custom Class device after it has been disconnected from the system. It needs to be adapted to the specific needs of the Custom Class that is to be supported.
The argument instance specifies device instance of the Custom Class USB Device.