Commit 98947e37 authored by Dean Camera's avatar Dean Camera
Browse files

Ensure all demos now compile in C99 standards mode, and not GNU99 (C99 + GNU extensions).

parent 48c5cdce
...@@ -50,7 +50,7 @@ void Sideshow_ProcessCommandPacket(void) ...@@ -50,7 +50,7 @@ void Sideshow_ProcessCommandPacket(void)
Endpoint_SelectEndpoint(SIDESHOW_OUT_EPNUM); Endpoint_SelectEndpoint(SIDESHOW_OUT_EPNUM);
Endpoint_Read_Stream_LE(&PacketHeader, sizeof(SideShow_PacketHeader_t)); Endpoint_Read_Stream_LE(&PacketHeader, sizeof(SideShow_PacketHeader_t));
PacketHeader.Type.Response = true; PacketHeader.Type.TypeFields.Response = true;
printf("\r\nCmd: %lX", (PacketHeader.Type.TypeLong & 0x00FFFFFF)); printf("\r\nCmd: %lX", (PacketHeader.Type.TypeLong & 0x00FFFFFF));
...@@ -108,7 +108,7 @@ void Sideshow_ProcessCommandPacket(void) ...@@ -108,7 +108,7 @@ void Sideshow_ProcessCommandPacket(void)
Endpoint_ClearOUT(); Endpoint_ClearOUT();
PacketHeader.Length = sizeof(SideShow_PacketHeader_t); PacketHeader.Length = sizeof(SideShow_PacketHeader_t);
PacketHeader.Type.NAK = true; PacketHeader.Type.TypeFields.NAK = true;
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM); Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(&PacketHeader, sizeof(SideShow_PacketHeader_t)); Endpoint_Write_Stream_LE(&PacketHeader, sizeof(SideShow_PacketHeader_t));
...@@ -135,7 +135,7 @@ static void SideShow_Sync(SideShow_PacketHeader_t* const PacketHeader) ...@@ -135,7 +135,7 @@ static void SideShow_Sync(SideShow_PacketHeader_t* const PacketHeader)
Endpoint_ClearOUT(); Endpoint_ClearOUT();
if (!(GUID_COMPARE(&ProtocolGUID, (uint32_t[])STANDARD_PROTOCOL_GUID))) if (!(GUID_COMPARE(&ProtocolGUID, (uint32_t[])STANDARD_PROTOCOL_GUID)))
PacketHeader->Type.NAK = true; PacketHeader->Type.TypeFields.NAK = true;
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM); Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t)); Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
...@@ -247,7 +247,7 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader ...@@ -247,7 +247,7 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader
} }
else else
{ {
PacketHeader->Type.NAK = true; PacketHeader->Type.TypeFields.NAK = true;
printf(" WRONG GUID"); printf(" WRONG GUID");
printf(" %lX %lX %lX %lX", Property.PropertyGUID.Chunks[0], Property.PropertyGUID.Chunks[1], printf(" %lX %lX %lX %lX", Property.PropertyGUID.Chunks[0], Property.PropertyGUID.Chunks[1],
...@@ -257,7 +257,7 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader ...@@ -257,7 +257,7 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM); Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t)); Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
if (!(PacketHeader->Type.NAK)) if (!(PacketHeader->Type.TypeFields.NAK))
{ {
switch (PropertyData.DataType) switch (PropertyData.DataType)
{ {
...@@ -356,7 +356,7 @@ static void SideShow_AddApplication(SideShow_PacketHeader_t* const PacketHeader) ...@@ -356,7 +356,7 @@ static void SideShow_AddApplication(SideShow_PacketHeader_t* const PacketHeader)
Endpoint_Discard_Stream(PacketHeader->Length); Endpoint_Discard_Stream(PacketHeader->Length);
Endpoint_ClearOUT(); Endpoint_ClearOUT();
PacketHeader->Type.NAK = true; PacketHeader->Type.TypeFields.NAK = true;
} }
else else
{ {
...@@ -394,7 +394,7 @@ static void SideShow_DeleteApplication(SideShow_PacketHeader_t* const PacketHead ...@@ -394,7 +394,7 @@ static void SideShow_DeleteApplication(SideShow_PacketHeader_t* const PacketHead
if (AppToDelete != NULL) if (AppToDelete != NULL)
AppToDelete->InUse = false; AppToDelete->InUse = false;
else else
PacketHeader->Type.NAK = true; PacketHeader->Type.TypeFields.NAK = true;
PacketHeader->Length = sizeof(SideShow_PacketHeader_t); PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
...@@ -429,11 +429,11 @@ static void SideShow_AddContent(SideShow_PacketHeader_t* const PacketHeader) ...@@ -429,11 +429,11 @@ static void SideShow_AddContent(SideShow_PacketHeader_t* const PacketHeader)
if (Application == NULL) if (Application == NULL)
{ {
SideShow_Discard_Byte_Stream(); SideShow_Discard_Byte_Stream();
PacketHeader->Type.NAK = true; PacketHeader->Type.TypeFields.NAK = true;
} }
else if (!(SideShow_AddSimpleContent(PacketHeader, Application))) else if (!(SideShow_AddSimpleContent(PacketHeader, Application)))
{ {
PacketHeader->Type.NAK = true; PacketHeader->Type.TypeFields.NAK = true;
} }
Endpoint_ClearOUT(); Endpoint_ClearOUT();
...@@ -461,7 +461,7 @@ static void SideShow_DeleteContent(SideShow_PacketHeader_t* const PacketHeader) ...@@ -461,7 +461,7 @@ static void SideShow_DeleteContent(SideShow_PacketHeader_t* const PacketHeader)
if ((Application != NULL) && (Application->CurrentContentID == ContentID)) if ((Application != NULL) && (Application->CurrentContentID == ContentID))
Application->HaveContent = false; Application->HaveContent = false;
else else
PacketHeader->Type.NAK = true; PacketHeader->Type.TypeFields.NAK = true;
PacketHeader->Length = sizeof(SideShow_PacketHeader_t); PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
...@@ -484,7 +484,7 @@ static void SideShow_DeleteAllContent(SideShow_PacketHeader_t* const PacketHeade ...@@ -484,7 +484,7 @@ static void SideShow_DeleteAllContent(SideShow_PacketHeader_t* const PacketHeade
if (Application != NULL) if (Application != NULL)
Application->HaveContent = false; Application->HaveContent = false;
else else
PacketHeader->Type.NAK = true; PacketHeader->Type.TypeFields.NAK = true;
PacketHeader->Length = sizeof(SideShow_PacketHeader_t); PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
......
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
int ErrorCode : 6; int ErrorCode : 6;
int NAK : 1; int NAK : 1;
int Response : 1; int Response : 1;
}; } TypeFields;
} SideShowPacketType_t; } SideShowPacketType_t;
typedef struct typedef struct
......
...@@ -122,7 +122,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void) ...@@ -122,7 +122,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
{ {
void* DescriptorPointer; void* DescriptorPointer;
uint16_t DescriptorSize = USB_GetOSFeatureDescriptor(USB_ControlRequest.wValue, USB_ControlRequest.wIndex, uint16_t DescriptorSize = USB_GetOSFeatureDescriptor(USB_ControlRequest.wValue, USB_ControlRequest.wIndex,
&DescriptorPointer, &DescriptorSize); &DescriptorPointer);
if (DescriptorSize == NO_DESCRIPTOR) if (DescriptorSize == NO_DESCRIPTOR)
return; return;
......
...@@ -179,7 +179,7 @@ EXTRAINCDIRS = $(LUFA_PATH)/ ...@@ -179,7 +179,7 @@ EXTRAINCDIRS = $(LUFA_PATH)/
# gnu89 = c89 plus GCC extensions # gnu89 = c89 plus GCC extensions
# c99 = ISO C99 standard (not yet fully implemented) # c99 = ISO C99 standard (not yet fully implemented)
# gnu99 = c99 plus GCC extensions # gnu99 = c99 plus GCC extensions
CSTANDARD = -std=gnu99 CSTANDARD = -std=c99
# Place -D or -U options here for C sources # Place -D or -U options here for C sources
......
...@@ -173,7 +173,7 @@ EXTRAINCDIRS = $(LUFA_PATH)/ ...@@ -173,7 +173,7 @@ EXTRAINCDIRS = $(LUFA_PATH)/
# gnu89 = c89 plus GCC extensions # gnu89 = c89 plus GCC extensions
# c99 = ISO C99 standard (not yet fully implemented) # c99 = ISO C99 standard (not yet fully implemented)
# gnu99 = c99 plus GCC extensions # gnu99 = c99 plus GCC extensions
CSTANDARD = -std=gnu99 CSTANDARD = -std=c99
# Place -D or -U options here for C sources # Place -D or -U options here for C sources
......
...@@ -434,6 +434,7 @@ ...@@ -434,6 +434,7 @@
* of device configurations can be defined statically * of device configurations can be defined statically
* - Removed VBUS events, as they are already exposed to the user application via the regular device connection and disconnection events * - Removed VBUS events, as they are already exposed to the user application via the regular device connection and disconnection events
* - Renamed and altered existing events to properly separate out Host and Device mode events * - Renamed and altered existing events to properly separate out Host and Device mode events
* - All demos switched over from GNU99 standards mode to C99 standards mode, to reduce the dependancies on GCC-only language extensions
* *
* <b>Fixed:</b> * <b>Fixed:</b>
* - Changed bootloaders to use FLASHEND rather than the existence of RAMPZ to determine if far FLASH pointers are needed to fix * - Changed bootloaders to use FLASHEND rather than the existence of RAMPZ to determine if far FLASH pointers are needed to fix
......
...@@ -113,11 +113,11 @@ int main(void) ...@@ -113,11 +113,11 @@ int main(void)
for (;;) for (;;)
{ {
/* Read in next LED colour command from the host */ /* Read in next LED colour command from the host */
uint8_t ColorUpdate = fgetc(&USBSerialStream); uint8_t ColourUpdate = fgetc(&USBSerialStream);
/* Top 3 bits select the LED, bottom 5 control the brightness */ /* Top 3 bits select the LED, bottom 5 control the brightness */
uint8_t Channel = (ColorUpdate & 0b11100000); uint8_t Channel = (ColourUpdate & 0b11100000);
uint8_t Duty = (ColorUpdate & 0b00011111); uint8_t Duty = (ColourUpdate & 0b00011111);
if (Channel & (1 << 5)) if (Channel & (1 << 5))
SoftPWM_Channel1_Duty = Duty; SoftPWM_Channel1_Duty = Duty;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment