summaryrefslogtreecommitdiffstatshomepage
path: root/stm/usb.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-02-24 01:12:04 +0000
committerDamien George <damien.p.george@gmail.com>2014-02-24 01:12:04 +0000
commit2ee55c312d35f17216c0e770e029a2044863bdfd (patch)
treec6b08abb6896b3466d98a032fdad8bb072c0639c /stm/usb.c
parent790eed6f93dc12df40715ad1062b5ce01badcbd9 (diff)
downloadmicropython-2ee55c312d35f17216c0e770e029a2044863bdfd.tar.gz
micropython-2ee55c312d35f17216c0e770e029a2044863bdfd.zip
stm: Add option to pyb_usb_dev_init() to use USB HID interface.
With this option selected, only HID on its own works, not VCP+HID.
Diffstat (limited to 'stm/usb.c')
-rw-r--r--stm/usb.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/stm/usb.c b/stm/usb.c
index 718d432e61..29a5fb46d0 100644
--- a/stm/usb.c
+++ b/stm/usb.c
@@ -28,12 +28,19 @@ static int rx_buf_out;
static int interrupt_char = VCP_CHAR_NONE;
mp_obj_t mp_const_vcp_interrupt = MP_OBJ_NULL;
-void pyb_usb_dev_init(void) {
+void pyb_usb_dev_init(int usb_dev_type) {
#ifdef USE_DEVICE_MODE
if (!dev_is_enabled) {
// only init USB once in the device's power-lifetime
- USBD_Init(&USB_OTG_Core, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_PYB_cb, &USR_cb);
- //USBD_Init(&USB_OTG_Core, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_PYB_HID_cb, &USR_cb);
+ switch (usb_dev_type) {
+ case PYB_USB_DEV_VCP_MSC:
+ USBD_Init(&USB_OTG_Core, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_PYB_cb, &USR_cb);
+ break;
+
+ case PYB_USB_DEV_HID:
+ USBD_Init(&USB_OTG_Core, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_PYB_HID_cb, &USR_cb);
+ break;
+ }
}
rx_buf_in = 0;
rx_buf_out = 0;