diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-08-17 12:40:48 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-08-17 12:40:48 +0000 |
commit | e372aabda9da9309671e058839d668ec38c7e8c1 (patch) | |
tree | 2bc1ca8877673afe588ddd76237b2613e1f0a0b8 /testhal/STM32F4xx/USB_CDC/main.c | |
parent | 0969ab51e5b002d49b0805556e9ff8365d7fa89a (diff) | |
download | ChibiOS-e372aabda9da9309671e058839d668ec38c7e8c1.tar.gz ChibiOS-e372aabda9da9309671e058839d668ec38c7e8c1.tar.bz2 ChibiOS-e372aabda9da9309671e058839d668ec38c7e8c1.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4575 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32F4xx/USB_CDC/main.c')
-rw-r--r-- | testhal/STM32F4xx/USB_CDC/main.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/testhal/STM32F4xx/USB_CDC/main.c b/testhal/STM32F4xx/USB_CDC/main.c index 027f92a81..34bdf55eb 100644 --- a/testhal/STM32F4xx/USB_CDC/main.c +++ b/testhal/STM32F4xx/USB_CDC/main.c @@ -324,16 +324,20 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { }
/*
+ * USB driver configuration.
+ */
+static const USBConfig usbcfg = {
+ usb_event,
+ get_descriptor,
+ sduRequestsHook,
+ NULL
+};
+
+/*
* Serial over USB driver configuration.
*/
static const SerialUSBConfig serusbcfg = {
- &USBD1,
- {
- usb_event,
- get_descriptor,
- sduRequestsHook,
- NULL
- }
+ &USBD1
};
/*===========================================================================*/
@@ -480,12 +484,19 @@ int main(void) { chSysInit();
/*
+ * Initializes a serial-over-USB CDC driver.
+ */
+ sduObjectInit(&SDU1);
+ sduStart(&SDU1, &serusbcfg);
+
+ /*
* Activates the USB driver and then the USB bus pull-up on D+.
+ * Note, a delay is inserted in order to not have to disconnect the cable
+ * after a reset.
*/
usbDisconnectBus(serusbcfg.usbp);
chThdSleepMilliseconds(1000);
- sduObjectInit(&SDU1);
- sduStart(&SDU1, &serusbcfg);
+ usbStart(&USBD1, &usbcfg);
usbConnectBus(serusbcfg.usbp);
/*
|