Add README.
[gps-watch.git] / src / common / usb_serial.rs
index 6a7cd173b0fc09e51e04021e7a32604170914bbe..3f9e48f7faff8a81e244e477744dad5e0fce5c68 100644 (file)
@@ -26,12 +26,17 @@ use clock;
 
 extern {
     fn USB_VcomInit(vid: u16, pid: u16);
+    fn USB_VcomDeinit();
 }
 
 pub unsafe fn init(vid: u16, pid: u16) {
     USB_VcomInit(vid, pid);
 }
 
+pub unsafe fn shutdown() {
+    USB_VcomDeinit();
+}
+
 #[no_mangle]
 #[allow(non_snake_case)]
 pub unsafe extern fn USB_DeviceIsrEnable()
@@ -43,6 +48,15 @@ pub unsafe extern fn USB_DeviceIsrEnable()
     nvic::enable_irq(irq_number);
 }
 
+#[no_mangle]
+#[allow(non_snake_case)]
+pub unsafe extern fn USB_DeviceIsrDisable()
+{
+    let irq_number = 24; // USB0
+
+    nvic::disable_irq(irq_number);
+}
+
 #[no_mangle]
 #[allow(non_snake_case)]
 pub unsafe extern fn USB_DeviceClockInit()