aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/usb/usb_cdcacm.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmaple/usb/usb_cdcacm.c')
-rw-r--r--libmaple/usb/usb_cdcacm.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libmaple/usb/usb_cdcacm.c b/libmaple/usb/usb_cdcacm.c
index d2f6eba..fe06166 100644
--- a/libmaple/usb/usb_cdcacm.c
+++ b/libmaple/usb/usb_cdcacm.c
@@ -34,6 +34,7 @@
#include "usb_cdcacm.h"
#include "nvic.h"
+#include "delay.h"
#include "usb.h"
#include "descriptors.h"
@@ -81,6 +82,8 @@ static uint8* usbGetStringDescriptor(uint16 length);
static void usbSetConfiguration(void);
static void usbSetDeviceAddress(void);
+static void wait_reset(void);
+
/*
* VCOM config
*/
@@ -510,7 +513,7 @@ static void vcomDataRxCb(void) {
reset_state = DTR_LOW;
if (newBytes >= 4) {
- unsigned int target = (unsigned int)usbWaitReset | 0x1;
+ unsigned int target = (unsigned int)wait_reset | 0x1;
usb_copy_from_pma(chkBuf, 4, VCOM_RX_ADDR);
@@ -751,3 +754,9 @@ static void usbSetConfiguration(void) {
static void usbSetDeviceAddress(void) {
USBLIB->state = USB_ADDRESSED;
}
+
+#define RESET_DELAY 100000
+static void wait_reset(void) {
+ delay_us(RESET_DELAY);
+ nvic_sys_reset();
+}