Oscar de Jesus Vasquez
/
USBHID_TestCase_LV
-----
Fork of USBHID_TestCase by
Diff: main.cpp
- Revision:
- 4:a5fa0d7873b4
- Parent:
- 2:1db77338562f
- Child:
- 5:c18b39f0db84
--- a/main.cpp Fri Mar 01 13:23:28 2013 +0000 +++ b/main.cpp Thu Sep 11 18:42:31 2014 +0000 @@ -2,35 +2,33 @@ #include "USBHID.h" //We declare a USBHID device. Input out output reports have a length of 8 bytes -USBHID hid(8, 8); +USBHID hid(1, 1); +BusOut a(p13,p14,p15,p16,p17,p18,p19,p20); //This report will contain data to be sent HID_REPORT send_report; HID_REPORT recv_report; - -Serial pc(USBTX, USBRX); - -int main(void) { - send_report.length = 8; - - while (1) { - //Fill the report - for (int i = 0; i < send_report.length; i++) { - send_report.data[i] = rand() & 0xff; - } +uint8_t n; +int main(void) +{ + + + +send_report.length = 1; + + while (1) + { + + if(hid.readNB(&recv_report)) + { + for(int i = 0; i < recv_report.length; i++) + { + hid.send(&recv_report); + a=recv_report.data[0]; - //Send the report - hid.send(&send_report); - - //try to read a msg - if(hid.readNB(&recv_report)) { - pc.printf("recv: "); - for(int i = 0; i < recv_report.length; i++) { - pc.printf("%d ", recv_report.data[i]); + } - pc.printf("\r\n"); - } - - wait(0.1); + } } + } \ No newline at end of file