/**
 * Invoked whenever the configuration value of a device is changed by the host
 * \param cfgnum Configuration number.
 */
void CDCMSDDriver_ConfigurationChangedHandler(unsigned char cfgnum)
{
    USBDDriver *pUsbd = USBD_GetDriver();
    USBConfigurationDescriptor *pDesc;
    if (cfgnum > 0) {
        pDesc = USBDDriver_GetCfgDescriptors(pUsbd, cfgnum);
        /* CDC */
        CDCDSerial_ConfigureFunction((USBGenericDescriptor*)pDesc,
                                      pDesc->wTotalLength);
        /* MSD */
        MSDFunction_Configure((USBGenericDescriptor*)pDesc,
                              pDesc->wTotalLength);
    }
}
Example #2
0
/**
 * Invoked whenever the configuration value of a device is changed by the host
 * \param cfgnum Configuration number.
 */
void CDCHIDDDriver_ConfigurationChangedHandler(uint8_t cfgnum)
{
	USBDDriver *pUsbd = USBD_GetDriver();
	USBConfigurationDescriptor *pDesc;

	if (cfgnum > 0) {
		pDesc = USBDDriver_GetCfgDescriptors(pUsbd, cfgnum);
		/* CDC */
		CDCDSerial_ConfigureFunction((USBGenericDescriptor *)pDesc,
									 pDesc->wTotalLength);
		/* HID */
		HIDDKeyboard_ConfigureFunction((USBGenericDescriptor *)pDesc,
									   pDesc->wTotalLength);
	}
}