Added new JoystickHostWithParser demos to the library.
[pub/USBasp.git] / Demos / Host / LowLevel / PrinterHost / ConfigDescriptor.c
index b4f97ed..043f1ad 100644 (file)
 \r
 #include "ConfigDescriptor.h"\r
 \r
+/** Interface number for the bidirectional Printer interface found within the device. */\r
 uint8_t PrinterInterfaceNumber;\r
-uint8_t PrinterAltSetting;\r
 \r
+/** Interface Alternate Setting number for the bidirectional Printer interface found within the device. */\r
+uint8_t PrinterAltSetting;\r
 \r
+/** Reads and processes an attached device's descriptors, to determine compatibility and pipe configurations. This\r
+ *  routine will read in the entire configuration descriptor, and configure the hosts pipes to correctly communicate\r
+ *  with compatible devices.\r
+ *\r
+ *  This routine searches for a bidirectional Printer interface descriptor containing bulk IN and OUT data endpoints.\r
+ *\r
+ *  \return An error code from the \ref PrinterHost_GetConfigDescriptorDataCodes_t enum.\r
+ */\r
 uint8_t ProcessConfigurationDescriptor(void)\r
 {\r
        uint8_t  ConfigDescriptorData[512];\r
@@ -105,10 +115,17 @@ uint8_t ProcessConfigurationDescriptor(void)
        return SuccessfulConfigRead;\r
 }\r
 \r
+/** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's\r
+ *  configuration descriptor, to search for a specific sub descriptor. It can also be used to abort the configuration\r
+ *  descriptor processing if an incompatible descriptor configuration is found.\r
+ *\r
+ *  This comparator searches for the next Bidirectional Printer Interface descriptor of the current Printer interface,\r
+ *  aborting the search if the end of the descriptors is found.\r
+ *\r
+ *  \return A value from the \ref DSEARCH_Return_ErrorCodes_t enum\r
+ */\r
 uint8_t DComp_NextBidirectionalPrinterInterface(void* CurrentDescriptor)\r
 {\r
-       /* PURPOSE: Find next bidirectional protocol printer class interface descriptor */\r
-\r
        if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)\r
        {\r
                /* Check the descriptor class and protocol, break out if correct class/protocol interface found */\r
@@ -123,10 +140,17 @@ uint8_t DComp_NextBidirectionalPrinterInterface(void* CurrentDescriptor)
        return DESCRIPTOR_SEARCH_NotFound;\r
 }\r
 \r
+/** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's\r
+ *  configuration descriptor, to search for a specific sub descriptor. It can also be used to abort the configuration\r
+ *  descriptor processing if an incompatible descriptor configuration is found.\r
+ *\r
+ *  This comparator searches for the next Bulk Endpoint descriptor of the current Printer interface, aborting the\r
+ *  search if another interface descriptor is found before the next endpoint.\r
+ *\r
+ *  \return A value from the \ref DSEARCH_Return_ErrorCodes_t enum\r
+ */\r
 uint8_t DComp_NextPrinterInterfaceBulkDataEndpoint(void* CurrentDescriptor)\r
 {\r
-       /* PURPOSE: Find next interface bulk endpoint descriptor before next interface descriptor */\r
-\r
        if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)\r
        {\r
                uint8_t EndpointType = (DESCRIPTOR_CAST(CurrentDescriptor,\r