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 1:3043ec651794, committed 2012-07-13
- Comitter:
- emilmont
- Date:
- Fri Jul 13 11:48:28 2012 +0000
- Parent:
- 0:4979ad0f5cb9
- Child:
- 2:3ded4c6c9dff
- Commit message:
- First implementation
Changed in this revision
| 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 |
--- a/main.cpp Fri Jul 13 11:46:23 2012 +0000
+++ b/main.cpp Fri Jul 13 11:48:28 2012 +0000
@@ -1,1 +1,34 @@
+#include "mbed.h"
+#include "rtos.h"
+Queue<uint32_t, 5> queue;
+
+DigitalOut myled(LED1);
+
+void queue_isr() {
+ queue.put((uint32_t*)2);
+ myled = !myled;
+}
+
+void queue_thread(void const *argument) {
+ while (true) {
+ queue.put((uint32_t*)1);
+ Thread::wait(1000);
+ }
+}
+
+int main (void) {
+ Thread thread(queue_thread);
+
+ Ticker ticker;
+ ticker.attach(queue_isr, 1.0);
+
+ while (true) {
+ osEvent evt = queue.get();
+ if (evt.status != osEventMessage) {
+ printf("queue->get() returned %02x status\n\r", evt.status);
+ } else {
+ printf("queue->get() returned %d\n\r", evt.value.v);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Fri Jul 13 11:48:28 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#01158bb7600c