Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Erik Strand
lufa
Commits
bf50959b
Commit
bf50959b
authored
Jul 20, 2009
by
Dean Camera
Browse files
Simplify SideShow GUID compares via a macro.
parent
86819ba9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c
View file @
bf50959b
...
...
@@ -63,7 +63,7 @@ SideShow_Application_t* SideShow_GetApplicationFromGUID(GUID_t* GUID)
{
if
(
InstalledApplications
[
App
].
InUse
)
{
if
(
memcmp
(
&
InstalledApplications
[
App
].
ApplicationID
,
GUID
,
sizeof
(
GUID_t
))
==
0
)
if
(
GUID_COMPARE
(
&
InstalledApplications
[
App
].
ApplicationID
,
GUID
)
)
return
&
InstalledApplications
[
App
];
}
}
...
...
Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c
View file @
bf50959b
...
...
@@ -134,9 +134,9 @@ static void SideShow_Sync(SideShow_PacketHeader_t* PacketHeader)
Endpoint_Read_Stream_LE
(
&
ProtocolGUID
,
sizeof
(
GUID_t
));
Endpoint_ClearOUT
();
if
(
memcmp
(
&
ProtocolGUID
,
(
uint32_t
[])
STANDARD_PROTOCOL_GUID
,
sizeof
(
GUID_t
))
!=
0
)
if
(
!
(
GUID_COMPARE
(
&
ProtocolGUID
,
(
uint32_t
[])
STANDARD_PROTOCOL_GUID
))
)
PacketHeader
->
Type
.
NAK
=
true
;
Endpoint_SelectEndpoint
(
SIDESHOW_IN_EPNUM
);
Endpoint_Write_Stream_LE
(
PacketHeader
,
sizeof
(
SideShow_PacketHeader_t
));
Endpoint_Write_Stream_LE
(
&
ProtocolGUID
,
sizeof
(
GUID_t
));
...
...
@@ -179,7 +179,7 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* PacketHeader)
PacketHeader
->
Length
=
sizeof
(
SideShow_PacketHeader_t
);
if
(
memcmp
(
&
Property
.
PropertyGUID
,
(
uint32_t
[])
SIDESHOW_PROPERTY_GUID
,
sizeof
(
GUID_t
))
==
0
)
if
(
GUID_COMPARE
(
&
Property
.
PropertyGUID
,
(
uint32_t
[])
SIDESHOW_PROPERTY_GUID
)
)
{
switch
(
Property
.
PropertyID
)
{
...
...
@@ -233,7 +233,7 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* PacketHeader)
break
;
}
}
else
if
(
memcmp
(
&
Property
.
PropertyGUID
,
(
uint32_t
[])
DEVICE_PROPERTY_GUID
,
sizeof
(
GUID_t
))
==
0
)
else
if
(
GUID_COMPARE
(
&
Property
.
PropertyGUID
,
(
uint32_t
[])
DEVICE_PROPERTY_GUID
)
)
{
switch
(
Property
.
PropertyID
)
{
...
...
Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h
View file @
bf50959b
...
...
@@ -38,6 +38,8 @@
#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 \
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment