Skip to content

Commit 76c94ea

Browse files
committed
[USB] Clean up devices interface
Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
1 parent 08a1c19 commit 76c94ea

File tree

5 files changed

+23
-101
lines changed

5 files changed

+23
-101
lines changed

cores/arduino/board.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extern "C"{
2727
#if defined(USE_USB_HS) && !defined(USB_OTG_HS)
2828
#error "This board does not support USB High Speed! Select 'Full Speed' in the 'Tools->USB interface' menu"
2929
#endif
30-
#include "usb_interface.h"
30+
#include "usbd_interface.h"
3131
#endif /* USBCON */
3232

3333
void init( void ) ;
Lines changed: 17 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
/**
22
******************************************************************************
3-
* @file usb_interface.c
4-
* @author WI6LABS
5-
* @version V1.0.0
6-
* @date 27-October-2016
7-
* @brief provide the usb interface
3+
* @file usbd_interface.c
4+
* @brief Provide the USB device interface
85
*
96
******************************************************************************
107
* @attention
@@ -36,84 +33,21 @@
3633
******************************************************************************
3734
*/
3835

39-
/** @addtogroup CMSIS
40-
* @{
41-
*/
42-
43-
/** @addtogroup stm32f4xx_system
44-
* @{
45-
*/
46-
47-
/** @addtogroup STM32F4xx_System_Private_Includes
48-
* @{
49-
*/
50-
#include "usb_interface.h"
51-
52-
/**
53-
* @}
54-
*/
36+
#include "usbd_interface.h"
5537

5638
#ifdef __cplusplus
5739
extern "C" {
5840
#endif
5941
#ifdef USBCON
60-
/** @addtogroup STM32F4xx_System_Private_TypesDefinitions
61-
* @{
62-
*/
63-
/**
64-
* @}
65-
*/
66-
67-
/** @addtogroup STM32F4xx_System_Private_Defines
68-
* @{
69-
*/
70-
71-
/**
72-
* @}
73-
*/
74-
75-
/** @addtogroup STM32F4xx_System_Private_Macros
76-
* @{
77-
*/
78-
79-
/**
80-
* @}
81-
*/
82-
83-
/** @addtogroup STM32F4xx_System_Private_TypesDefinitions
84-
* @{
85-
*/
86-
87-
/**
88-
* @}
89-
*/
9042

91-
/** @addtogroup STM32F4xx_System_Private_Variables
92-
* @{
93-
*/
9443
/* USB Device Core handle declaration */
9544
#ifdef USBD_USE_HID_COMPOSITE
96-
static USBD_HandleTypeDef hUSBD_Device_HID;
97-
#endif //USBD_USE_HID_COMPOSITE
98-
/**
99-
* @}
100-
*/
101-
102-
/** @addtogroup STM32F4xx_System_Private_FunctionPrototypes
103-
* @{
104-
*/
105-
106-
/**
107-
* @}
108-
*/
109-
110-
/** @addtogroup STM32F4xx_System_Private_Functions
111-
* @{
112-
*/
45+
USBD_HandleTypeDef hUSBD_Device_HID;
46+
#endif /* USBD_USE_HID_COMPOSITE*/
11347

11448
/**
115-
* @brief initialize the USB HID interface
116-
* @param HID_Desc : usb HID descriptor callbacks
49+
* @brief initialize USB devices
50+
* @param none
11751
* @retval none
11852
*/
11953
void usbd_interface_init(void)
@@ -127,45 +61,36 @@ void usbd_interface_init(void)
12761

12862
/* Start Device Process */
12963
USBD_Start(&hUSBD_Device_HID);
130-
#endif // USBD_USE_HID_COMPOSITE
64+
#endif /* USBD_USE_HID_COMPOSITE */
13165
}
13266

13367
/**
134-
* @brief initialize the USB HID interface
135-
* @param HID_Desc : usb HID descriptor callbacks
68+
* @brief Send HID mouse Report
69+
* @param report pointer to report
70+
* @param len report lenght
13671
* @retval none
13772
*/
13873
void usbd_interface_mouse_sendReport(uint8_t *report, uint16_t len)
13974
{
14075
#ifdef USBD_USE_HID_COMPOSITE
14176
USBD_HID_MOUSE_SendReport(&hUSBD_Device_HID, report, len);
142-
#endif // USBD_USE_HID_COMPOSITE
77+
#endif /* USBD_USE_HID_COMPOSITE */
14378
}
14479

14580
/**
146-
* @brief initialize the USB HID interface
147-
* @param HID_Desc : usb HID descriptor callbacks
81+
* @brief Send HID keyboard Report
82+
* @param report pointer to report
83+
* @param len report lenght
14884
* @retval none
14985
*/
15086
void usbd_interface_keyboard_sendReport(uint8_t *report, uint16_t len)
15187
{
15288
#ifdef USBD_USE_HID_COMPOSITE
15389
USBD_HID_KEYBOARD_SendReport(&hUSBD_Device_HID, report, len);
154-
#endif // USBD_USE_HID_COMPOSITE
90+
#endif /* USBD_USE_HID_COMPOSITE */
15591
}
15692

157-
/**
158-
* @}
159-
*/
160-
161-
/**
162-
* @}
163-
*/
164-
165-
/**
166-
* @}
167-
*/
168-
#endif // USBCON
93+
#endif /* USBCON */
16994
#ifdef __cplusplus
17095
}
17196
#endif
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/**
22
******************************************************************************
3-
* @file usb_interface.h
4-
* @author WI6LABS
5-
* @brief Header for usb interface
3+
* @file usbd_interface.h
4+
* @brief Header for USB device interface
65
******************************************************************************
76
* @attention
87
*
@@ -34,8 +33,8 @@
3433
*/
3534

3635
/* Define to prevent recursive inclusion -------------------------------------*/
37-
#ifndef __USB_INTERFACE_H
38-
#define __USB_INTERFACE_H
36+
#ifndef __USBD_INTERFACE_H
37+
#define __USBD_INTERFACE_H
3938
#ifdef USBCON
4039

4140
/* Includes ------------------------------------------------------------------*/
@@ -64,6 +63,6 @@ void usbd_interface_keyboard_sendReport(uint8_t *report, uint16_t len);
6463
#endif
6564
#endif /* USBCON */
6665

67-
#endif /* __USB_INTERFACE_H */
66+
#endif /* __USBD_INTERFACE_H */
6867

6968
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

libraries/Keyboard/src/Keyboard.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
*/
2121

2222
#include "Keyboard.h"
23-
#include "usbd_hid_composite.h"
2423

2524
#if defined(USBCON)
2625

libraries/Mouse/src/Mouse.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
*/
2121

2222
#include "Mouse.h"
23-
#include "usbd_hid_composite.h"
2423

2524
#if defined(USBCON)
2625

0 commit comments

Comments
 (0)