Samuel Mokrani
/
USBHID_HelloWorld
USBHID Hello World
main.cpp@3:8f52e961548d, 2011-11-11 (annotated)
- Committer:
- samux
- Date:
- Fri Nov 11 12:15:20 2011 +0000
- Revision:
- 3:8f52e961548d
- Parent:
- 2:d07a799c6926
- Child:
- 5:b1d34990a376
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
samux | 3:8f52e961548d | 1 | #include "mbed.h" |
samux | 3:8f52e961548d | 2 | #include "USBHID.h" |
samux | 3:8f52e961548d | 3 | |
samux | 3:8f52e961548d | 4 | //We declare a USBHID device |
samux | 3:8f52e961548d | 5 | USBHID hid; |
samux | 3:8f52e961548d | 6 | |
samux | 3:8f52e961548d | 7 | //This report will contain data to be sent |
samux | 3:8f52e961548d | 8 | HID_REPORT send_report; |
samux | 3:8f52e961548d | 9 | |
samux | 3:8f52e961548d | 10 | int main(void) { |
samux | 3:8f52e961548d | 11 | //Fill the report |
samux | 3:8f52e961548d | 12 | for(int i = 0; i < 64; i++) |
samux | 3:8f52e961548d | 13 | send_report.data[i] = i; |
samux | 3:8f52e961548d | 14 | send_report.length = 64; |
samux | 3:8f52e961548d | 15 | |
samux | 3:8f52e961548d | 16 | while (1) { |
samux | 3:8f52e961548d | 17 | //Send the report |
samux | 3:8f52e961548d | 18 | hid.send(&send_report); |
samux | 3:8f52e961548d | 19 | wait(0.1); |
samux | 3:8f52e961548d | 20 | } |
samux | 3:8f52e961548d | 21 | } |