RTOS support

Dependencies:   RingBuffer_RTOS mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
ykuroda
Date:
Thu Sep 27 14:50:02 2012 +0000
Commit message:
RTOS support

Changed in this revision

RingBuffer.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
mbed-rtos.lib 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
diff -r 000000000000 -r a8d5ff523eca RingBuffer.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RingBuffer.lib	Thu Sep 27 14:50:02 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/ykuroda/code/RingBuffer_RTOS/#9adf0d5e0522
diff -r 000000000000 -r a8d5ff523eca main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Sep 27 14:50:02 2012 +0000
@@ -0,0 +1,60 @@
+/*
+ *    Example Main
+ */
+#include "mbed.h"
+#include "RingBuffer.h"
+
+Serial pc(USBTX, USBRX);
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+RingBuffer rb(30);
+
+
+void
+save_thread(void const *argument)
+{
+    while (true) {
+
+        for(int i='A'; i<='Z'; i++) {
+            led2 = !led2;
+            rb.save(i);
+            wait(1);
+        }
+    }
+}
+
+
+void
+save_thread2(void const *argument)
+{
+    while (true) {
+
+        for(int i='0'; i<='9'; i++) {
+            led3 = !led3;
+            rb.save(i);
+            wait(1);
+        }
+    }
+}
+
+
+int
+main(void)
+{
+    Thread thread(save_thread);
+    Thread thread2(save_thread2);
+
+    while(true) {
+        led1 = !led1;
+        if(rb.check()) {
+            int c = rb.read();
+            pc.putc(c);
+            if(c=='Z') pc.putc('\n');
+
+        } else {
+            wait(0.1);
+        }
+    }
+    return 0;
+}
diff -r 000000000000 -r a8d5ff523eca mbed-rtos.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Thu Sep 27 14:50:02 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#9654a71f5a90
diff -r 000000000000 -r a8d5ff523eca mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Sep 27 14:50:02 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/cd19af002ccc
\ No newline at end of file