summaryrefslogtreecommitdiffstatshomepage
path: root/stm/usb.c
diff options
context:
space:
mode:
authorDamien <damien.p.george@gmail.com>2013-10-22 23:09:25 +0100
committerDamien <damien.p.george@gmail.com>2013-10-22 23:09:25 +0100
commite9f1e50be49edc6d01ff006e0a1f5291672ec808 (patch)
treea1ca33259f91b4941210ef68ae7db075b47c8437 /stm/usb.c
parentec63cce470f943003c728fde049919dedd5b6a44 (diff)
downloadmicropython-e9f1e50be49edc6d01ff006e0a1f5291672ec808.tar.gz
micropython-e9f1e50be49edc6d01ff006e0a1f5291672ec808.zip
Board running boot.py, working REPL, soft reboot.
Diffstat (limited to 'stm/usb.c')
-rw-r--r--stm/usb.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/stm/usb.c b/stm/usb.c
index b4fadf26da..5b9efff98d 100644
--- a/stm/usb.c
+++ b/stm/usb.c
@@ -20,7 +20,10 @@ static int rx_buf_in;
static int rx_buf_out;
void usb_init() {
- USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_PYB_cb, &USR_cb);
+ if (!is_enabled) {
+ // only init USB once in the device's power-lifetime
+ USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_PYB_cb, &USR_cb);
+ }
rx_buf_in = 0;
rx_buf_out = 0;
is_enabled = 1;