source: trunk/fw_g473rct/USB_Device/App/usb_device.c@ 61

Last change on this file since 61 was 61, checked in by f.jahn, 5 weeks ago

Added more USB Device stack files.

File size: 2.5 KB
Line 
1/* USER CODE BEGIN Header */
2/**
3 ******************************************************************************
4 * @file : usb_device.c
5 * @version : v3.0_Cube
6 * @brief : This file implements the USB Device
7 ******************************************************************************
8 * @attention
9 *
10 * Copyright (c) 2026 STMicroelectronics.
11 * All rights reserved.
12 *
13 * This software is licensed under terms that can be found in the LICENSE file
14 * in the root directory of this software component.
15 * If no LICENSE file comes with this software, it is provided AS-IS.
16 *
17 ******************************************************************************
18 */
19/* USER CODE END Header */
20
21/* Includes ------------------------------------------------------------------*/
22
23#include "usb_device.h"
24#include "usbd_core.h"
25#include "usbd_desc.h"
26#include "usbd_cdc.h"
27#include "usbd_cdc_if.h"
28
29/* USER CODE BEGIN Includes */
30
31/* USER CODE END Includes */
32
33/* USER CODE BEGIN PV */
34/* Private variables ---------------------------------------------------------*/
35
36/* USER CODE END PV */
37
38/* USER CODE BEGIN PFP */
39/* Private function prototypes -----------------------------------------------*/
40
41/* USER CODE END PFP */
42
43extern void Error_Handler(void);
44/* USB Device Core handle declaration. */
45USBD_HandleTypeDef hUsbDeviceFS;
46extern USBD_DescriptorsTypeDef CDC_Desc;
47
48/*
49 * -- Insert your variables declaration here --
50 */
51/* USER CODE BEGIN 0 */
52
53/* USER CODE END 0 */
54
55/*
56 * -- Insert your external function declaration here --
57 */
58/* USER CODE BEGIN 1 */
59
60/* USER CODE END 1 */
61
62/**
63 * Init USB device Library, add supported class and start the library
64 * @retval None
65 */
66void MX_USB_Device_Init(void)
67{
68 /* USER CODE BEGIN USB_Device_Init_PreTreatment */
69
70 /* USER CODE END USB_Device_Init_PreTreatment */
71
72 /* Init Device Library, add supported class and start the library. */
73 if (USBD_Init(&hUsbDeviceFS, &CDC_Desc, DEVICE_FS) != USBD_OK) {
74 Error_Handler();
75 }
76 if (USBD_RegisterClass(&hUsbDeviceFS, &USBD_CDC) != USBD_OK) {
77 Error_Handler();
78 }
79 if (USBD_CDC_RegisterInterface(&hUsbDeviceFS, &USBD_Interface_fops_FS) != USBD_OK) {
80 Error_Handler();
81 }
82 if (USBD_Start(&hUsbDeviceFS) != USBD_OK) {
83 Error_Handler();
84 }
85 /* USER CODE BEGIN USB_Device_Init_PostTreatment */
86
87 /* USER CODE END USB_Device_Init_PostTreatment */
88}
89
90/**
91 * @}
92 */
93
94/**
95 * @}
96 */
97
Note: See TracBrowser for help on using the repository browser.