Ejemplo n.º 1
0
/**
 * Invoked when the configuration of the device changes. Resets the mass
 * storage driver.
 * \param  pMsdDriver  Pointer to MSDDriver instance.
 * \param  cfgnum      New configuration number.
 */
void MSDDriver_ConfigurationChangeHandler(
	uint8_t cfgnum)
{
	USBDDriver *pUsbd = USBD_GetDriver();
	USBConfigurationDescriptor *pDesc;

	if (cfgnum) {
		pDesc = USBDDriver_GetCfgDescriptors(pUsbd, cfgnum);
		MSDFunction_Configure((USBGenericDescriptor *)pDesc,
							  pDesc->wTotalLength);
	}
}
Ejemplo n.º 2
0
/**
 * Invoked whenever the configuration value of a device is changed by the host
 * \param cfgnum Configuration number.
 */
void HIDMSDDriver_ConfigurationChangedHandler(uint8_t cfgnum)
{
    USBDDriver *pUsbd = USBD_GetDriver();
    USBConfigurationDescriptor *pDesc;
    if (cfgnum > 0) {
        pDesc = USBDDriver_GetCfgDescriptors(pUsbd, cfgnum);
        /* HID */
        HIDDKeyboard_ConfigureFunction((USBGenericDescriptor*)pDesc,
                                        pDesc->wTotalLength);
        /* MSD */
        MSDFunction_Configure((USBGenericDescriptor*)pDesc,
                              pDesc->wTotalLength);
    }
}
Ejemplo n.º 3
0
/**
 * 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);
    }
}