From 5a4def747897c1c6ffbe465506d846c7c686d3e9 Mon Sep 17 00:00:00 2001 From: Dean Camera <dean@fourwalledcubicle.com> Date: Wed, 13 Oct 2010 14:05:35 +0000 Subject: Clean up excessive whitespace at the end of each line using the wspurify tool made by Laszlo Monda --- .../Incomplete/Sideshow/Lib/SideshowApplications.c | 17 ++-- .../Incomplete/Sideshow/Lib/SideshowApplications.h | 23 +++-- .../Incomplete/Sideshow/Lib/SideshowCommands.c | 113 +++++++++++---------- .../Incomplete/Sideshow/Lib/SideshowCommands.h | 43 ++++---- .../Incomplete/Sideshow/Lib/SideshowCommon.c | 23 +++-- .../Incomplete/Sideshow/Lib/SideshowCommon.h | 30 +++--- .../Incomplete/Sideshow/Lib/SideshowContent.c | 23 +++-- .../Incomplete/Sideshow/Lib/SideshowContent.h | 38 +++---- 8 files changed, 158 insertions(+), 152 deletions(-) (limited to 'Demos/Device/Incomplete/Sideshow/Lib') diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c index e8631be8e..c7dca5ad7 100644 --- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c +++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -9,13 +9,13 @@ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in + without fee, provided that the above copyright notice appear in all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -40,7 +40,7 @@ SideShow_Application_t* SideShow_GetFreeApplication(void) if (!(InstalledApplications[App].InUse)) return &InstalledApplications[App]; } - + return NULL; } @@ -54,6 +54,7 @@ SideShow_Application_t* SideShow_GetApplicationFromGUID(GUID_t* const GUID) return &InstalledApplications[App]; } } - + return NULL; } + diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.h b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.h index 9624c7c34..02b2ea4ca 100644 --- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.h +++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.h @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -9,13 +9,13 @@ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in + without fee, provided that the above copyright notice appear in all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -32,10 +32,10 @@ #define _SIDESHOW_APPLICATIONS_H_ /* Includes: */ - #include <avr/io.h> + #include <avr/io.h> #include <string.h> #include <stdbool.h> - + #include "SideshowCommon.h" /* Type Defines: */ @@ -51,12 +51,13 @@ uint32_t CurrentContentID; uint8_t CurrentContent[MAX_CONTENTBUFFER_PER_APP]; } SideShow_Application_t; - + /* External Variables: */ extern SideShow_Application_t InstalledApplications[MAX_APPLICATIONS]; - + /* Function Prototypes: */ SideShow_Application_t* SideShow_GetFreeApplication(void); SideShow_Application_t* SideShow_GetApplicationFromGUID(GUID_t* const GUID); - + #endif + diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c index eebc2ef35..bfcebce17 100644 --- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c +++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -9,13 +9,13 @@ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in + without fee, provided that the above copyright notice appear in all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -42,14 +42,14 @@ Unicode_String_t Manufacturer = {LengthInBytes: sizeof(L"Dean Camera"), Unicode_String_t SupportedLanguage = {LengthInBytes: sizeof(L"en-US:1"), UnicodeString: L"en-US:1"}; - + void Sideshow_ProcessCommandPacket(void) { SideShow_PacketHeader_t PacketHeader; - - Endpoint_SelectEndpoint(SIDESHOW_OUT_EPNUM); + + Endpoint_SelectEndpoint(SIDESHOW_OUT_EPNUM); Endpoint_Read_Stream_LE(&PacketHeader, sizeof(SideShow_PacketHeader_t)); - + PacketHeader.Type.TypeFields.Response = true; printf("\r\nCmd: %lX", (PacketHeader.Type.TypeLong & 0x00FFFFFF)); @@ -70,7 +70,7 @@ void Sideshow_ProcessCommandPacket(void) break; case SIDESHOW_CMD_GET_CAPABILITIES: SideShow_GetCapabilities(&PacketHeader); - break; + break; case SIDESHOW_CMD_GET_DEVICE_NAME: SideShow_GetString(&PacketHeader, &DeviceName); break; @@ -94,7 +94,7 @@ void Sideshow_ProcessCommandPacket(void) break; case SIDESHOW_CMD_DELETE_ALL_CONTENT: SideShow_DeleteAllContent(&PacketHeader); - break; + break; case SIDESHOW_CMD_DELETE_APPLICATION: SideShow_DeleteApplication(&PacketHeader); break; @@ -109,11 +109,11 @@ void Sideshow_ProcessCommandPacket(void) PacketHeader.Length = sizeof(SideShow_PacketHeader_t); PacketHeader.Type.TypeFields.NAK = true; - - Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM); - Endpoint_Write_Stream_LE(&PacketHeader, sizeof(SideShow_PacketHeader_t)); + + Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM); + Endpoint_Write_Stream_LE(&PacketHeader, sizeof(SideShow_PacketHeader_t)); Endpoint_ClearIN(); - + printf(" UNK"); } } @@ -122,8 +122,8 @@ static void SideShow_Ping(SideShow_PacketHeader_t* const PacketHeader) { Endpoint_ClearOUT(); - Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM); - Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t)); + Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM); + Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t)); Endpoint_ClearIN(); } @@ -133,12 +133,12 @@ static void SideShow_Sync(SideShow_PacketHeader_t* const PacketHeader) Endpoint_Read_Stream_LE(&ProtocolGUID, sizeof(GUID_t)); Endpoint_ClearOUT(); - + if (!(GUID_COMPARE(&ProtocolGUID, (uint32_t[])STANDARD_PROTOCOL_GUID))) PacketHeader->Type.TypeFields.NAK = true; - + Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM); - Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t)); + Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t)); Endpoint_Write_Stream_LE(&ProtocolGUID, sizeof(GUID_t)); Endpoint_ClearIN(); } @@ -159,7 +159,7 @@ static void SideShow_SetCurrentUser(SideShow_PacketHeader_t* const PacketHeader) { SideShow_Read_Unicode_String(&UserSID, sizeof(UserSID.UnicodeString)); Endpoint_ClearOUT(); - + PacketHeader->Length = sizeof(SideShow_PacketHeader_t); Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM); @@ -174,7 +174,7 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader Endpoint_Read_Stream_LE(&Property, sizeof(SideShow_PropertyKey_t)); Endpoint_ClearOUT(); - + printf(" ID: %lu", Property.PropertyID); PacketHeader->Length = sizeof(SideShow_PacketHeader_t); @@ -187,46 +187,46 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader PropertyData.DataType = VT_I4; PropertyData.Data.Data32 = ScreenText; PacketHeader->Length += sizeof(uint32_t); - + break; case PROPERTY_SIDESHOW_SCREENWIDTH: case PROPERTY_SIDESHOW_CLIENTWIDTH: PropertyData.DataType = VT_UI2; PropertyData.Data.Data16 = 16; PacketHeader->Length += sizeof(uint16_t); - + break; case PROPERTY_SIDESHOW_SCREENHEIGHT: case PROPERTY_SIDESHOW_CLIENTHEIGHT: PropertyData.DataType = VT_UI2; PropertyData.Data.Data16 = 2; PacketHeader->Length += sizeof(uint16_t); - + break; case PROPERTY_SIDESHOW_COLORDEPTH: PropertyData.DataType = VT_UI2; PropertyData.Data.Data16 = 1; PacketHeader->Length += sizeof(uint16_t); - + break; case PROPERTY_SIDESHOW_COLORTYPE: PropertyData.DataType = VT_UI2; PropertyData.Data.Data16 = BlackAndWhiteDisplay; PacketHeader->Length += sizeof(uint16_t); - + break; case PROPERTY_SIDESHOW_DATACACHE: PropertyData.DataType = VT_BOOL; PropertyData.Data.Data16 = false; PacketHeader->Length += sizeof(uint16_t); - + break; case PROPERTY_SIDESHOW_SUPPORTEDLANGS: case PROPERTY_SIDESHOW_CURRENTLANG: PropertyData.DataType = VT_LPWSTR; PropertyData.Data.DataPointer = &SupportedLanguage; PacketHeader->Length += SupportedLanguage.LengthInBytes; - + break; default: PropertyData.DataType = VT_EMPTY; @@ -241,22 +241,22 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader PropertyData.DataType = VT_UI4; PropertyData.Data.Data32 = GenericDevice; PacketHeader->Length += sizeof(uint32_t); - + break; } - } + } else { - PacketHeader->Type.TypeFields.NAK = true; - + PacketHeader->Type.TypeFields.NAK = true; + printf(" WRONG GUID"); printf(" %lX %lX %lX %lX", Property.PropertyGUID.Chunks[0], Property.PropertyGUID.Chunks[1], - Property.PropertyGUID.Chunks[2], Property.PropertyGUID.Chunks[3]); + Property.PropertyGUID.Chunks[2], Property.PropertyGUID.Chunks[3]); } Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM); Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t)); - + if (!(PacketHeader->Type.TypeFields.NAK)) { switch (PropertyData.DataType) @@ -275,7 +275,7 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader break; } } - + Endpoint_ClearIN(); return; } @@ -287,7 +287,7 @@ static void SideShow_GetString(SideShow_PacketHeader_t* const PacketHeader, PacketHeader->Length = sizeof(SideShow_PacketHeader_t) + sizeof(uint32_t) + ((Unicode_String_t*)UnicodeStruct)->LengthInBytes; - + Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM); Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t)); SideShow_Write_Unicode_String(UnicodeStruct); @@ -297,7 +297,7 @@ static void SideShow_GetString(SideShow_PacketHeader_t* const PacketHeader, static void SideShow_GetApplicationOrder(SideShow_PacketHeader_t* const PacketHeader) { uint8_t TotalApplications = 0; - + Endpoint_ClearOUT(); for (uint8_t App = 0; App < MAX_APPLICATIONS; App++) @@ -308,11 +308,11 @@ static void SideShow_GetApplicationOrder(SideShow_PacketHeader_t* const PacketHe PacketHeader->Length = sizeof(SideShow_PacketHeader_t) + sizeof(uint32_t) + (TotalApplications * sizeof(GUID_t)); - + Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM); Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t)); Endpoint_Write_DWord_LE(TotalApplications); - + for (uint8_t App = 0; App < MAX_APPLICATIONS; App++) { if (InstalledApplications[App].InUse) @@ -329,7 +329,7 @@ static void SideShow_GetSupportedEndpoints(SideShow_PacketHeader_t* const Packet Endpoint_ClearOUT(); PacketHeader->Length = sizeof(SideShow_PacketHeader_t) + sizeof(uint32_t) + sizeof(GUID_t); - + Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM); Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t)); Endpoint_Write_DWord_LE(1); @@ -369,7 +369,7 @@ static void SideShow_AddApplication(SideShow_PacketHeader_t* const PacketHeader) SideShow_Discard_Byte_Stream(); SideShow_Discard_Byte_Stream(); Endpoint_ClearOUT(); - + CurrApp->InUse = true; CurrApp->HaveContent = false; CurrApp->CurrentContentID = 1; @@ -385,8 +385,8 @@ static void SideShow_AddApplication(SideShow_PacketHeader_t* const PacketHeader) static void SideShow_DeleteApplication(SideShow_PacketHeader_t* const PacketHeader) { GUID_t ApplicationGUID; - - Endpoint_Read_Stream_LE(&ApplicationGUID, sizeof(GUID_t)); + + Endpoint_Read_Stream_LE(&ApplicationGUID, sizeof(GUID_t)); Endpoint_ClearOUT(); SideShow_Application_t* AppToDelete = SideShow_GetApplicationFromGUID(&ApplicationGUID); @@ -406,7 +406,7 @@ static void SideShow_DeleteApplication(SideShow_PacketHeader_t* const PacketHead static void SideShow_DeleteAllApplications(SideShow_PacketHeader_t* const PacketHeader) { Endpoint_ClearOUT(); - + for (uint8_t App = 0; App < MAX_APPLICATIONS; App++) InstalledApplications[App].InUse = false; @@ -420,12 +420,12 @@ static void SideShow_AddContent(SideShow_PacketHeader_t* const PacketHeader) GUID_t ApplicationID; GUID_t EndpointID; SideShow_Application_t* Application; - + Endpoint_Read_Stream_LE(&ApplicationID, sizeof(GUID_t)); Endpoint_Read_Stream_LE(&EndpointID, sizeof(GUID_t)); - + Application = SideShow_GetApplicationFromGUID(&ApplicationID); - + if (Application == NULL) { SideShow_Discard_Byte_Stream(); @@ -435,7 +435,7 @@ static void SideShow_AddContent(SideShow_PacketHeader_t* const PacketHeader) { PacketHeader->Type.TypeFields.NAK = true; } - + Endpoint_ClearOUT(); PacketHeader->Length = sizeof(SideShow_PacketHeader_t); @@ -455,14 +455,14 @@ static void SideShow_DeleteContent(SideShow_PacketHeader_t* const PacketHeader) Endpoint_Read_Stream_LE(&EndpointID, sizeof(GUID_t)); Endpoint_Read_Stream_LE(&ContentID, sizeof(uint32_t)); Endpoint_ClearOUT(); - + SideShow_Application_t* Application = SideShow_GetApplicationFromGUID(&ApplicationID); - + if ((Application != NULL) && (Application->CurrentContentID == ContentID)) Application->HaveContent = false; else PacketHeader->Type.TypeFields.NAK = true; - + PacketHeader->Length = sizeof(SideShow_PacketHeader_t); Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM); @@ -480,15 +480,16 @@ static void SideShow_DeleteAllContent(SideShow_PacketHeader_t* const PacketHeade Endpoint_ClearOUT(); SideShow_Application_t* Application = SideShow_GetApplicationFromGUID(&ApplicationID); - + if (Application != NULL) Application->HaveContent = false; else - PacketHeader->Type.TypeFields.NAK = true; + PacketHeader->Type.TypeFields.NAK = true; PacketHeader->Length = sizeof(SideShow_PacketHeader_t); Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM); Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t)); - Endpoint_ClearIN(); + Endpoint_ClearIN(); } + diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.h b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.h index 1395cd367..5026d5b5b 100644 --- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.h +++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.h @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -9,13 +9,13 @@ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in + without fee, provided that the above copyright notice appear in all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -35,7 +35,7 @@ #include <avr/io.h> #include <stdbool.h> #include <string.h> - + #include "Sideshow.h" #include "SideshowCommon.h" #include "SideshowApplications.h" @@ -63,25 +63,25 @@ VT_UI4 = 19, VT_LPWSTR = 31, }; - + enum SideShow_ScreenTypeText_t { ScreenBitmap = 0, ScreenText = 1, }; - + enum SideShow_ColorTypes_t { ColorDisplay = 0, GrayscaleDisplay = 1, - BlackAndWhiteDisplay = 2, + BlackAndWhiteDisplay = 2, }; enum SideShow_DeviceTypes_t - { - GenericDevice = 0, - CameraDevice = 1, - MediaPlayerDevice = 2, + { + GenericDevice = 0, + CameraDevice = 1, + MediaPlayerDevice = 2, PhoneDevice = 3, VideoDevice = 4, PIMDevice = 5, @@ -94,11 +94,11 @@ GUID_t PropertyGUID; uint32_t PropertyID; } SideShow_PropertyKey_t; - + typedef struct { uint32_t DataType; - + union { void* DataPointer; @@ -107,12 +107,12 @@ uint32_t Data32; } Data; } SideShow_PropertyData_t; - + /* Macros: */ #define SIDESHOW_CMD_PING 0x001 #define SIDESHOW_CMD_SET_CURRENT_USER 0x100 #define SIDESHOW_CMD_GET_CURRENT_USER 0x101 - #define SIDESHOW_CMD_GET_CAPABILITIES 0x103 + #define SIDESHOW_CMD_GET_CAPABILITIES 0x103 #define SIDESHOW_CMD_GET_APPLICATION_ORDER 0x104 #define SIDESHOW_CMD_ADD_APPLICATION 0x10D #define SIDESHOW_CMD_DELETE_APPLICATION 0x10E @@ -139,12 +139,12 @@ #define PROPERTY_SIDESHOW_CLIENTWIDTH 15 #define PROPERTY_SIDESHOW_CLIENTHEIGHT 16 #define PROPERTY_SIDESHOW_DEVICEICON 17 - + #define PROPERTY_DEVICE_DEVICETYPE 15 - + /* Function Prototypes: */ void Sideshow_ProcessCommandPacket(void); - + #if defined(INCLUDE_FROM_SIDESHOWCOMMANDS_H) static void SideShow_Ping(SideShow_PacketHeader_t* const PacketHeader); static void SideShow_Sync(SideShow_PacketHeader_t* const PacketHeader); @@ -164,3 +164,4 @@ #endif #endif + diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.c b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.c index 02b681c50..95d3ee1de 100644 --- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.c +++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.c @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -9,13 +9,13 @@ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in + without fee, provided that the above copyright notice appear in all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -35,20 +35,20 @@ uint16_t SideShow_Read_Unicode_String(void* const UnicodeString, { Unicode_String_t* const UnicodeStruct = (Unicode_String_t*)UnicodeString; uint32_t UnicodeCharsToRead; - + Endpoint_Read_Stream_LE(&UnicodeCharsToRead, sizeof(uint32_t)); - + int UnicodeData[UnicodeCharsToRead]; UnicodeStruct->LengthInBytes = (UnicodeCharsToRead << 1); Endpoint_Read_Stream_LE(&UnicodeData, UnicodeStruct->LengthInBytes); - + if (UnicodeStruct->LengthInBytes > MaxBytes) UnicodeStruct->LengthInBytes = MaxBytes; - + memcpy(&UnicodeStruct->UnicodeString, &UnicodeData, UnicodeStruct->LengthInBytes); - + return ((UnicodeCharsToRead << 1) + sizeof(uint32_t)); } @@ -69,3 +69,4 @@ void SideShow_Discard_Byte_Stream(void) Endpoint_Read_Stream_LE(&StreamSize, sizeof(uint32_t)); Endpoint_Discard_Stream(StreamSize); } + diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h index 8a90c50cf..d72464f91 100644 --- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h +++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -9,13 +9,13 @@ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in + without fee, provided that the above copyright notice appear in all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -33,15 +33,15 @@ /* Includes: */ #include <avr/io.h> - #include <string.h> - + #include <string.h> + #include <LUFA/Drivers/USB/USB.h> /* Macros: */ #define GUID_COMPARE(a, b) (memcmp(a, b, sizeof(GUID_t)) == 0) - + #define ARRAY_ELEMENTS(x) (sizeof(x) / sizeof(x[0])) - + #define UNICODE_STRING_t(x) struct \ { \ uint16_t LengthInBytes; \ @@ -67,12 +67,12 @@ { uint32_t Chunks[4]; } GUID_t; - + typedef struct { uint16_t LengthInBytes; int UnicodeString[]; - } Unicode_String_t; + } Unicode_String_t; typedef union { @@ -84,10 +84,10 @@ int ErrorCode : 6; int NAK : 1; - int Response : 1; + int Response : 1; } TypeFields; } SideShowPacketType_t; - + typedef struct { uint32_t Length; @@ -101,4 +101,4 @@ void SideShow_Write_Unicode_String(void* UnicodeString); void SideShow_Discard_Byte_Stream(void); -#endif \ No newline at end of file +#endif diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.c b/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.c index 5bfae1b49..8c627fbe7 100644 --- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.c +++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.c @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -9,13 +9,13 @@ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in + without fee, provided that the above copyright notice appear in all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -36,7 +36,7 @@ bool SideShow_AddSimpleContent(SideShow_PacketHeader_t* const PacketHeader, { uint32_t ContentSize; uint32_t ContentID; - + Endpoint_Read_Stream_LE(&ContentID, sizeof(uint32_t)); PacketHeader->Length -= sizeof(uint32_t); @@ -47,16 +47,16 @@ bool SideShow_AddSimpleContent(SideShow_PacketHeader_t* const PacketHeader, return false; } - + Endpoint_Read_Stream_LE(&ContentSize, sizeof(uint32_t)); Endpoint_Read_Stream_LE(&Application->CurrentContent, sizeof(XML_START_TAG) - 1); - + PacketHeader->Length -= sizeof(uint32_t) + (sizeof(XML_START_TAG) - 1); if (!(memcmp(&Application->CurrentContent, XML_START_TAG, (sizeof(XML_START_TAG) - 1)))) { SideShow_ProcessXMLContent(&Application->CurrentContent, (ContentSize - (sizeof(XML_END_TAG) - 1))); - + Endpoint_Discard_Stream(sizeof(XML_END_TAG) - 1); Application->HaveContent = true; @@ -66,7 +66,7 @@ bool SideShow_AddSimpleContent(SideShow_PacketHeader_t* const PacketHeader, printf(" BINARY"); Endpoint_Discard_Stream(ContentSize); } - + return true; } @@ -76,3 +76,4 @@ static void SideShow_ProcessXMLContent(void* ContentData, printf(" XML"); Endpoint_Discard_Stream(ContentSize); } + diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.h b/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.h index 6e3031c13..20fe5de11 100644 --- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.h +++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.h @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -9,13 +9,13 @@ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in + without fee, provided that the above copyright notice appear in all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -39,7 +39,7 @@ #include "SideshowCommon.h" #include "SideshowApplications.h" - + /* Enums: */ enum SideShow_ContentTypes_t { @@ -50,24 +50,24 @@ Content_Text = 4, Content_EndOfContent = 5 }; - + enum SideShow_ActionTypes_t { TODO }; - + enum SideShow_AlignmentTypes_t { TODO2 }; - + /* Type Defines: */ typedef struct { uint8_t ContentType; - uint8_t ContentSize; + uint8_t ContentSize; } SideShow_Content_Header_t; - + typedef struct { SideShow_Content_Header_t Header; @@ -86,7 +86,7 @@ bool IsSelected; char Text[]; } SideShow_Content_MenuItem_t; - + typedef struct { SideShow_Content_Header_t Header; @@ -94,7 +94,7 @@ uint8_t Key; uint32_t Target; } SideShow_Content_Button_t; - + typedef struct { SideShow_Content_Header_t Header; @@ -108,13 +108,13 @@ { SideShow_Content_Header_t Header; - char Text[]; + char Text[]; } SideShow_Content_Text_t; - + /* Defines: */ #define XML_START_TAG "<body>" #define XML_END_TAG "</body>" - + /* Function Prototypes: */ bool SideShow_AddSimpleContent(SideShow_PacketHeader_t* const PacketHeader, SideShow_Application_t* const Application); @@ -123,5 +123,5 @@ static void SideShow_ProcessXMLContent(void* ContentData, uint32_t ContentSize); #endif - -#endif \ No newline at end of file + +#endif -- cgit v1.2.3