KEIS
Dependencies: C12832_lcd mbed-rtos mbed
Fork of rtos_mutex by
Revision 5:cdc855b58daf, committed 2013-09-25
- Comitter:
- khayakawa
- Date:
- Wed Sep 25 05:05:24 2013 +0000
- Parent:
- 4:192fef923dbc
- Commit message:
- KEIS;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832_lcd.lib Wed Sep 25 05:05:24 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/dreschpe/code/C12832_lcd/#468cdccff7af
--- a/main.cpp Tue Jun 04 16:03:01 2013 +0100
+++ b/main.cpp Wed Sep 25 05:05:24 2013 +0000
@@ -1,24 +1,31 @@
#include "mbed.h"
#include "rtos.h"
+#include "C12832_lcd.h"
-Mutex stdio_mutex;
+C12832_LCD lcd;
+Mutex lcd_mutex;
-void notify(const char* name, int state) {
- stdio_mutex.lock();
- printf("%s: %d\n\r", name, state);
- stdio_mutex.unlock();
+void mu_write(const char* name) {
+ Thread::wait(rand()/1000000);
+ lcd_mutex.lock();
+ lcd.locate(0,3);
+ lcd.printf("%s writing\n\r", name);
+ Thread::wait(1000);
+ lcd.cls();
+ lcd_mutex.unlock();
}
void test_thread(void const *args) {
while (true) {
- notify((const char*)args, 0); Thread::wait(1000);
- notify((const char*)args, 1); Thread::wait(1000);
+ mu_write((const char*)args);
}
}
int main() {
+ lcd.cls();
Thread t2(test_thread, (void *)"Th 2");
Thread t3(test_thread, (void *)"Th 3");
+ Thread t4(test_thread, (void *)"Th 4");
test_thread((void *)"Th 1");
}
--- a/mbed-rtos.lib Tue Jun 04 16:03:01 2013 +0100 +++ b/mbed-rtos.lib Wed Sep 25 05:05:24 2013 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/ \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed-rtos/#58b30ac3f00e
--- a/mbed.bld Tue Jun 04 16:03:01 2013 +0100 +++ b/mbed.bld Wed Sep 25 05:05:24 2013 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/ \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17 \ No newline at end of file
