summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2012-08-22 20:18:47 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2012-08-22 20:18:47 +0200
commit9c7b169d56cec94b6578cd85500cd9078542ba49 (patch)
tree214bab8b1486cb92506ba92fc953a9be2f508c5e
parent7a05744b2b1eb364a11e03499670569e40dd3eef (diff)
Define USB descriptors.
m---------laks0
-rw-r--r--main.cpp14
2 files changed, 13 insertions, 1 deletions
diff --git a/laks b/laks
-Subproject c09be56d30e5a99ab0451a53d0fc0df0aa0dee8
+Subproject f1713a25598e82e9d00a8e4c40044f590cc2c95
diff --git a/main.cpp b/main.cpp
index b0db636..b57662b 100644
--- a/main.cpp
+++ b/main.cpp
@@ -6,6 +6,8 @@
#include <gpio/pin.h>
#include <usb/usb.h>
+#include <usb/descriptor.h>
+
#include <i2c/i2c.h>
#include "lsm303dlm.h"
@@ -31,7 +33,17 @@ static Pin& i2c_sda = PB11;
static Pin& cs_pressure = PB4;
static Pin& cs_gyro = PB5;
-USB_otg usb(OTG_HS);
+auto dev_desc = Device_desc {18, 1, 0x200, 0, 0, 0, 64, 0x1234, 0x5678, 0, 0, 0, 0, 1};
+auto conf_desc = pack(
+ Configuration_desc {9, 2, 25, 1, 1, 0, 0xc0, 0},
+ Interface_desc {9, 4, 0, 0, 1, 0xff, 0x00, 0x00, 0},
+ Endpoint_desc {7, 5, 0x81, 0x02, 64, 0}
+);
+
+desc_t dev_desc_p = {sizeof(dev_desc), (void*)&dev_desc};
+desc_t conf_desc_p = {sizeof(conf_desc), (void*)&conf_desc};
+
+USB_otg usb(OTG_HS, dev_desc_p, conf_desc_p);
bool i2c_read(uint16_t wValue, uint16_t wIndex, uint16_t wLength) {
uint8_t buf[wLength];