Skip to content

Commit 4067d7e

Browse files
committed
[USB] Allow user customization
Below switch already define in usb_def.h, if not defined: USBD_MAX_NUM_CONFIGURATION USBD_SUPPORT_USER_STRING USBD_SELF_POWERED Signed-off-by: Frederic.Pillon <[email protected]>
1 parent b9786f2 commit 4067d7e

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

cores/arduino/stm32/usb/usbd_conf.h

+26-3
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,54 @@
4040
#include <stdlib.h>
4141
#include <string.h>
4242

43+
#ifndef USBD_MAX_NUM_INTERFACES
4344
#define USBD_MAX_NUM_INTERFACES 2U
44-
#define USBD_MAX_NUM_CONFIGURATION 1U
45+
#endif /* USBD_MAX_NUM_INTERFACES */
46+
47+
#ifndef USBD_MAX_STR_DESC_SIZ
4548
#define USBD_MAX_STR_DESC_SIZ 0x100U
46-
#define USBD_SUPPORT_USER_STRING 0U
47-
#define USBD_SELF_POWERED 1U
49+
#endif /* USBD_MAX_STR_DESC_SIZ */
50+
51+
#ifndef USBD_DEBUG_LEVEL
4852
#define USBD_DEBUG_LEVEL 0U
53+
#endif /* USBD_DEBUG_LEVEL */
4954

5055
/* MSC Class Config */
56+
#ifndef MSC_MEDIA_PACKET
5157
#define MSC_MEDIA_PACKET 8192U
58+
#endif /* MSC_MEDIA_PACKET */
5259

5360
/* CDC Class Config */
61+
#ifndef USBD_CDC_INTERVAL
5462
#define USBD_CDC_INTERVAL 2000U
63+
#endif /* USBD_CDC_INTERVAL */
5564

5665
/* DFU Class Config */
66+
#ifndef USBD_DFU_MAX_ITF_NUM
5767
#define USBD_DFU_MAX_ITF_NUM 1U
68+
#endif /* USBD_DFU_MAX_ITF_NUM */
69+
#ifndef USBD_DFU_XFERS_IZE
5870
#define USBD_DFU_XFERS_IZE 1024U
71+
#endif /* USBD_DFU_XFERS_IZE */
5972

6073
/* AUDIO Class Config */
74+
#ifndef USBD_AUDIO_FREQ
6175
#define USBD_AUDIO_FREQ 22100U
76+
#endif /* USBD_AUDIO_FREQ */
6277

6378
/* Memory management macros */
79+
#ifndef USBD_malloc
6480
#define USBD_malloc malloc
81+
#endif /* USBD_malloc */
82+
#ifndef USBD_free
6583
#define USBD_free free
84+
#endif /* USBD_free */
85+
#ifndef USBD_memset
6686
#define USBD_memset memset
87+
#endif /* USBD_memset */
88+
#ifndef USBD_memcpy
6789
#define USBD_memcpy memcpy
90+
#endif /* USBD_memcpy */
6891

6992
/* DEBUG macros */
7093
#if (USBD_DEBUG_LEVEL > 0U)

0 commit comments

Comments
 (0)