Simple test program to get familiar with functionality of MBED RTOS on ST Nucleo-F411RE. Tasks for LED blinking, user button, temperature measurement with DS1620, temperature measurement with internal temperature sensor of ST32F411RE, ultrasonic distance measurement and displaying result on 16x2 TextLCD.

Dependencies:   DS1620_improved TextLCD_improved mbed-rtos mbed

Revision:
13:f62b10a6e1c5
Parent:
12:1de8b271e292
Child:
15:a627638edd9c
--- a/tsk_display.cpp	Mon Dec 14 18:15:57 2015 +0000
+++ b/tsk_display.cpp	Mon Dec 14 19:38:24 2015 +0000
@@ -8,17 +8,25 @@
 #include "tsk_dist.h"
 #include "tsk_main.h"
 
-static TextLCD lcd(PA_8, PA_7, PA_9, PA_1, PB_5, PA_10, TextLCD::LCD16x2);
+static TextLCD *lcd = NULL;
 
 uint32_t initDisplay(void const *args) {
-    
-        lcd.cls();
-//        lcd.printf("Raw:%3u % 5.0f mm", temp_data.temp_raw, dist_data.distance);
-        lcd.printf("Row 1");
-        lcd.locate(0, 1);    
-//        lcd.printf("Float: %3.2f%cC", temp_data.temperature, 0xdf);
-        lcd.printf("Row 2");
-    
+
+    lcd = new TextLCD(PA_8, PA_7, PA_9, PA_1, PB_5, PA_10, TextLCD::LCD16x2);
+
+    lcd->cls();
+    lcd->printf("Row 1");
+    lcd->locate(0, 1);    
+    lcd->printf("Row 2");
+       
+    return 1;
+}
+
+uint32_t disposeDisplay(void const *args) {
+
+    delete lcd;
+    lcd = NULL;
+       
     return 1;
 }
 
@@ -26,15 +34,12 @@
 void disp_thread(void const *args) {
 
     while (true) {
-        lcd.cls();
-//        lcd.printf("Raw:%3u % 5.0f mm", temp_data.temp_raw, dist_data.distance);
-        lcd.printf("Row 1");
+        lcd->cls();
+        lcd->printf("Raw:%3u % 5.0f mm", temp_data.temp_raw, dist_data.distance);
         uiCnt += 2;
-        lcd.locate(0, 1);    
-//        lcd.printf("Float: %3.2f%cC", temp_data.temperature, 0xdf);
-        lcd.printf("Row 2");
+        lcd->locate(0, 1);    
+        lcd->printf("Float: %3.2f%cC", temp_data.temperature, 0xdf);
 
-        Thread::wait(5000);
+        Thread::wait(2000);
     }
-}
-
+}
\ No newline at end of file