projects
/
pub
/
USBasp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
86819ba
)
Simplify SideShow GUID compares via a macro.
author
Dean Camera
<dean@fourwalledcubicle.com>
Mon, 20 Jul 2009 14:51:19 +0000
(14:51 +0000)
committer
Dean Camera
<dean@fourwalledcubicle.com>
Mon, 20 Jul 2009 14:51:19 +0000
(14:51 +0000)
Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c
patch
|
blob
|
blame
|
history
Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c
patch
|
blob
|
blame
|
history
Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h
patch
|
blob
|
blame
|
history
diff --git
a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c
b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c
index
f2789c4
..
ad26d77
100644
(file)
--- a/
Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c
+++ b/
Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c
@@
-63,7
+63,7
@@
SideShow_Application_t* SideShow_GetApplicationFromGUID(GUID_t* GUID)
{
\r
if (InstalledApplications[App].InUse)
\r
{
\r
{
\r
if (InstalledApplications[App].InUse)
\r
{
\r
- if (
memcmp(&InstalledApplications[App].ApplicationID, GUID, sizeof(GUID_t)) == 0
)
\r
+ if (
GUID_COMPARE(&InstalledApplications[App].ApplicationID, GUID)
)
\r
return &InstalledApplications[App];
\r
}
\r
}
\r
return &InstalledApplications[App];
\r
}
\r
}
\r
diff --git
a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c
b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c
index
2726d50
..
8dc0b62
100644
(file)
--- a/
Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c
+++ b/
Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c
@@
-134,9
+134,9
@@
static void SideShow_Sync(SideShow_PacketHeader_t* PacketHeader)
Endpoint_Read_Stream_LE(&ProtocolGUID, sizeof(GUID_t));
\r
Endpoint_ClearOUT();
\r
\r
Endpoint_Read_Stream_LE(&ProtocolGUID, sizeof(GUID_t));
\r
Endpoint_ClearOUT();
\r
\r
- if (
memcmp(&ProtocolGUID, (uint32_t[])STANDARD_PROTOCOL_GUID, sizeof(GUID_t)) != 0
)
\r
+ if (
!(GUID_COMPARE(&ProtocolGUID, (uint32_t[])STANDARD_PROTOCOL_GUID))
)
\r
PacketHeader->Type.NAK = true;
\r
PacketHeader->Type.NAK = true;
\r
-
\r
+
\r
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
\r
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
\r
Endpoint_Write_Stream_LE(&ProtocolGUID, sizeof(GUID_t));
\r
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
\r
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
\r
Endpoint_Write_Stream_LE(&ProtocolGUID, sizeof(GUID_t));
\r
@@
-179,7
+179,7
@@
static void SideShow_GetCapabilities(SideShow_PacketHeader_t* PacketHeader)
\r
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
\r
\r
\r
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
\r
\r
- if (
memcmp(&Property.PropertyGUID, (uint32_t[])SIDESHOW_PROPERTY_GUID, sizeof(GUID_t)) == 0
)
\r
+ if (
GUID_COMPARE(&Property.PropertyGUID, (uint32_t[])SIDESHOW_PROPERTY_GUID)
)
\r
{
\r
switch (Property.PropertyID)
\r
{
\r
{
\r
switch (Property.PropertyID)
\r
{
\r
@@
-233,7
+233,7
@@
static void SideShow_GetCapabilities(SideShow_PacketHeader_t* PacketHeader)
break;
\r
}
\r
}
\r
break;
\r
}
\r
}
\r
- else if (
memcmp(&Property.PropertyGUID, (uint32_t[])DEVICE_PROPERTY_GUID, sizeof(GUID_t)) == 0
)
\r
+ else if (
GUID_COMPARE(&Property.PropertyGUID, (uint32_t[])DEVICE_PROPERTY_GUID)
)
\r
{
\r
switch (Property.PropertyID)
\r
{
\r
{
\r
switch (Property.PropertyID)
\r
{
\r
diff --git
a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h
b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h
index
cea81ce
..
eb76d7c
100644
(file)
--- a/
Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h
+++ b/
Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h
@@
-38,6
+38,8
@@
#include <LUFA/Drivers/USB/USB.h>
\r
\r
/* Macros: */
\r
#include <LUFA/Drivers/USB/USB.h>
\r
\r
/* Macros: */
\r
+ #define GUID_COMPARE(a, b) (memcmp(a, b, sizeof(GUID_t)) == 0)
\r
+
\r
#define ARRAY_ELEMENTS(x) (sizeof(x) / sizeof(x[0]))
\r
\r
#define UNICODE_STRING_t(x) struct \
\r
#define ARRAY_ELEMENTS(x) (sizeof(x) / sizeof(x[0]))
\r
\r
#define UNICODE_STRING_t(x) struct \
\r