File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 4141#ifdef USBCON
4242
4343/* Includes ------------------------------------------------------------------*/
44+ #if __has_include ("usbd_desc.h" )
4445#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
4555#include "usbd_hid_composite.h"
4656
4757#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 2424
2525#include < Arduino.h>
2626
27- #if !defined(USBCON)
27+ #if !defined(USBCON) || !defined(USBD_USE_HID_COMPOSITE)
2828
29- #warning "Using legacy HID core (non pluggable) "
29+ #error "USB HID not enabled! Select ' HID' in the 'Tools->USB interface' menu. "
3030
3131#else
3232
Original file line number Diff line number Diff line change 2424
2525#include < Arduino.h>
2626
27- #if !defined(USBCON)
27+ #if !defined(USBCON) || !defined(USBD_USE_HID_COMPOSITE)
2828
29- #warning "Using legacy HID core (non pluggable) "
29+ #error "USB HID not enabled! Select ' HID' in the 'Tools->USB interface' menu. "
3030
3131#else
3232
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/" "
5555compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" -l{build.cmsis_lib_gcc}
5656# USB Flags
5757# ---------
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}" '
5959
6060# Default usb manufacturer will be replaced at compile time using
6161# numeric vendor ID if available or by board's specific value.
6262build.usb_manufacturer="Unknown"
6363
64+ #
65+ # Defaults config
66+ #
67+ build.enable_Serialx=
68+ build.enable_usb=
6469
6570# compile patterns
6671# ---------------------
Original file line number Diff line number Diff line change 4949#include "usbd_core.h"
5050#include "usbd_desc.h"
5151#include "usbd_conf.h"
52+ #include "utils.h"
5253
5354/* Private typedef -----------------------------------------------------------*/
5455/* Private define ------------------------------------------------------------*/
6465#elif !defined(USB_MANUFACTURER )
6566// Fall through to unknown if no manufacturer name was provided in a macro
6667#define USBD_MANUFACTURER_STRING "Unknown"
68+ #else
69+ #define USBD_MANUFACTURER_STRING USB_MANUFACTURER
6770#endif
6871#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")
7578
7679/* Private macro -------------------------------------------------------------*/
7780/* Private function prototypes -----------------------------------------------*/
Original file line number Diff line number Diff line change 4949#include "usbd_core.h"
5050#include "usbd_desc.h"
5151#include "usbd_conf.h"
52+ #include "utils.h"
53+
5254/* Private typedef -----------------------------------------------------------*/
5355/* Private define ------------------------------------------------------------*/
5456
6365#elif !defined(USB_MANUFACTURER )
6466// Fall through to unknown if no manufacturer name was provided in a macro
6567#define USBD_MANUFACTURER_STRING "Unknown"
68+ #else
69+ #define USBD_MANUFACTURER_STRING USB_MANUFACTURER
6670#endif
6771#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")
7478
7579/* Private macro -------------------------------------------------------------*/
7680/* Private function prototypes -----------------------------------------------*/
You can’t perform that action at this time.
0 commit comments