BaseUsbHost example program
Dependencies: BaseUsbHost FATFileSystem mbed mbed-rtos
Diff: example1_LogitechC270.cpp
- Revision:
- 1:80205a2de336
- Parent:
- 0:2a9734a95d55
--- a/example1_LogitechC270.cpp Tue Dec 04 13:39:57 2012 +0000 +++ b/example1_LogitechC270.cpp Wed Dec 05 13:25:18 2012 +0000 @@ -100,8 +100,8 @@ } } term.locate(0, y); - term.printf("Cr:(%d,%d)[width=%d height=%d yblock=%d %u %u]\n", - calc->x_center, calc->y_center, calc->width, calc->height, calc->yblock, calc->EOI_count, t.read_ms()/1000); + term.printf("Cr:(%d,%d)[width=%d height=%d yblock=%d %u]\n", + calc->x_center, calc->y_center, calc->width, calc->height, calc->yblock, calc->EOI_count); term.printf("[CC:"); for(int i = 0; i < 16; i++) { term.printf(" %u", cam->report_cc_count[i]); @@ -131,14 +131,15 @@ UsbHub* hub = new UsbHub(); TEST_ASSERT_TRUE(hub); - for(int i = 0; i < 4; i++) { - if (hub->PortEp[i]) { - if (hub->PortEp[i]->DeviceClass == 0x02) { - ctlEp = hub->PortEp[i]; - break; - } + for(int i = 0; i < MAX_HUB_PORT; i++) { + if (LogitechC270::check(hub->PortEp[i])) { + ctlEp = hub->PortEp[i]; + break; } } + if (ctlEp == NULL) { + error("LogitechC270 not found\n"); + } cam = new LogitechC270(C270_160x120, _15FPS, ctlEp); TEST_ASSERT_TRUE(cam);