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.
Revision 0:90e9a34552d3, committed 2010-02-20
- Comitter:
- mbed714
- Date:
- Sat Feb 20 11:26:16 2010 +0000
- Commit message:
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Feb 20 11:26:16 2010 +0000
@@ -0,0 +1,50 @@
+#include "mbed.h"
+
+// Test app to cause program to suddently terminate when using serial interrupt...
+// Line 24 seems to be the important bit, but I don't really understand why?
+// Is it perhaps the putc is peroperly clearing the interrupt flag instead of the getc?
+
+
+// usb serial device defaults to 9600 baud, 8N1 on /dev/ttyACM0 (in Linux!)
+Serial pc(USBTX, USBRX); // tx, rx
+
+// debugging LEDs
+DigitalOut interrupt(LED1);
+DigitalOut tx(LED4);
+
+// one byte receive buffer
+char rx_byte;
+
+void handle()
+{
+ interrupt = 1;
+ //if(pc.readable()) // <--- this line doesn't matter either way...
+ {
+ rx_byte = pc.getc();
+ //pc.putc(rx_byte); // <--- WITHOUT THIS LINE, THE APPLICATION WILL HANG IF IT RECEIVES WHILE SENDING!
+ }
+ interrupt = 0;
+ return;
+}
+
+int main()
+{
+ interrupt = 0;
+ tx = 0;
+ pc.attach(handle);
+
+ while(1)
+ {
+ // send a long string of bytes
+ tx = 1;
+ for(int i=0;i<20;i++)
+ {
+ NVIC_DisableIRQ(UART0_IRQn);
+ pc.printf("If I receive while transmitting this I *won't* crash...\r\n");
+ NVIC_EnableIRQ(UART0_IRQn);
+ }
+ tx = 0;
+
+ wait(1.0);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Feb 20 11:26:16 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/49a220cc26e0