File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 38
38
#ifdef USBD_USE_HID_COMPOSITE
39
39
#include "usbd_hid_composite.h"
40
40
#endif
41
+ #ifdef USBD_USE_CDC
42
+ #include "usbd_cdc_if.h"
43
+ #endif
41
44
42
45
#ifdef __cplusplus
43
46
extern "C" {
47
50
#ifdef USBD_USE_HID_COMPOSITE
48
51
USBD_HandleTypeDef hUSBD_Device_HID ;
49
52
#endif /* USBD_USE_HID_COMPOSITE*/
53
+ #ifdef USBD_USE_CDC
54
+ USBD_HandleTypeDef hUSBD_Device_CDC ;
55
+ #endif /* USBD_USE_CDC */
50
56
51
57
/**
52
58
* @brief initialize USB devices
@@ -65,6 +71,21 @@ void usbd_interface_init(void)
65
71
/* Start Device Process */
66
72
USBD_Start (& hUSBD_Device_HID );
67
73
#endif /* USBD_USE_HID_COMPOSITE */
74
+ #ifdef USBD_USE_CDC
75
+ /* Init Device Library */
76
+ if (USBD_Init (& hUSBD_Device_CDC , & CDC_Desc , 0 ) == USBD_OK ) {
77
+
78
+ /* Add Supported Class */
79
+ if (USBD_RegisterClass (& hUSBD_Device_CDC , USBD_CDC_CLASS ) == USBD_OK ) {
80
+
81
+ /* Add CDC Interface Class */
82
+ if (USBD_CDC_RegisterInterface (& hUSBD_Device_CDC , & USBD_CDC_fops ) == USBD_OK ) {
83
+ /* Start Device Process */
84
+ USBD_Start (& hUSBD_Device_CDC );
85
+ }
86
+ }
87
+ }
88
+ #endif /* USBD_USE_CDC */
68
89
}
69
90
70
91
#ifdef USBD_USE_HID_COMPOSITE
You can’t perform that action at this time.
0 commit comments