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
tsk_display.cpp@12:1de8b271e292, 2015-12-14 (annotated)
- Committer:
- dzoni
- Date:
- Mon Dec 14 18:15:57 2015 +0000
- Revision:
- 12:1de8b271e292
- Parent:
- 9:645f0e517017
- Child:
- 13:f62b10a6e1c5
Compiles OK. Testing fails (display).
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dzoni | 9:645f0e517017 | 1 | #include "mbed.h" |
dzoni | 9:645f0e517017 | 2 | #include "rtos.h" |
dzoni | 9:645f0e517017 | 3 | |
dzoni | 9:645f0e517017 | 4 | #include "TextLCD.h" |
dzoni | 9:645f0e517017 | 5 | |
dzoni | 9:645f0e517017 | 6 | #include "tsk_display.h" |
dzoni | 9:645f0e517017 | 7 | #include "tsk_temp.h" |
dzoni | 9:645f0e517017 | 8 | #include "tsk_dist.h" |
dzoni | 9:645f0e517017 | 9 | #include "tsk_main.h" |
dzoni | 9:645f0e517017 | 10 | |
dzoni | 9:645f0e517017 | 11 | static TextLCD lcd(PA_8, PA_7, PA_9, PA_1, PB_5, PA_10, TextLCD::LCD16x2); |
dzoni | 9:645f0e517017 | 12 | |
dzoni | 12:1de8b271e292 | 13 | uint32_t initDisplay(void const *args) { |
dzoni | 12:1de8b271e292 | 14 | |
dzoni | 12:1de8b271e292 | 15 | lcd.cls(); |
dzoni | 12:1de8b271e292 | 16 | // lcd.printf("Raw:%3u % 5.0f mm", temp_data.temp_raw, dist_data.distance); |
dzoni | 12:1de8b271e292 | 17 | lcd.printf("Row 1"); |
dzoni | 12:1de8b271e292 | 18 | lcd.locate(0, 1); |
dzoni | 12:1de8b271e292 | 19 | // lcd.printf("Float: %3.2f%cC", temp_data.temperature, 0xdf); |
dzoni | 12:1de8b271e292 | 20 | lcd.printf("Row 2"); |
dzoni | 12:1de8b271e292 | 21 | |
dzoni | 12:1de8b271e292 | 22 | return 1; |
dzoni | 12:1de8b271e292 | 23 | } |
dzoni | 12:1de8b271e292 | 24 | |
dzoni | 12:1de8b271e292 | 25 | |
dzoni | 9:645f0e517017 | 26 | void disp_thread(void const *args) { |
dzoni | 9:645f0e517017 | 27 | |
dzoni | 9:645f0e517017 | 28 | while (true) { |
dzoni | 9:645f0e517017 | 29 | lcd.cls(); |
dzoni | 12:1de8b271e292 | 30 | // lcd.printf("Raw:%3u % 5.0f mm", temp_data.temp_raw, dist_data.distance); |
dzoni | 12:1de8b271e292 | 31 | lcd.printf("Row 1"); |
dzoni | 9:645f0e517017 | 32 | uiCnt += 2; |
dzoni | 9:645f0e517017 | 33 | lcd.locate(0, 1); |
dzoni | 12:1de8b271e292 | 34 | // lcd.printf("Float: %3.2f%cC", temp_data.temperature, 0xdf); |
dzoni | 12:1de8b271e292 | 35 | lcd.printf("Row 2"); |
dzoni | 12:1de8b271e292 | 36 | |
dzoni | 12:1de8b271e292 | 37 | Thread::wait(5000); |
dzoni | 9:645f0e517017 | 38 | } |
dzoni | 9:645f0e517017 | 39 | } |
dzoni | 9:645f0e517017 | 40 |