diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2013-03-06 16:58:23 +0100 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2013-03-06 16:58:23 +0100 |
commit | b5a524e5749e48c15f02d1f608a4b8102d90032c (patch) | |
tree | 700531e2853e3f7990e28a344e37145a3c10b11d | |
parent | d61154c544a697d98e4b7719f798b0cd8ff8381a (diff) |
Use an isochronous pipe for streaming sensor data.
-rw-r--r-- | main.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -40,9 +40,10 @@ static Pin pwm_outputs[] = {PC6, PC7, PC8, PC9}; auto dev_desc = device_desc(0x200, 0, 0, 0, 64, 0x1234, 0x5678, 0, 0, 0, 0, 1); auto conf_desc = configuration_desc(3, 1, 0, 0xc0, 0, - interface_desc(0, 0, 2, 0xff, 0x00, 0x00, 0, + interface_desc(0, 0, 3, 0xff, 0x00, 0x00, 0, endpoint_desc(0x01, 0x02, 64, 0), // OUT - endpoint_desc(0x81, 0x02, 64, 0) // IN + endpoint_desc(0x81, 0x02, 64, 0), // IN + endpoint_desc(0x82, 0x01, 64, 1) // IN ISO ) ); @@ -148,8 +149,9 @@ class USB_TM : public USB_class_driver { protected: virtual void handle_set_configuration(uint8_t configuration) { if(configuration) { - usb.hw_conf_ep(0x81, EPType::Bulk, 64); usb.hw_conf_ep(0x01, EPType::Bulk, 64); + usb.hw_conf_ep(0x81, EPType::Bulk, 64); + usb.hw_conf_ep(0x82, EPType::Isochronous, 64); usb.register_out_handler(this, 1); } } @@ -297,8 +299,10 @@ int main() { magn.z, }; - if(usb.ep_ready(1)) { - usb.write(1, (uint32_t*)buf, sizeof(buf)); + if(usb.ep_ready(2)) { + usb.write(2, (uint32_t*)buf, sizeof(buf)); + } else { + usb_rblog.log("Busy."); } } } |