File tree 8 files changed +267
-173
lines changed
8 files changed +267
-173
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 41
41
#ifdef USBCON
42
42
43
43
/* Includes ------------------------------------------------------------------*/
44
+ #if __has_include ("usbd_desc.h" )
44
45
#include "usbd_desc.h"
46
+ #else
47
+ #ifdef USBD_USE_HID_COMPOSITE
48
+ #error "This board does not support (yet?) USB HID! Select 'None' in the 'Tools->USB interface' menu"
49
+ #elif defined(USBD_USE_CDC )
50
+ #error "This board does not support (yet?) USB CDC! Select 'None' in the 'Tools->USB interface' menu"
51
+ #else
52
+ #error "This board does not support (yet?) USB! Select 'None' in the 'Tools->USB interface' menu"
53
+ #endif
54
+ #endif
45
55
#include "usbd_hid_composite.h"
46
56
47
57
#ifdef __cplusplus
Original file line number Diff line number Diff line change
1
+ /*
2
+ *
3
+ * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
4
+ * Author: Frederic Pillon for STMicroelectronics.
5
+ *
6
+ * License type: GPLv2
7
+ *
8
+ * This program is free software; you can redistribute it and/or modify it
9
+ * under the terms of the GNU General Public License version 2 as published by
10
+ * the Free Software Foundation.
11
+ *
12
+ * This program is distributed in the hope that it will be useful, but
13
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14
+ * or FITNESS FOR A PARTICULAR PURPOSE.
15
+ * See the GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License along with
18
+ * this program. If not, see
19
+ * <http://www.gnu.org/licenses/>.
20
+ */
21
+ /* Define to prevent recursive inclusion -------------------------------------*/
22
+ #ifndef __UTILS_H
23
+ #define __UTILS_H
24
+
25
+ // Concatenate 2 strings
26
+ #define CONCAT (s1 , s2 ) (s1 s2)
27
+ // Concatenate 2 strings separated by space
28
+ #define CONCATS (s1 , s2 ) (s1" " s2)
29
+
30
+ #endif
Original file line number Diff line number Diff line change 24
24
25
25
#include < Arduino.h>
26
26
27
- #if !defined(USBCON)
27
+ #if !defined(USBCON) || !defined(USBD_USE_HID_COMPOSITE)
28
28
29
- #warning "Using legacy HID core (non pluggable) "
29
+ #error "USB HID not enabled! Select ' HID' in the 'Tools->USB interface' menu. "
30
30
31
31
#else
32
32
Original file line number Diff line number Diff line change 24
24
25
25
#include < Arduino.h>
26
26
27
- #if !defined(USBCON)
27
+ #if !defined(USBCON) || !defined(USBD_USE_HID_COMPOSITE)
28
28
29
- #warning "Using legacy HID core (non pluggable) "
29
+ #error "USB HID not enabled! Select ' HID' in the 'Tools->USB interface' menu. "
30
30
31
31
#else
32
32
Original file line number Diff line number Diff line change @@ -55,12 +55,17 @@ compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "
55
55
compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" -l{build.cmsis_lib_gcc}
56
56
# USB Flags
57
57
# ---------
58
- build.usb_flags=-DUSBD_VID={build.vid} -DUSBD_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product} '
58
+ build.usb_flags=-DUSBCON - DUSBD_VID={build.vid} -DUSBD_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT=" {build.board}" '
59
59
60
60
# Default usb manufacturer will be replaced at compile time using
61
61
# numeric vendor ID if available or by board's specific value.
62
62
build.usb_manufacturer="Unknown"
63
63
64
+ #
65
+ # Defaults config
66
+ #
67
+ build.enable_Serialx=
68
+ build.enable_usb=
64
69
65
70
# compile patterns
66
71
# ---------------------
Original file line number Diff line number Diff line change 49
49
#include "usbd_core.h"
50
50
#include "usbd_desc.h"
51
51
#include "usbd_conf.h"
52
+ #include "utils.h"
52
53
53
54
/* Private typedef -----------------------------------------------------------*/
54
55
/* Private define ------------------------------------------------------------*/
64
65
#elif !defined(USB_MANUFACTURER )
65
66
// Fall through to unknown if no manufacturer name was provided in a macro
66
67
#define USBD_MANUFACTURER_STRING "Unknown"
68
+ #else
69
+ #define USBD_MANUFACTURER_STRING USB_MANUFACTURER
67
70
#endif
68
71
#ifdef USBD_USE_HID_COMPOSITE
69
- #define USBD_HID_PRODUCT_HS_STRING "HID in HS Mode"
70
- #define USBD_HID_PRODUCT_FS_STRING "HID in FS Mode"
71
- #define USBD_HID_CONFIGURATION_HS_STRING "HID Config"
72
- #define USBD_HID_INTERFACE_HS_STRING "HID Interface"
73
- #define USBD_HID_CONFIGURATION_FS_STRING "HID Config"
74
- #define USBD_HID_INTERFACE_FS_STRING "HID Interface"
72
+ #define USBD_HID_PRODUCT_HS_STRING CONCATS(USB_PRODUCT, "HID in HS Mode")
73
+ #define USBD_HID_PRODUCT_FS_STRING CONCATS(USB_PRODUCT, "HID in FS Mode")
74
+ #define USBD_HID_CONFIGURATION_HS_STRING CONCATS(USB_PRODUCT, "HID Config")
75
+ #define USBD_HID_INTERFACE_HS_STRING CONCATS(USB_PRODUCT, "HID Interface")
76
+ #define USBD_HID_CONFIGURATION_FS_STRING CONCATS(USB_PRODUCT, "HID Config")
77
+ #define USBD_HID_INTERFACE_FS_STRING CONCATS(USB_PRODUCT, "HID Interface")
75
78
76
79
/* Private macro -------------------------------------------------------------*/
77
80
/* Private function prototypes -----------------------------------------------*/
Original file line number Diff line number Diff line change 49
49
#include "usbd_core.h"
50
50
#include "usbd_desc.h"
51
51
#include "usbd_conf.h"
52
+ #include "utils.h"
53
+
52
54
/* Private typedef -----------------------------------------------------------*/
53
55
/* Private define ------------------------------------------------------------*/
54
56
63
65
#elif !defined(USB_MANUFACTURER )
64
66
// Fall through to unknown if no manufacturer name was provided in a macro
65
67
#define USBD_MANUFACTURER_STRING "Unknown"
68
+ #else
69
+ #define USBD_MANUFACTURER_STRING USB_MANUFACTURER
66
70
#endif
67
71
#ifdef USBD_USE_HID_COMPOSITE
68
- #define USBD_HID_PRODUCT_HS_STRING "HID in HS Mode"
69
- #define USBD_HID_PRODUCT_FS_STRING "HID in FS Mode"
70
- #define USBD_HID_CONFIGURATION_HS_STRING "HID Config"
71
- #define USBD_HID_INTERFACE_HS_STRING "HID Interface"
72
- #define USBD_HID_CONFIGURATION_FS_STRING "HID Config"
73
- #define USBD_HID_INTERFACE_FS_STRING "HID Interface"
72
+ #define USBD_HID_PRODUCT_HS_STRING CONCATS(USB_PRODUCT, "HID in HS Mode")
73
+ #define USBD_HID_PRODUCT_FS_STRING CONCATS(USB_PRODUCT, "HID in FS Mode")
74
+ #define USBD_HID_CONFIGURATION_HS_STRING CONCATS(USB_PRODUCT, "HID Config")
75
+ #define USBD_HID_INTERFACE_HS_STRING CONCATS(USB_PRODUCT, "HID Interface")
76
+ #define USBD_HID_CONFIGURATION_FS_STRING CONCATS(USB_PRODUCT, "HID Config")
77
+ #define USBD_HID_INTERFACE_FS_STRING CONCATS(USB_PRODUCT, "HID Interface")
74
78
75
79
/* Private macro -------------------------------------------------------------*/
76
80
/* Private function prototypes -----------------------------------------------*/
You can’t perform that action at this time.
0 commit comments