application: Use the Button struct to handle the play button.
[gps-watch.git] / src / common / virtual_com.c
index aa25cd78590424c7d567414888c855fd3aa9d2c4..cc388c704778aa037805d3fb01ffd56428a7f6e9 100644 (file)
@@ -59,6 +59,7 @@
 /* Provided by users. */
 extern void USB_DeviceClockInit(void);
 extern void USB_DeviceIsrEnable(void);
+extern void USB_DeviceIsrDisable(void);
 /*******************************************************************************
 * Definitions
 ******************************************************************************/
@@ -102,9 +103,8 @@ static usb_cdc_acm_info_t s_usbCdcAcmInfo = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0,
 
 /* Data buffer for receiving and sending*/
 static uint8_t s_currRecvBuf[DATA_BUFF_SIZE];
-volatile static uint32_t s_recvSize = 0;
-volatile static uint32_t s_sendSize = 0;
-volatile static uint8_t s_sendComplete = 0;
+static volatile uint32_t s_recvSize = 0;
+static volatile uint8_t s_sendComplete = 0;
 static uint32_t s_usbBulkMaxPacketSize = FS_CDC_VCOM_BULK_OUT_PACKET_SIZE;
 /*******************************************************************************
 * Prototypes
@@ -660,12 +660,18 @@ USB_VcomInit (uint16_t vid, uint16_t pid)
 }
 
 /* See virtual_com.h for documentation of this function. */
-void USB_VcomDeinit(usb_device_handle deviceHandle)
+void
+USB_VcomDeinit (void)
 {
-    USB_DeviceStop(deviceHandle);
-    USB_DeviceDeinit(deviceHandle);
+       if (s_cdcVcom.deviceHandle == NULL)
+               return;
+
+    USB_DeviceStop (s_cdcVcom.deviceHandle);
+    USB_DeviceDeinit (s_cdcVcom.deviceHandle);
     s_cdcVcom.deviceHandle = NULL;
 
+       USB_DeviceIsrDisable();
+
        /* XXX: We are not stopping the USBOTG clock yet. */
 }