diff Output/pjrcUSB/output_com.c @ 275:d5bf41d7f7ef

Initial code for USB cable detection - Currently actual detection commented out due to issues
author Jacob Alexander <haata@kiibohd.com>
date Mon, 09 Feb 2015 13:21:23 -0800
parents 9afed592bcb5
children 1495b4504a59 ab4515606277
line wrap: on
line diff
--- a/Output/pjrcUSB/output_com.c	Mon Feb 09 13:15:25 2015 -0800
+++ b/Output/pjrcUSB/output_com.c	Mon Feb 09 13:21:23 2015 -0800
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2014 by Jacob Alexander
+/* Copyright (C) 2011-2015 by Jacob Alexander
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -124,6 +124,11 @@
 // count until idle timeout
          uint8_t  USBKeys_Idle_Count = 0;
 
+// Indicates whether the Output module is fully functional
+// 0 - Not fully functional, 1 - Fully functional
+// 0 is often used to show that a USB cable is not plugged in (but has power)
+         uint8_t  Output_Available = 0;
+
 
 
 // ----- Capabilities -----
@@ -473,9 +478,11 @@
 {
 	// Initialize the USB, and then wait for the host to set configuration.
 	// This will hang forever if USB does not initialize
-	usb_init();
-
-	while ( !usb_configured() );
+	// If no USB cable is attached, does not try and initialize USB
+	if ( usb_init() )
+	{
+		while ( !usb_configured() );
+	}
 
 	// Register USB Output CLI dictionary
 	CLI_registerDictionary( outputCLIDict, outputCLIDictName );