Been reading through the USB document and going through the codes but still having a bit of trouble grasping the concept of an interface. What would constitute an "interface"? Does it encapsulate a class with the associated class methods? Where in the code does it bind the "interface" to the class? When the host request for an "interface", what would it get in return or what would be the purpose of asking for an interface? For example, if a device declares that it has three interface, how does it associates each interface to the actual firmware codes? Thanks.
I don't know much about USB, but Milorad Cvjetkovic knows USB very well. Back to your last question, -> Would USBD_HandleTypeDef be considered an interface or a configuration?
I believe USBD_HandleTypeDef represents an USB device.
/** * @brief USBD_SetClassConfig * Configure device and start the interface * @param pdev: device instance * @param cfgidx: configuration index * @retval status */ USBD_StatusTypeDef USBD_SetClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx) { USBD_StatusTypeDef ret = USBD_FAIL; if(pdev->pClass != NULL) { /* Set configuration and Start the Class*/ if(pdev->pClass->Init(pdev, cfgidx) == 0) { ret = USBD_OK; } } return ret; } /** * @brief USBD_ClrClassConfig * Clear current configuration * @param pdev: device instance * @param cfgidx: configuration index * @retval status: USBD_StatusTypeDef */ USBD_StatusTypeDef USBD_ClrClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx) { /* Clear configuration and Deinitialize the Class process*/ pdev->pClass->DeInit(pdev, cfgidx); return USBD_OK; }