aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/USB_CDC/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'testhal/STM32/USB_CDC/main.c')
-rw-r--r--testhal/STM32/USB_CDC/main.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/testhal/STM32/USB_CDC/main.c b/testhal/STM32/USB_CDC/main.c
index 943edbb05..70a27a8f2 100644
--- a/testhal/STM32/USB_CDC/main.c
+++ b/testhal/STM32/USB_CDC/main.c
@@ -233,6 +233,21 @@ static const USBDescriptor *get_descriptor(USBDriver *usbp,
}
/**
+ * @brief EP1 state.
+ */
+USBEndpointState ep1state;
+
+/**
+ * @brief EP2 state.
+ */
+USBEndpointState ep2state;
+
+/**
+ * @brief EP3 state.
+ */
+USBEndpointState ep3state;
+
+/**
* @brief EP1 initialization structure (IN only).
*/
static const USBEndpointConfig ep1config = {
@@ -284,9 +299,9 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
case USB_EVENT_CONFIGURED:
/* Enables the endpoints specified into the configuration.*/
chSysLock();
- usbEnableEndpointI(usbp, DATA_REQUEST_EP, &ep1config);
- usbEnableEndpointI(usbp, INTERRUPT_REQUEST_EP, &ep2config);
- usbEnableEndpointI(usbp, DATA_AVAILABLE_EP, &ep3config);
+ usbInitEndpointI(usbp, DATA_REQUEST_EP, &ep1state, &ep1config);
+ usbInitEndpointI(usbp, INTERRUPT_REQUEST_EP, &ep2state, &ep2config);
+ usbInitEndpointI(usbp, DATA_AVAILABLE_EP, &ep3state, &ep3config);
chSysUnlock();
return;
case USB_EVENT_SUSPEND: