Rtos API example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "USBHID.h"
00003 
00004 //We declare a USBHID device
00005 USBHID hid;
00006 
00007 //This report will contain data to be sent
00008 HID_REPORT send_report;
00009 
00010 Ticker tic;
00011 
00012 void tic_handler();
00013 void tic_handler() {
00014     hid.send(&send_report);
00015 }
00016 
00017 int main(void) {
00018     //Fill the report
00019     for(int i = 0; i < 64; i++)
00020         send_report.data[i] = i;
00021     send_report.length = 64;
00022 
00023     tic.attach(tic_handler, 1);
00024 
00025     while (1);
00026 }