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:
17:94c385ff2641
Parent:
15:a627638edd9c
Child:
18:be0130c42925
--- a/tsk_display.cpp	Wed Dec 16 22:37:56 2015 +0000
+++ b/tsk_display.cpp	Fri Dec 18 15:23:21 2015 +0000
@@ -3,10 +3,11 @@
 
 #include "TextLCD.h"
 
+#include "tsk_main.h"
 #include "tsk_display.h"
 #include "tsk_temp.h"
+#include "tsk_inttemp.h"
 #include "tsk_dist.h"
-#include "tsk_main.h"
 
 static TextLCD *lcd;
 
@@ -14,10 +15,8 @@
 
     lcd = new TextLCD(PA_8, PA_7, PA_9, PA_1, PB_5, PA_10, TextLCD::LCD16x2);
 
+    wait_ms(250);
     lcd->cls();
-    lcd->printf("Row 1");
-    lcd->locate(0, 1);    
-    lcd->printf("Row 2");
        
     return 1;
 }
@@ -32,14 +31,36 @@
 
 
 void disp_thread(void const *args) {
+    float dist;
+    float temp;
+    float intTemp;
+    uint32_t dist_raw;
+    uint32_t temp_raw;
+    
+    while (true) {
+        mutexDist.lock();
+        dist = dist_data.distance;
+        dist_raw = dist_data.timerTicks;
+        mutexDist.unlock();
 
-    while (true) {
+        mutexTemp.lock();
+        temp = temp_data.temperature;
+        temp_raw = temp_data.temp_raw;
+        mutexTemp.unlock();
+
+        mutexIntTemp.lock();
+        intTemp = int_temp_data.temperature;
+        mutexIntTemp.unlock();
+
+        uiCnt += 2;
+
         lcd->cls();
-        lcd->printf("Raw:%3u % 5.0f mm", temp_data.temp_raw, dist_data.distance);
-//        uiCnt += 2;
+//        lcd->printf("%4.2fmm (%4u)", dist, dist_raw);
+        lcd->printf("%4.2fmm (%4u)", dist, uiCnt);
         lcd->locate(0, 1);    
-        lcd->printf("Float: %3.2f%cC", temp_data.temperature, 0xdf);
+//        lcd->printf("%3.2f%cC (%3u)", temp, 0xdf, temp_raw);
+        lcd->printf("%3.1f%cC (%2.1f)", temp, 0xdf, intTemp);
 
-        Thread::wait(1896);
+        Thread::wait(2000);
     }
 }
\ No newline at end of file