summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build_rules4
-rw-r--r--usb/descriptor.h34
2 files changed, 36 insertions, 2 deletions
diff --git a/build_rules b/build_rules
index 095c8fe..dfabcae 100644
--- a/build_rules
+++ b/build_rules
@@ -109,7 +109,7 @@ def select_stm32(env, variant):
}[flash]
else:
- print 'Unknown stm32 family: %s' % family
+ print('Unknown stm32 family: %s' % family)
Exit(1)
def SelectMCU(env, mcu, variant_dir = None):
@@ -119,7 +119,7 @@ def SelectMCU(env, mcu, variant_dir = None):
select_stm32(env, mcu)
else:
- print 'Unknown MCU: %s' % mcu
+ print('Unknown MCU: %s' % mcu)
Exit(1)
SConscript(main_sconscript, variant_dir = variant_dir, exports = 'env')
diff --git a/usb/descriptor.h b/usb/descriptor.h
index a45b04d..a2dde3a 100644
--- a/usb/descriptor.h
+++ b/usb/descriptor.h
@@ -171,6 +171,40 @@ constexpr Endpoint_desc endpoint_desc(
};
}
+struct IAD_desc {
+ uint8_t bLength;
+ uint8_t bDescriptorType;
+ uint8_t bFirstInterface;
+ uint8_t bInterfaceCount;
+ uint8_t bFunctionClass;
+ uint8_t bFunctionSubClass;
+ uint8_t bFunctionProtocol;
+ uint8_t iFunction;
+} __attribute__((packed));
+
+template <typename... R>
+constexpr auto iad_desc(
+ uint8_t bFirstInterface,
+ uint8_t bInterfaceCount,
+ uint8_t bFunctionClass,
+ uint8_t bFunctionSubClass,
+ uint8_t bFunctionProtocol,
+ uint8_t iFunction,
+ R... r
+ ) -> decltype(pack(IAD_desc(), r...)) {
+
+ return pack(IAD_desc {
+ sizeof(IAD_desc),
+ 0x0b,
+ bFirstInterface,
+ bInterfaceCount,
+ bFunctionClass,
+ bFunctionSubClass,
+ bFunctionProtocol,
+ iFunction
+ }, r...);
+}
+
struct CDC_Header_desc {
uint8_t bLength;
uint8_t bDescriptorType;