Samuel Mokrani
/
USBHID_TestCase
USBHID test case
Revision 2:1db77338562f, committed 2012-12-09
- Comitter:
- samux
- Date:
- Sun Dec 09 18:59:08 2012 +0000
- Parent:
- 1:07d521565fd7
- Child:
- 3:19e7fc58da6b
- Commit message:
- use mbed official usb device stack
Changed in this revision
--- a/USBDevice.lib Fri Nov 18 09:34:41 2011 +0000 +++ b/USBDevice.lib Sun Dec 09 18:59:08 2012 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/samux/code/USBDevice/#ef8c6751b185 +http://mbed.org/users/mbed_official/code/USBDevice/#d27e4c226965
--- a/main.cpp Fri Nov 18 09:34:41 2011 +0000 +++ b/main.cpp Sun Dec 09 18:59:08 2012 +0000 @@ -1,36 +1,36 @@ -#include "mbed.h" -#include "USBHID.h" - -//We declare a USBHID device. Input out output reports have a length of 8 bytes -USBHID hid(8, 8); - -//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; - } - - //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); - } +#include "mbed.h" +#include "USBHID.h" + +//We declare a USBHID device. Input out output reports have a length of 8 bytes +USBHID hid(8, 8); + +//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; + } + + //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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Dec 09 18:59:08 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7110ebee3484 \ No newline at end of file