| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #include "usb_device.h"
- #include "usbd_core.h"
- #include "usbd_desc.h"
- #include "usbd_vendor.h"
- #include "usbd_usbtmc.h"
- /* USB Device Core handle declaration. */
- static USBD_HandleTypeDef hUsbDeviceFS;
- /**
- * Init USB device Library, add supported class and start the library
- * @retval None
- */
- void USB_Device_Init( eUSBDeviceInterface_t ifaceId )
- {
- // Init Device Library, add supported class and start the library
- // Only one interface can be registered at the same time!
- switch( ifaceId )
- {
- default:
- case eUSBIfaceVendor:
- USBD_Init(&hUsbDeviceFS, &USBD_COMMON_Desc, DEVICE_FS);
- USBD_RegisterClass(&hUsbDeviceFS, &USBD_VENDOR);
- USBD_COMMON_RegisterInterface(&hUsbDeviceFS, &USBD_Interface_Vendor_UsbInterface);
- USBD_Start(&hUsbDeviceFS);
- break;
- #if CONFIG_USB_USBTMC_ENABLE
- case eUSBIfaceTMC:
- USBD_Init(&hUsbDeviceFS, &USBD_COMMON_Desc, DEVICE_FS);
- USBD_RegisterClass(&hUsbDeviceFS, &USBD_USBTMC);
- USBD_COMMON_RegisterInterface(&hUsbDeviceFS, &USBD_Interface_Usbtmc_UsbInterface);
- USBD_Start(&hUsbDeviceFS);
- break;
- #endif
- }
- }
- void USB_Device_DeInit()
- {
- USBD_Stop( &hUsbDeviceFS );
- USBD_DeInit( &hUsbDeviceFS );
- }
|