Skip to content

Commit

Permalink
foo
Browse files Browse the repository at this point in the history
  • Loading branch information
arpruss committed Dec 18, 2017
1 parent 72a0ca3 commit 643f38c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion examples/misc/usbdescribe.cpp
Expand Up @@ -18,7 +18,15 @@ template<unsigned interfaces, unsigned endpoints, uint8 interfaceStart, uint8 en
constexpr static unsigned numInterfaces = interfaces;
constexpr static unsigned numEndpoints = endpoints;
constexpr static unsigned descriptor_config_size = (unsigned int)sizeof...(args);
constexpr static uint8 descriptor_config[] = { convertByte(args, interfaceStart, endpointStart)... };
constexpr uint8 convertByte(unsigned x) {
if (x&ENDPOINT_MASK)
return (x&0xFF)+endpointStart;
else if (x&INTERFACE_MASK)
return (x&0xFF)+interfaceStart;
else
return x;
}
constexpr static uint8 descriptor_config[] = { convertByte(args)... };
};

constexpr USBCompositeComponent<1,2, 10,20, 1,2|ENDPOINT_MASK,3|INTERFACE_MASK> alpha;
Expand Down

0 comments on commit 643f38c

Please sign in to comment.