aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libmaple/include/libmaple/usb_cdcacm.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/libmaple/include/libmaple/usb_cdcacm.h b/libmaple/include/libmaple/usb_cdcacm.h
index 1c46b56..8b3c1fe 100644
--- a/libmaple/include/libmaple/usb_cdcacm.h
+++ b/libmaple/include/libmaple/usb_cdcacm.h
@@ -36,6 +36,7 @@
#include <libmaple/libmaple_types.h>
#include <libmaple/gpio.h>
+#include <libmaple/usb.h>
#ifdef __cplusplus
extern "C" {
@@ -71,6 +72,26 @@ extern "C" {
#define USB_INTERFACE_SUBCLASS_CDC_ACM 0x02
#define USB_INTERFACE_CLASS_DIC 0x0A
+#ifndef __cplusplus
+#define USB_CDCACM_DECLARE_DEV_DESC(vid, pid) \
+ { \
+ .bLength = sizeof(usb_descriptor_device), \
+ .bDescriptorType = USB_DESCRIPTOR_TYPE_DEVICE, \
+ .bcdUSB = 0x0200, \
+ .bDeviceClass = USB_DEVICE_CLASS_CDC, \
+ .bDeviceSubClass = USB_DEVICE_SUBCLASS_CDC, \
+ .bDeviceProtocol = 0x00, \
+ .bMaxPacketSize0 = 0x40, \
+ .idVendor = vid, \
+ .idProduct = pid, \
+ .bcdDevice = 0x0200, \
+ .iManufacturer = 0x01, \
+ .iProduct = 0x02, \
+ .iSerialNumber = 0x00, \
+ .bNumConfigurations = 0x01, \
+ }
+#endif
+
/*
* CDC ACM interface
*/