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.
Revision 0:3a7bf7f211f6, committed 2011-11-25
- Comitter:
- romilly
- Date:
- Fri Nov 25 16:25:53 2011 +0000
- Commit message:
- First very basic version of the logic analyser; the flashing LEDs are to reassure me that the program in running. They will go soon!
Changed in this revision
| USBDevice.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBDevice.lib Fri Nov 25 16:25:53 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/samux/code/USBDevice/#11f5de8448a8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Nov 25 16:25:53 2011 +0000
@@ -0,0 +1,41 @@
+#include "mbed.h"
+#include "USBHID.h"
+// Work in progress! Needs the beta version
+
+//We declare a USBHID device
+USBHID hid;
+
+//This report will contain data to be sent
+HID_REPORT send_report;
+
+// define port
+BusIn port(p30, p29, p8, p7, p6, p5, p28, p27); // should be easy to convert to PortIn when available
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+
+int main(void) {
+ //Fill the report
+ send_report.length = 64;
+
+ while (1) {
+ //Send the report
+ send_report.data[0] = port;
+ hid.send(&send_report);
+ led1 = 0;
+ led2 = 0;
+ led3 = 0;
+ led4 = 0;
+ wait(0.1);
+ led1 = 1;
+ wait(0.1);
+ led2 = 1;
+ wait(0.1);
+ led3 = 1;
+ wait(0.1);
+ led4 = 1;
+ wait(0.1);
+ wait(1);
+ }
+}
\ No newline at end of file