forked from mfulz_github/qmk_firmware
Added extra DoxyGen documentation to the new PrinterHost demo.
This commit is contained in:
parent
3ee3ed2d6d
commit
8a28fd8e6c
|
@ -28,6 +28,12 @@
|
||||||
this software.
|
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"
|
#include "PrinterCommands.h"
|
||||||
|
|
||||||
/** Sends the given data directly to the printer via the data endpoints, for the sending of print commands in printer
|
/** Sends the given data directly to the printer via the data endpoints, for the sending of print commands in printer
|
||||||
|
|
|
@ -28,6 +28,11 @@
|
||||||
this software.
|
this software.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
*
|
||||||
|
* Header file for PrinterCommands.c.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _PRINTER_COMMANDS_H_
|
#ifndef _PRINTER_COMMANDS_H_
|
||||||
#define _PRINTER_COMMANDS_H_
|
#define _PRINTER_COMMANDS_H_
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ int main(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Configures the board hardware and chip peripherals for the demo's functionality. */
|
||||||
void SetupHardware(void)
|
void SetupHardware(void)
|
||||||
{
|
{
|
||||||
/* Disable watchdog if enabled by bootloader/fuses */
|
/* Disable watchdog if enabled by bootloader/fuses */
|
||||||
|
@ -69,18 +70,33 @@ void SetupHardware(void)
|
||||||
USB_Init();
|
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)
|
void EVENT_USB_DeviceAttached(void)
|
||||||
{
|
{
|
||||||
puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE));
|
puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE));
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
|
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)
|
void EVENT_USB_DeviceUnattached(void)
|
||||||
{
|
{
|
||||||
puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE));
|
puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE));
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
|
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)
|
void EVENT_USB_HostError(uint8_t ErrorCode)
|
||||||
{
|
{
|
||||||
USB_ShutDown();
|
USB_ShutDown();
|
||||||
|
@ -92,20 +108,22 @@ void EVENT_USB_HostError(uint8_t ErrorCode)
|
||||||
for(;;);
|
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)
|
void EVENT_USB_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode)
|
||||||
{
|
{
|
||||||
puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));
|
puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));
|
||||||
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);
|
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);
|
printf_P(PSTR(" -- In State %d\r\n" ESC_FG_WHITE), USB_HostState);
|
||||||
|
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EVENT_USB_DeviceEnumerationComplete(void)
|
/** 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.
|
||||||
LEDs_SetAllLEDs(LEDMASK_USB_READY);
|
*/
|
||||||
}
|
|
||||||
|
|
||||||
void USB_Printer_Host(void)
|
void USB_Printer_Host(void)
|
||||||
{
|
{
|
||||||
uint8_t ErrorCode;
|
uint8_t ErrorCode;
|
||||||
|
|
|
@ -28,6 +28,11 @@
|
||||||
this software.
|
this software.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
*
|
||||||
|
* Header file for PrinterHost.c.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _MASS_STORE_HOST_H_
|
#ifndef _MASS_STORE_HOST_H_
|
||||||
#define _MASS_STORE_HOST_H_
|
#define _MASS_STORE_HOST_H_
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
*/
|
Loading…
Reference in New Issue