Samuel Mokrani
/
USBMSD_SD_HID_HelloWorld
USB MSD HID composite device hello world
main.cpp
- Committer:
- samux
- Date:
- 2013-01-21
- Revision:
- 0:61e5ecd27a36
File content as of revision 0:61e5ecd27a36:
#include "mbed.h" #include "USBMSD_SD.h" USBMSD_SD hid_sd(p5, p6, p7, p8, 8, 8); DigitalOut l1(LED1); //This report will contain data to be sent HID_REPORT send_report; HID_REPORT recv_report; int main() { 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_sd.send(&send_report); //try to read a msg if(hid_sd.readNB(&recv_report)) { l1 = !l1; for(int i = 1; i < recv_report.length; i++) { printf("%d ", recv_report.data[i]); } printf("\r\n"); } } }