Fixed compilation error in the AudioInput demos when MICROPHONE_BIASED_TO_HALF_RAIL...
[pub/USBasp.git] / Demos / Device / Incomplete / Sideshow / Lib / SideshowCommands.c
index 8dc0b62..0353af4 100644 (file)
@@ -1,21 +1,21 @@
 /*\r
              LUFA Library\r
-     Copyright (C) Dean Camera, 2009.\r
+     Copyright (C) Dean Camera, 2010.\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
       www.fourwalledcubicle.com\r
 */\r
 \r
 /*\r
-  Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
-\r
-  Permission to use, copy, modify, and distribute this software\r
-  and its documentation for any purpose and without fee is hereby\r
-  granted, provided that the above copyright notice appear in all\r
-  copies and that both that the copyright notice and this\r
-  permission notice and warranty disclaimer appear in supporting\r
-  documentation, and that the name of the author not be used in\r
-  advertising or publicity pertaining to distribution of the\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
   software without specific, written prior permission.\r
 \r
   The author disclaim all warranties with regard to this\r
@@ -295,21 +295,26 @@ static void SideShow_GetString(SideShow_PacketHeader_t* PacketHeader, void* Unic
 \r
 static void SideShow_GetApplicationOrder(SideShow_PacketHeader_t* PacketHeader)\r
 {\r
-       uint8_t TotalInstalledApplications = SideShow_GetTotalApplications();\r
-       uint16_t GadgetGUIDBytes           = (TotalInstalledApplications * sizeof(GUID_t));\r
-\r
+       uint8_t  TotalApplications = 0;\r
+                  \r
        Endpoint_ClearOUT();\r
 \r
+       for (uint8_t App = 0; App < MAX_APPLICATIONS; App++)\r
+       {\r
+               if (InstalledApplications[App].InUse)\r
+                 TotalApplications++;\r
+       }\r
+\r
        PacketHeader->Length = sizeof(SideShow_PacketHeader_t) +\r
-                              sizeof(uint32_t) + GadgetGUIDBytes;\r
+                              sizeof(uint32_t) + (TotalApplications * sizeof(GUID_t));\r
        \r
        Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);\r
        Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));\r
-       Endpoint_Write_DWord_LE(TotalInstalledApplications);\r
+       Endpoint_Write_DWord_LE(TotalApplications);\r
        \r
        for (uint8_t App = 0; App < MAX_APPLICATIONS; App++)\r
        {\r
-               if (InstalledApplications[App].InUse == true)\r
+               if (InstalledApplications[App].InUse)\r
                  Endpoint_Write_Stream_LE(&InstalledApplications[App].ApplicationID, sizeof(GUID_t));\r
        }\r
 \r
@@ -386,9 +391,7 @@ static void SideShow_DeleteApplication(SideShow_PacketHeader_t* PacketHeader)
        SideShow_Application_t* AppToDelete = SideShow_GetApplicationFromGUID(&ApplicationGUID);\r
 \r
        if (AppToDelete != NULL)\r
-       {\r
-               AppToDelete->InUse = false;\r
-       }\r
+         AppToDelete->InUse = false;\r
        else\r
          PacketHeader->Type.NAK = true;\r
 \r