Skip to content

Commit 9443331

Browse files
committed
usb initi
al commit
1 parent 09c66c8 commit 9443331

File tree

5 files changed

+816
-0
lines changed

5 files changed

+816
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
#define USBD_PRODUCT_STRING_HS "dam"
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
/* USER CODE BEGIN Header */
2+
/**
3+
******************************************************************************
4+
* @file : usbd_cdc_if.h
5+
* @version : v1.0_Cube
6+
* @brief : Header for usbd_cdc_if.c file.
7+
******************************************************************************
8+
* @attention
9+
*
10+
* Copyright (c) 2025 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+
/* Define to prevent recursive inclusion -------------------------------------*/
22+
#ifndef __USBD_CDC_IF_H__
23+
#define __USBD_CDC_IF_H__
24+
25+
#ifdef __cplusplus
26+
extern "C"
27+
{
28+
#endif
29+
30+
/* Includes ------------------------------------------------------------------*/
31+
#include "usbd_cdc.h"
32+
33+
/* USER CODE BEGIN INCLUDE */
34+
35+
/* USER CODE END INCLUDE */
36+
37+
/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
38+
* @brief For Usb device.
39+
* @{
40+
*/
41+
42+
/** @defgroup USBD_CDC_IF USBD_CDC_IF
43+
* @brief Usb VCP device module
44+
* @{
45+
*/
46+
47+
/** @defgroup USBD_CDC_IF_Exported_Defines USBD_CDC_IF_Exported_Defines
48+
* @brief Defines.
49+
* @{
50+
*/
51+
/* Define size for the receive and transmit buffer over CDC */
52+
#define APP_RX_DATA_SIZE 2048
53+
#define APP_TX_DATA_SIZE 2048
54+
/* USER CODE BEGIN EXPORTED_DEFINES */
55+
56+
/* USER CODE END EXPORTED_DEFINES */
57+
58+
/**
59+
* @}
60+
*/
61+
62+
/** @defgroup USBD_CDC_IF_Exported_Types USBD_CDC_IF_Exported_Types
63+
* @brief Types.
64+
* @{
65+
*/
66+
67+
/* USER CODE BEGIN EXPORTED_TYPES */
68+
69+
/* USER CODE END EXPORTED_TYPES */
70+
71+
/**
72+
* @}
73+
*/
74+
75+
/** @defgroup USBD_CDC_IF_Exported_Macros USBD_CDC_IF_Exported_Macros
76+
* @brief Aliases.
77+
* @{
78+
*/
79+
80+
/* USER CODE BEGIN EXPORTED_MACRO */
81+
82+
/* USER CODE END EXPORTED_MACRO */
83+
84+
/**
85+
* @}
86+
*/
87+
88+
/** @defgroup USBD_CDC_IF_Exported_Variables USBD_CDC_IF_Exported_Variables
89+
* @brief Public variables.
90+
* @{
91+
*/
92+
93+
/** CDC Interface callback. */
94+
extern USBD_CDC_ItfTypeDef USBD_Interface_fops_FS;
95+
96+
/* USER CODE BEGIN EXPORTED_VARIABLES */
97+
98+
/* USER CODE END EXPORTED_VARIABLES */
99+
100+
/**
101+
* @}
102+
*/
103+
104+
/** @defgroup USBD_CDC_IF_Exported_FunctionsPrototype USBD_CDC_IF_Exported_FunctionsPrototype
105+
* @brief Public functions declaration.
106+
* @{
107+
*/
108+
109+
uint8_t CDC_Transmit_FS(uint8_t *Buf, uint16_t Len);
110+
111+
/* USER CODE BEGIN EXPORTED_FUNCTIONS */
112+
113+
/* USER CODE END EXPORTED_FUNCTIONS */
114+
115+
/**
116+
* @}
117+
*/
118+
119+
/**
120+
* @}
121+
*/
122+
123+
/**
124+
* @}
125+
*/
126+
127+
#ifdef __cplusplus
128+
}
129+
#endif
130+
131+
#endif /* __USBD_CDC_IF_H__ */
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/* USER CODE BEGIN Header */
2+
/**
3+
******************************************************************************
4+
* @file : usb_device.h
5+
* @version : v1.0_Cube
6+
* @brief : Header for usb_device.c file.
7+
******************************************************************************
8+
* @attention
9+
*
10+
* Copyright (c) 2025 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+
/* Define to prevent recursive inclusion -------------------------------------*/
22+
#ifndef __USB_DEVICE__H__
23+
#define __USB_DEVICE__H__
24+
25+
#ifdef __cplusplus
26+
extern "C"
27+
{
28+
#endif
29+
30+
/* Includes ------------------------------------------------------------------*/
31+
#ifdef STM32H733xx
32+
#include "stm32h7xx.h"
33+
#include "stm32h7xx_hal.h"
34+
#elif STM32H562xx
35+
#include "stm32h5xx.h"
36+
#include "stm32h5xx_hal.h"
37+
#else
38+
#error "Please define an h5 or an h7 board"
39+
#endif
40+
41+
#include "usbd_def.h"
42+
43+
/* USER CODE BEGIN INCLUDE */
44+
45+
/* USER CODE END INCLUDE */
46+
47+
/** @addtogroup USBD_OTG_DRIVER
48+
* @{
49+
*/
50+
51+
/** @defgroup USBD_DEVICE USBD_DEVICE
52+
* @brief Device file for Usb otg low level driver.
53+
* @{
54+
*/
55+
56+
/** @defgroup USBD_DEVICE_Exported_Variables USBD_DEVICE_Exported_Variables
57+
* @brief Public variables.
58+
* @{
59+
*/
60+
61+
/* Private variables ---------------------------------------------------------*/
62+
/* USER CODE BEGIN PV */
63+
64+
/* USER CODE END PV */
65+
66+
/* Private function prototypes -----------------------------------------------*/
67+
/* USER CODE BEGIN PFP */
68+
69+
/* USER CODE END PFP */
70+
71+
/*
72+
* -- Insert your variables declaration here --
73+
*/
74+
/* USER CODE BEGIN VARIABLES */
75+
76+
/* USER CODE END VARIABLES */
77+
/**
78+
* @}
79+
*/
80+
81+
/** @defgroup USBD_DEVICE_Exported_FunctionsPrototype USBD_DEVICE_Exported_FunctionsPrototype
82+
* @brief Declaration of public functions for Usb device.
83+
* @{
84+
*/
85+
86+
/** USB Device initialization function. */
87+
void MX_USB_DEVICE_Init(void);
88+
89+
/*
90+
* -- Insert functions declaration here --
91+
*/
92+
/* USER CODE BEGIN FD */
93+
94+
/* USER CODE END FD */
95+
/**
96+
* @}
97+
*/
98+
99+
/**
100+
* @}
101+
*/
102+
103+
/**
104+
* @}
105+
*/
106+
107+
#ifdef __cplusplus
108+
}
109+
#endif
110+
111+
#endif /* __USB_DEVICE__H__ */

0 commit comments

Comments
 (0)