From 8a28fd8e6ccdb6a33727f7df089802b4d34dbea7 Mon Sep 17 00:00:00 2001
From: Dean Camera <dean@fourwalledcubicle.com>
Date: Mon, 20 Jul 2009 13:49:26 +0000
Subject: [PATCH] Added extra DoxyGen documentation to the new PrinterHost
 demo.

---
 .../PrinterHost/Lib/PrinterCommands.c         |  6 ++
 .../PrinterHost/Lib/PrinterCommands.h         |  5 ++
 Demos/Host/LowLevel/PrinterHost/PrinterHost.c | 28 ++++++--
 Demos/Host/LowLevel/PrinterHost/PrinterHost.h |  5 ++
 .../Host/LowLevel/PrinterHost/PrinterHost.txt | 64 +++++++++++++++++++
 5 files changed, 103 insertions(+), 5 deletions(-)
 create mode 100644 Demos/Host/LowLevel/PrinterHost/PrinterHost.txt

diff --git a/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c b/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c
index 4e2a0d9db..6ed7fa908 100644
--- a/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c
+++ b/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c
@@ -28,6 +28,12 @@
   this software.
 */
 
+/** \file
+ *
+ *  Printer Device commands, to send/recieve data to and from an attached USB
+ *  printer, and to send and receive Printer Class control requests.
+ */
+
 #include "PrinterCommands.h"
 
 /** Sends the given data directly to the printer via the data endpoints, for the sending of print commands in printer
diff --git a/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.h b/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.h
index 4656d190e..896a5903e 100644
--- a/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.h
+++ b/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.h
@@ -28,6 +28,11 @@
   this software.
 */
 
+/** \file
+ *
+ *  Header file for PrinterCommands.c.
+ */
+ 
 #ifndef _PRINTER_COMMANDS_H_
 #define _PRINTER_COMMANDS_H_
 
diff --git a/Demos/Host/LowLevel/PrinterHost/PrinterHost.c b/Demos/Host/LowLevel/PrinterHost/PrinterHost.c
index 6bbacab0a..64adf22c7 100644
--- a/Demos/Host/LowLevel/PrinterHost/PrinterHost.c
+++ b/Demos/Host/LowLevel/PrinterHost/PrinterHost.c
@@ -54,6 +54,7 @@ int main(void)
 	}
 }
 
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
 void SetupHardware(void)
 {
 	/* Disable watchdog if enabled by bootloader/fuses */
@@ -69,18 +70,33 @@ void SetupHardware(void)
 	USB_Init();
 }
 
+/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
+ *  starts the library USB task to begin the enumeration and USB management process.
+ */
 void EVENT_USB_DeviceAttached(void)
 {
 	puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE));
 	LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
 }
 
+/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
+ *  stops the library USB task management process.
+ */
 void EVENT_USB_DeviceUnattached(void)
 {
 	puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE));
 	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
 }
 
+/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
+ *  enumerated by the host and is now ready to be used by the application.
+ */
+void EVENT_USB_DeviceEnumerationComplete(void)
+{
+	LEDs_SetAllLEDs(LEDMASK_USB_READY);
+}
+
+/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
 void EVENT_USB_HostError(uint8_t ErrorCode)
 {
 	USB_ShutDown();
@@ -92,20 +108,22 @@ void EVENT_USB_HostError(uint8_t ErrorCode)
 	for(;;);
 }
 
+/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
+ *  enumerating an attached USB device.
+ */
 void EVENT_USB_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode)
 {
 	puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));
 	printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);
+	printf_P(PSTR(" -- Sub Error Code %d\r\n"), SubErrorCode);
 	printf_P(PSTR(" -- In State %d\r\n" ESC_FG_WHITE), USB_HostState);
 
 	LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
 }
 
-void EVENT_USB_DeviceEnumerationComplete(void)
-{
-	LEDs_SetAllLEDs(LEDMASK_USB_READY);
-}
-
+/** Task to set the configuration of the attached device after it has been enumerated, and to send some test page
+ *  data to the attached printer.
+ */
 void USB_Printer_Host(void)
 {
 	uint8_t ErrorCode;
diff --git a/Demos/Host/LowLevel/PrinterHost/PrinterHost.h b/Demos/Host/LowLevel/PrinterHost/PrinterHost.h
index 5851349e4..f6afcc796 100644
--- a/Demos/Host/LowLevel/PrinterHost/PrinterHost.h
+++ b/Demos/Host/LowLevel/PrinterHost/PrinterHost.h
@@ -28,6 +28,11 @@
   this software.
 */
 
+/** \file
+ *
+ *  Header file for PrinterHost.c.
+ */
+ 
 #ifndef _MASS_STORE_HOST_H_
 #define _MASS_STORE_HOST_H_
 
diff --git a/Demos/Host/LowLevel/PrinterHost/PrinterHost.txt b/Demos/Host/LowLevel/PrinterHost/PrinterHost.txt
new file mode 100644
index 000000000..6326469e0
--- /dev/null
+++ b/Demos/Host/LowLevel/PrinterHost/PrinterHost.txt
@@ -0,0 +1,64 @@
+/** \file
+ *
+ *  This file contains special DoxyGen information for the generation of the main page and other special
+ *  documentation pages. It is not a project source file.
+ */
+ 
+/** \mainpage Printer Host Demo
+ *
+ *  \section SSec_Compat Demo Compatibility:
+ *
+ *  The following table indicates what microcontrollers are compatible with this demo.
+ *
+ *  - AT90USB1287
+ *  - AT90USB1286
+ *
+ *  \section SSec_Info USB Information:
+ *
+ *  The following table gives a rundown of the USB utilization of this demo.
+ *
+ *  <table>
+ *   <tr>
+ *    <td><b>USB Mode:</b></td>
+ *    <td>Host</td>
+ *   </tr>
+ *   <tr>
+ *    <td><b>USB Class:</b></td>
+ *    <td>Printer Device</td>
+ *   </tr>
+ *   <tr> 
+ *    <td><b>USB Subclass:</b></td>
+ *    <td>Bidirectional Protocol</td>
+ *   </tr>
+ *   <tr>
+ *    <td><b>Relevant Standards:</b></td>
+ *    <td>USBIF Printer Class Specification, PCL Language Specification</td>
+ *   </tr>
+ *   <tr>
+ *    <td><b>Usable Speeds:</b></td>
+ *    <td>Low Speed Mode, Full Speed Mode</td>
+ *   </tr>
+ *  </table>
+ *
+ *  \section SSec_Description Project Description: 
+ *
+ *  Printer host demonstration application. This gives a simple reference
+ *  application for implementing a USB Printer host, for USB printers using
+ *  the bidirectional data encapsulation protocol and PCL language.
+ *  
+ *  Upon connection of a compatible printer, the printer's device ID is sent
+ *  to the AVR's serial port, and a simple test page is printed using the PCL
+ *  printer language.
+ *  
+ *  \section SSec_Options Project Options
+ *
+ *  The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
+ *
+ *  <table>
+ *   <tr>
+ *    <td>
+ *     None
+ *    </td>
+ *   </tr>
+ *  </table>
+ */
\ No newline at end of file
-- 
GitLab