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
70a28e3a
Commit
70a28e3a
authored
Apr 26, 2019
by
Andrew Leech
Committed by
Damien George
Apr 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stm32/usb: Add USB device mode for VCP+VCP without MSC.
Selectable via pyb.usb_mode('VCP+VCP').
parent
0646e607
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
ports/stm32/usb.c
ports/stm32/usb.c
+5
-0
ports/stm32/usb.h
ports/stm32/usb.h
+1
-0
ports/stm32/usbdev/class/src/usbd_cdc_msc_hid.c
ports/stm32/usbdev/class/src/usbd_cdc_msc_hid.c
+13
-0
No files found.
ports/stm32/usb.c
View file @
70a28e3a
...
...
@@ -306,6 +306,11 @@ STATIC mp_obj_t pyb_usb_mode(size_t n_args, const mp_obj_t *pos_args, mp_map_t *
}
mode
=
USBD_MODE_CDC_MSC
;
#if MICROPY_HW_USB_ENABLE_CDC2
}
else
if
(
strcmp
(
mode_str
,
"VCP+VCP"
)
==
0
)
{
if
(
args
[
2
].
u_int
==
-
1
)
{
pid
=
USBD_PID_CDC2
;
}
mode
=
USBD_MODE_CDC2
;
}
else
if
(
strcmp
(
mode_str
,
"VCP+VCP+MSC"
)
==
0
)
{
if
(
args
[
2
].
u_int
==
-
1
)
{
pid
=
USBD_PID_CDC2_MSC
;
...
...
ports/stm32/usb.h
View file @
70a28e3a
...
...
@@ -37,6 +37,7 @@
#define USBD_PID_CDC (0x9802)
#define USBD_PID_MSC (0x9803)
#define USBD_PID_CDC2_MSC (0x9804)
#define USBD_PID_CDC2 (0x9805)
typedef
enum
{
PYB_USB_STORAGE_MEDIUM_NONE
=
0
,
...
...
ports/stm32/usbdev/class/src/usbd_cdc_msc_hid.c
View file @
70a28e3a
...
...
@@ -62,6 +62,7 @@
#define CDC_IFACE_NUM_ALONE (0)
#define CDC_IFACE_NUM_WITH_MSC (1)
#define CDC2_IFACE_NUM_WITH_CDC (2)
#define CDC2_IFACE_NUM_WITH_MSC (3)
#define CDC_IFACE_NUM_WITH_HID (1)
#define MSC_IFACE_NUM_WITH_CDC (0)
...
...
@@ -474,6 +475,18 @@ int USBD_SelectMode(usbd_cdc_msc_hid_state_t *usbd, uint32_t mode, USBD_HID_Mode
break
;
#if MICROPY_HW_USB_ENABLE_CDC2
case
USBD_MODE_CDC2
:
{
// Ensure the first interface is also enabled
usbd
->
usbd_mode
|=
USBD_MODE_CDC
;
n
+=
make_cdc_desc
(
d
+
n
,
1
,
CDC_IFACE_NUM_ALONE
);
n
+=
make_cdc_desc_ep
(
d
+
n
,
1
,
CDC2_IFACE_NUM_WITH_CDC
,
CDC2_CMD_EP
,
CDC2_OUT_EP
,
CDC2_IN_EP
);
usbd
->
cdc
->
iface_num
=
CDC_IFACE_NUM_ALONE
;
usbd
->
cdc2
->
iface_num
=
CDC2_IFACE_NUM_WITH_CDC
;
num_itf
=
4
;
break
;
}
case
USBD_MODE_CDC2_MSC
:
{
n
+=
make_msc_desc
(
d
+
n
);
n
+=
make_cdc_desc
(
d
+
n
,
1
,
CDC_IFACE_NUM_WITH_MSC
);
...
...
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