This demo uses the mbed RTOS to run eight threads (including main). The threads are using different I/O devices on the application board. Several of the threads output to the LCD and an OS mutex lock is used to control access to the LCD and make the LCD thread safe.

Dependencies:   C12832_lcd LCD_fonts mbed-rtos mbed

Fork of lab1 by Peter Drescher

Files at this revision

API Documentation at this revision

Comitter:
dreschpe
Date:
Wed Dec 05 08:06:20 2012 +0000
Parent:
2:a69c8c5f5b03
Child:
4:79863d2ea5a0
Commit message:
the lcd lib is not claiming the printf now, so we have to call LCD.printf

Changed in this revision

C12832_lcd.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
--- a/C12832_lcd.lib	Fri Oct 26 18:18:33 2012 +0000
+++ b/C12832_lcd.lib	Wed Dec 05 08:06:20 2012 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/dreschpe/code/C12832_lcd/#468cdccff7af
+http://mbed.org/users/dreschpe/code/C12832_lcd/#8d812da33cdc
--- a/main.cpp	Fri Oct 26 18:18:33 2012 +0000
+++ b/main.cpp	Wed Dec 05 08:06:20 2012 +0000
@@ -11,7 +11,7 @@
 #include "C12832_lcd.h"
 
 // LCD object
-C12832_LCD LCD("LCD");
+C12832_LCD LCD;
 
 AnalogIn Pot1(p19);
 AnalogIn Pot2(p20);
@@ -29,7 +29,7 @@
         lcd_mutex.lock();
         LCD.locate(0,0);
         LCD.set_font((unsigned char*) Small_6);
-        printf("Thread1 count: %d",i);
+        LCD.printf("Thread1 count: %d",i);
         lcd_mutex.unlock();
         i++;
         Thread::wait(1000);
@@ -45,7 +45,7 @@
         lcd_mutex.lock();
         LCD.locate(0,20);
         LCD.set_font((unsigned char*) Arial_9);
-        printf("Thread 2 count : %d",k);
+        LCD.printf("Thread 2 count : %d",k);
         lcd_mutex.unlock();
         k++;
         Thread::wait(500); // wait 0.5s
@@ -111,7 +111,7 @@
         LCD.locate(0,9);
         LCD.set_font((unsigned char*) Small_7);
         j = LCD.get_contrast();    // read the actual contrast
-        printf("contrast : %d",j);
+        LCD.printf("contrast : %d",j);
         lcd_mutex.unlock();
         Thread::wait(500);   // wait 0.5s
     }
--- a/mbed-rtos.lib	Fri Oct 26 18:18:33 2012 +0000
+++ b/mbed-rtos.lib	Wed Dec 05 08:06:20 2012 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/#9654a71f5a90
+http://mbed.org/users/mbed_official/code/mbed-rtos/#88a1a9c26ae3
--- a/mbed.bld	Fri Oct 26 18:18:33 2012 +0000
+++ b/mbed.bld	Wed Dec 05 08:06:20 2012 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/e2ed12d17f06
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/b60934f96c0c
\ No newline at end of file