Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
f28e8b90
Commit
f28e8b90
authored
Aug 05, 2021
by
Damien George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stm32/usbd_desc: Rename USBD_xxx descriptor opts to MICROPY_HW_USB_xxx.
Signed-off-by:
Damien George
<
damien@micropython.org
>
parent
96c6b8ca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
45 deletions
+53
-45
ports/stm32/mpconfigboard_common.h
ports/stm32/mpconfigboard_common.h
+43
-3
ports/stm32/usbd_desc.c
ports/stm32/usbd_desc.c
+10
-42
No files found.
ports/stm32/mpconfigboard_common.h
View file @
f28e8b90
...
...
@@ -180,9 +180,17 @@
/*****************************************************************************/
// USB configuration
// The USBD_xxx VID/PID macros have been renamed to MICROPY_HW_USB_xxx.
#ifdef USBD_VID
#error "Old USBD_VID configuration option used"
// The USBD_xxx macros have been renamed to MICROPY_HW_USB_xxx.
#if defined(USBD_VID) \
|| defined(USBD_LANGID_STRING) \
|| defined(USBD_MANUFACTURER_STRING) \
|| defined(USBD_PRODUCT_HS_STRING) \
|| defined(USBD_PRODUCT_FS_STRING) \
|| defined(USBD_CONFIGURATION_HS_STRING) \
|| defined(USBD_INTERFACE_HS_STRING) \
|| defined(USBD_CONFIGURATION_FS_STRING) \
|| defined(USBD_INTERFACE_FS_STRING)
#error "Old USBD_xxx configuration option used, renamed to MICROPY_HW_USB_xxx"
#endif
// Default VID and PID values to use for the USB device. If MICROPY_HW_USB_VID
...
...
@@ -204,6 +212,38 @@
#define MICROPY_HW_USB_PID_CDC3_MSC_HID (0x980a)
#endif
#ifndef MICROPY_HW_USB_LANGID_STRING
#define MICROPY_HW_USB_LANGID_STRING 0x409
#endif
#ifndef MICROPY_HW_USB_MANUFACTURER_STRING
#define MICROPY_HW_USB_MANUFACTURER_STRING "MicroPython"
#endif
#ifndef MICROPY_HW_USB_PRODUCT_HS_STRING
#define MICROPY_HW_USB_PRODUCT_HS_STRING "Pyboard Virtual Comm Port in HS Mode"
#endif
#ifndef MICROPY_HW_USB_PRODUCT_FS_STRING
#define MICROPY_HW_USB_PRODUCT_FS_STRING "Pyboard Virtual Comm Port in FS Mode"
#endif
#ifndef MICROPY_HW_USB_CONFIGURATION_HS_STRING
#define MICROPY_HW_USB_CONFIGURATION_HS_STRING "Pyboard Config"
#endif
#ifndef MICROPY_HW_USB_INTERFACE_HS_STRING
#define MICROPY_HW_USB_INTERFACE_HS_STRING "Pyboard Interface"
#endif
#ifndef MICROPY_HW_USB_CONFIGURATION_FS_STRING
#define MICROPY_HW_USB_CONFIGURATION_FS_STRING "Pyboard Config"
#endif
#ifndef MICROPY_HW_USB_INTERFACE_FS_STRING
#define MICROPY_HW_USB_INTERFACE_FS_STRING "Pyboard Interface"
#endif
/*****************************************************************************/
// General configuration
...
...
ports/stm32/usbd_desc.c
View file @
f28e8b90
...
...
@@ -36,46 +36,14 @@
// need this header just for MP_HAL_UNIQUE_ID_ADDRESS
#include "py/mphal.h"
//
need this header for any overrides to the below constants
//
Need this header for MICROPY_HW_USB_xxx configuration values.
#include "py/mpconfig.h"
#ifndef USBD_LANGID_STRING
#define USBD_LANGID_STRING 0x409
#endif
#ifndef USBD_MANUFACTURER_STRING
#define USBD_MANUFACTURER_STRING "MicroPython"
#endif
#ifndef USBD_PRODUCT_HS_STRING
#define USBD_PRODUCT_HS_STRING "Pyboard Virtual Comm Port in HS Mode"
#endif
#ifndef USBD_PRODUCT_FS_STRING
#define USBD_PRODUCT_FS_STRING "Pyboard Virtual Comm Port in FS Mode"
#endif
#ifndef USBD_CONFIGURATION_HS_STRING
#define USBD_CONFIGURATION_HS_STRING "Pyboard Config"
#endif
#ifndef USBD_INTERFACE_HS_STRING
#define USBD_INTERFACE_HS_STRING "Pyboard Interface"
#endif
#ifndef USBD_CONFIGURATION_FS_STRING
#define USBD_CONFIGURATION_FS_STRING "Pyboard Config"
#endif
#ifndef USBD_INTERFACE_FS_STRING
#define USBD_INTERFACE_FS_STRING "Pyboard Interface"
#endif
__ALIGN_BEGIN
static
const
uint8_t
USBD_LangIDDesc
[
USB_LEN_LANGID_STR_DESC
]
__ALIGN_END
=
{
USB_LEN_LANGID_STR_DESC
,
USB_DESC_TYPE_STRING
,
LOBYTE
(
USBD
_LANGID_STRING
),
HIBYTE
(
USBD
_LANGID_STRING
),
LOBYTE
(
MICROPY_HW_USB
_LANGID_STRING
),
HIBYTE
(
MICROPY_HW_USB
_LANGID_STRING
),
};
// set the VID, PID and device release number
...
...
@@ -140,14 +108,14 @@ STATIC uint8_t *USBD_StrDescriptor(USBD_HandleTypeDef *pdev, uint8_t idx, uint16
return
(
uint8_t
*
)
USBD_LangIDDesc
;
// the data should only be read from this buf
case
USBD_IDX_MFC_STR
:
str
=
USBD
_MANUFACTURER_STRING
;
str
=
MICROPY_HW_USB
_MANUFACTURER_STRING
;
break
;
case
USBD_IDX_PRODUCT_STR
:
if
(
pdev
->
dev_speed
==
USBD_SPEED_HIGH
)
{
str
=
USBD
_PRODUCT_HS_STRING
;
str
=
MICROPY_HW_USB
_PRODUCT_HS_STRING
;
}
else
{
str
=
USBD
_PRODUCT_FS_STRING
;
str
=
MICROPY_HW_USB
_PRODUCT_FS_STRING
;
}
break
;
...
...
@@ -174,17 +142,17 @@ STATIC uint8_t *USBD_StrDescriptor(USBD_HandleTypeDef *pdev, uint8_t idx, uint16
case
USBD_IDX_CONFIG_STR
:
if
(
pdev
->
dev_speed
==
USBD_SPEED_HIGH
)
{
str
=
USBD
_CONFIGURATION_HS_STRING
;
str
=
MICROPY_HW_USB
_CONFIGURATION_HS_STRING
;
}
else
{
str
=
USBD
_CONFIGURATION_FS_STRING
;
str
=
MICROPY_HW_USB
_CONFIGURATION_FS_STRING
;
}
break
;
case
USBD_IDX_INTERFACE_STR
:
if
(
pdev
->
dev_speed
==
USBD_SPEED_HIGH
)
{
str
=
USBD
_INTERFACE_HS_STRING
;
str
=
MICROPY_HW_USB
_INTERFACE_HS_STRING
;
}
else
{
str
=
USBD
_INTERFACE_FS_STRING
;
str
=
MICROPY_HW_USB
_INTERFACE_FS_STRING
;
}
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment