The front end of a simple logic analyzer, which will capture a set of input values and send them over the USB HID interface to a PC for analysis and display.
main.cpp
00001 #include "mbed.h" 00002 #include "USBHID.h" 00003 // Work in progress! Needs the beta version 00004 00005 //We declare a USBHID device 00006 USBHID hid; 00007 00008 //This report will contain data to be sent 00009 HID_REPORT send_report; 00010 00011 // define port 00012 BusIn port(p30, p29, p8, p7, p6, p5, p28, p27); // should be easy to convert to PortIn when available 00013 DigitalOut led1(LED1); 00014 DigitalOut led2(LED2); 00015 DigitalOut led3(LED3); 00016 DigitalOut led4(LED4); 00017 00018 int main(void) { 00019 //Fill the report 00020 send_report.length = 64; 00021 00022 while (1) { 00023 //Send the report 00024 send_report.data[0] = port; 00025 hid.send(&send_report); 00026 led1 = 0; 00027 led2 = 0; 00028 led3 = 0; 00029 led4 = 0; 00030 wait(0.1); 00031 led1 = 1; 00032 wait(0.1); 00033 led2 = 1; 00034 wait(0.1); 00035 led3 = 1; 00036 wait(0.1); 00037 led4 = 1; 00038 wait(0.1); 00039 wait(1); 00040 } 00041 }
Generated on Wed Jul 13 2022 01:14:01 by
1.7.2