Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 0:76154cf1151b
diff -r 000000000000 -r 76154cf1151b main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Nov 20 00:12:58 2015 +0000
@@ -0,0 +1,36 @@
+#include "mbed.h"
+
+//------------------------------------
+// Hyperterminal configuration
+// 9600 bauds, 8-bit data, no parity
+// UART RX overrun: Type in characters quickly to see if program freezes
+//------------------------------------
+
+Serial pc(USBTX, USBRX);
+
+DigitalOut myled(LED1);
+
+void rx_cb()
+{
+ int i;
+
+ pc.putc(pc.getc()); // echo
+ myled = 1;
+
+ /* delay is very bad action here,
+ * but purpose is to create a UART RX overrun */
+ for (i = 0; i < 0x20000; i++)
+ __nop();
+
+ myled = 0;
+}
+
+int main()
+{
+ pc.printf("\r\nstart\r\n");
+ pc.attach(&rx_cb);
+
+ while(1) {
+ __nop();
+ }
+}