Subversion Repositories dashGPS

Rev

Rev 16 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /* USER CODE BEGIN Header */
  2. /**
  3.   ******************************************************************************
  4.   * @file           : usb_device.c
  5.   * @version        : v2.0_Cube
  6.   * @brief          : This file implements the USB Device
  7.   ******************************************************************************
  8.   * @attention
  9.   *
  10.   * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
  11.   * All rights reserved.</center></h2>
  12.   *
  13.   * This software component is licensed by ST under Ultimate Liberty license
  14.   * SLA0044, the "License"; You may not use this file except in compliance with
  15.   * the License. You may obtain a copy of the License at:
  16.   *                             www.st.com/SLA0044
  17.   *
  18.   ******************************************************************************
  19.   */
  20. /* USER CODE END Header */
  21.  
  22. /* Includes ------------------------------------------------------------------*/
  23.  
  24. #include "usb_device.h"
  25. #include "usbd_core.h"
  26. #include "usbd_desc.h"
  27. #include "usbd_cdc.h"
  28. #include "usbd_cdc_if.h"
  29.  
  30. /* USER CODE BEGIN Includes */
  31.  
  32. /* USER CODE END Includes */
  33.  
  34. /* USER CODE BEGIN PV */
  35. /* Private variables ---------------------------------------------------------*/
  36.  
  37. /* USER CODE END PV */
  38.  
  39. /* USER CODE BEGIN PFP */
  40. /* Private function prototypes -----------------------------------------------*/
  41.  
  42. /* USER CODE END PFP */
  43.  
  44. /* USB Device Core handle declaration. */
  45. USBD_HandleTypeDef hUsbDeviceFS;
  46.  
  47. /*
  48.  * -- Insert your variables declaration here --
  49.  */
  50. /* USER CODE BEGIN 0 */
  51.  
  52. /* USER CODE END 0 */
  53.  
  54. /*
  55.  * -- Insert your external function declaration here --
  56.  */
  57. /* USER CODE BEGIN 1 */
  58.  
  59. /* USER CODE END 1 */
  60.  
  61. /**
  62.   * Init USB device Library, add supported class and start the library
  63.   * @retval None
  64.   */
  65. void MX_USB_DEVICE_Init(void)
  66. {
  67.   /* USER CODE BEGIN USB_DEVICE_Init_PreTreatment */
  68.  
  69.   /* USER CODE END USB_DEVICE_Init_PreTreatment */
  70.  
  71.   /* Init Device Library, add supported class and start the library. */
  72.   if (USBD_Init(&hUsbDeviceFS, &FS_Desc, DEVICE_FS) != USBD_OK)
  73.   {
  74.     Error_Handler();
  75.   }
  76.   if (USBD_RegisterClass(&hUsbDeviceFS, &USBD_CDC) != USBD_OK)
  77.   {
  78.     Error_Handler();
  79.   }
  80.   if (USBD_CDC_RegisterInterface(&hUsbDeviceFS, &USBD_Interface_fops_FS) != USBD_OK)
  81.   {
  82.     Error_Handler();
  83.   }
  84.   if (USBD_Start(&hUsbDeviceFS) != USBD_OK)
  85.   {
  86.     Error_Handler();
  87.   }
  88.  
  89.   /* USER CODE BEGIN USB_DEVICE_Init_PostTreatment */
  90.  
  91.   /* USER CODE END USB_DEVICE_Init_PostTreatment */
  92. }
  93.  
  94. /**
  95.   * @}
  96.   */
  97.  
  98. /**
  99.   * @}
  100.   */
  101.  
  102. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
  103.