Add some more documentation to the half-completed Bluetooth Host demo, fix the OpenCh...
[pub/USBasp.git] / Demos / Host / Incomplete / BluetoothHost / ConfigDescriptor.c
index f0d9c1a..a69b7b3 100644 (file)
@@ -133,15 +133,30 @@ 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 Endpoint descriptor inside the current interface descriptor, aborting the \r
+ *  search if another interface descriptor is found before the required endpoint.\r
+ *\r
+ *  \return A value from the DSEARCH_Return_ErrorCodes_t enum\r
+ */\r
 uint8_t DComp_NextInterfaceBluetoothDataEndpoint(void* CurrentDescriptor)\r
 {\r
-       /* PURPOSE: Find next interface endpoint descriptor before next interface descriptor */\r
-\r
+       /* Determine the type of the current descriptor */\r
        if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)\r
-         return DESCRIPTOR_SEARCH_Found;\r
+       {\r
+               /* Indicate that the descriptor being searched for has been found */\r
+               return DESCRIPTOR_SEARCH_Found;\r
+       }\r
        else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)\r
-         return DESCRIPTOR_SEARCH_Fail;\r
+       {\r
+               /* Indicate that the search has failed prematurely and should be aborted */\r
+               return DESCRIPTOR_SEARCH_Fail;\r
+       }\r
 \r
+       /* Current descriptor does not match what this comparator is looking for */\r
        return DESCRIPTOR_SEARCH_NotFound;\r
 }\r
 \r