aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/LowLevel/PrinterHost/PrinterHost.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-07-20 13:49:26 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-07-20 13:49:26 +0000
commit8a28fd8e6ccdb6a33727f7df089802b4d34dbea7 (patch)
treea96ee5ce7dc58344d141224b3d6241f7e3ee0541 /Demos/Host/LowLevel/PrinterHost/PrinterHost.c
parent3ee3ed2d6d3edc18183355abf33d50e14723ff06 (diff)
downloadlufa-8a28fd8e6ccdb6a33727f7df089802b4d34dbea7.tar.gz
lufa-8a28fd8e6ccdb6a33727f7df089802b4d34dbea7.tar.bz2
lufa-8a28fd8e6ccdb6a33727f7df089802b4d34dbea7.zip
Added extra DoxyGen documentation to the new PrinterHost demo.
Diffstat (limited to 'Demos/Host/LowLevel/PrinterHost/PrinterHost.c')
-rw-r--r--Demos/Host/LowLevel/PrinterHost/PrinterHost.c28
1 files changed, 23 insertions, 5 deletions
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;