Skip to content

Commit b9786f2

Browse files
committed
[USB] Clean up switch
Signed-off-by: Frederic.Pillon <[email protected]>
1 parent e50cc99 commit b9786f2

File tree

8 files changed

+21
-26
lines changed

8 files changed

+21
-26
lines changed

cores/arduino/board.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,7 @@ extern "C"{
2020
#include "timer.h"
2121
#include "twi.h"
2222
#include "uart.h"
23-
#ifdef USBCON
24-
#if !defined(USB_BASE) && !defined(USB_OTG_DEVICE_BASE)
25-
#error "This board does not support USB! Select 'None' in the 'Tools->USB interface' menu"
26-
#endif
27-
#if defined(USE_USB_HS) && !defined(USB_OTG_HS)
28-
#error "This board does not support USB High Speed! Select 'Full Speed' in the 'Tools->USB interface' menu"
29-
#endif
3023
#include "usbd_interface.h"
31-
#endif /* USBCON */
3224

3325
void init( void ) ;
3426
#ifdef __cplusplus

cores/arduino/stm32/usb/usb_device_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
#include "usbd_core.c"
44

5-
#endif //USBCON
5+
#endif /* USBCON */

cores/arduino/stm32/usb/usb_device_ctlreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
#include "usbd_ctlreq.c"
44

5-
#endif //USBCON
5+
#endif /* USBCON */

cores/arduino/stm32/usb/usb_device_ioreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
#include "usbd_ioreq.c"
44

5-
#endif //USBCON
5+
#endif /* USBCON */

cores/arduino/stm32/usb/usbd_conf.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@
2828
#ifdef USBCON
2929
/* Includes ------------------------------------------------------------------*/
3030
#include "stm32_def.h"
31+
32+
#if !defined(USB_BASE) && !defined(USB_OTG_DEVICE_BASE)
33+
#error "This board does not support USB! Select 'None' in the 'Tools->USB interface' menu"
34+
#endif
35+
#if defined(USE_USB_HS) && !defined(USB_OTG_HS)
36+
#error "This board does not support USB High Speed! Select 'Full Speed' in the 'Tools->USB interface' menu"
37+
#endif
38+
3139
#include <stdio.h>
3240
#include <stdlib.h>
3341
#include <string.h>

cores/arduino/stm32/usb/usbd_desc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
/* Includes ------------------------------------------------------------------*/
2121
#include "usbd_core.h"
2222
#include "usbd_desc.h"
23-
#include "usbd_conf.h"
2423
#include "utils.h"
2524

2625
/* Private typedef -----------------------------------------------------------*/

cores/arduino/stm32/usbd_interface.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@
3232
*
3333
******************************************************************************
3434
*/
35-
35+
#ifdef USBCON
36+
#include "usbd_desc.h"
3637
#include "usbd_interface.h"
38+
#ifdef USBD_USE_HID_COMPOSITE
39+
#include "usbd_hid_composite.h"
40+
#endif
3741

3842
#ifdef __cplusplus
3943
extern "C" {
4044
#endif
41-
#ifdef USBCON
4245

4346
/* USB Device Core handle declaration */
4447
#ifdef USBD_USE_HID_COMPOSITE
@@ -64,6 +67,7 @@ void usbd_interface_init(void)
6467
#endif /* USBD_USE_HID_COMPOSITE */
6568
}
6669

70+
#ifdef USBD_USE_HID_COMPOSITE
6771
/**
6872
* @brief Send HID mouse Report
6973
* @param report pointer to report
@@ -72,9 +76,7 @@ void usbd_interface_init(void)
7276
*/
7377
void usbd_interface_mouse_sendReport(uint8_t *report, uint16_t len)
7478
{
75-
#ifdef USBD_USE_HID_COMPOSITE
7679
USBD_HID_MOUSE_SendReport(&hUSBD_Device_HID, report, len);
77-
#endif /* USBD_USE_HID_COMPOSITE */
7880
}
7981

8082
/**
@@ -85,14 +87,12 @@ void usbd_interface_mouse_sendReport(uint8_t *report, uint16_t len)
8587
*/
8688
void usbd_interface_keyboard_sendReport(uint8_t *report, uint16_t len)
8789
{
88-
#ifdef USBD_USE_HID_COMPOSITE
8990
USBD_HID_KEYBOARD_SendReport(&hUSBD_Device_HID, report, len);
90-
#endif /* USBD_USE_HID_COMPOSITE */
9191
}
92+
#endif /* USBD_USE_HID_COMPOSITE */
9293

93-
#endif /* USBCON */
9494
#ifdef __cplusplus
9595
}
9696
#endif
97-
97+
#endif /* USBCON */
9898
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

cores/arduino/stm32/usbd_interface.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@
3838
#ifdef USBCON
3939

4040
/* Includes ------------------------------------------------------------------*/
41-
#include "usbd_desc.h"
42-
43-
#ifdef USBD_USE_HID_COMPOSITE
44-
#include "usbd_hid_composite.h"
45-
#endif
46-
4741
#ifdef __cplusplus
4842
extern "C" {
4943
#endif
@@ -55,8 +49,10 @@
5549
/* Exported functions ------------------------------------------------------- */
5650
void usbd_interface_init(void);
5751

52+
#ifdef USBD_USE_HID_COMPOSITE
5853
void usbd_interface_mouse_sendReport(uint8_t *report, uint16_t len);
5954
void usbd_interface_keyboard_sendReport(uint8_t *report, uint16_t len);
55+
#endif
6056

6157
#ifdef __cplusplus
6258
}

0 commit comments

Comments
 (0)