Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FT800_2 HYT mbed
TFT/display.Draw_MainMenu.cpp@1:e20b5da0c912, 2016-10-05 (annotated)
- Committer:
- Ksenia
- Date:
- Wed Oct 05 10:06:54 2016 +0000
- Revision:
- 1:e20b5da0c912
- Parent:
- 0:1f5444f2977d
Changed wrong comment in GetTouch function
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Ksenia | 0:1f5444f2977d | 1 | #include "display.h" |
| Ksenia | 0:1f5444f2977d | 2 | |
| Ksenia | 0:1f5444f2977d | 3 | /************************************************************************************************************************** |
| Ksenia | 0:1f5444f2977d | 4 | ************************** Display Main Menu ****************************************************************************** |
| Ksenia | 0:1f5444f2977d | 5 | **************************************************************************************************************************/ |
| Ksenia | 0:1f5444f2977d | 6 | void Display::MainMenu(float humidity, float temperature) |
| Ksenia | 0:1f5444f2977d | 7 | { |
| Ksenia | 0:1f5444f2977d | 8 | // start FT800 display list |
| Ksenia | 0:1f5444f2977d | 9 | StartDL(); |
| Ksenia | 0:1f5444f2977d | 10 | |
| Ksenia | 0:1f5444f2977d | 11 | // write main title |
| Ksenia | 0:1f5444f2977d | 12 | (*_TFT).DL(COLOR_RGB(0, 0, 0)); |
| Ksenia | 0:1f5444f2977d | 13 | (*_TFT).Text(11, 15, 30, 0, "HYT-271 sensor from IST"); |
| Ksenia | 0:1f5444f2977d | 14 | |
| Ksenia | 0:1f5444f2977d | 15 | // create blue rectangle with current humididty including |
| Ksenia | 0:1f5444f2977d | 16 | // rectangle is tagged as CURR_HUM_PRESS |
| Ksenia | 0:1f5444f2977d | 17 | (*_TFT).DL(TAG_MASK(1)); |
| Ksenia | 0:1f5444f2977d | 18 | (*_TFT).DL(TAG(CURR_HUM_PRESS)); |
| Ksenia | 0:1f5444f2977d | 19 | (*_TFT).DL(COLOR_RGB(9, 0, 63)); |
| Ksenia | 0:1f5444f2977d | 20 | // if rectangle is already pressed, draw it with lighter color |
| Ksenia | 0:1f5444f2977d | 21 | if (pressedButton == CURR_HUM_PRESS) { |
| Ksenia | 0:1f5444f2977d | 22 | (*_TFT).DL(COLOR_RGB(75, 70, 108)); |
| Ksenia | 0:1f5444f2977d | 23 | } |
| Ksenia | 0:1f5444f2977d | 24 | (*_TFT).DL(BEGIN(RECTS)); |
| Ksenia | 0:1f5444f2977d | 25 | (*_TFT).DL(VERTEX2II(12, 62, 0, 0)); |
| Ksenia | 0:1f5444f2977d | 26 | (*_TFT).DL(VERTEX2II(12 + 400, 62 + 93, 0, 0)); |
| Ksenia | 0:1f5444f2977d | 27 | (*_TFT).DL(COLOR_RGB(255, 255, 255)); |
| Ksenia | 0:1f5444f2977d | 28 | (*_TFT).Text(12 + 10, 62 + 5, 30, 0, "Current humidity (rH)"); |
| Ksenia | 0:1f5444f2977d | 29 | CreateStringTempHum(humidityStr, humidity, 0); |
| Ksenia | 0:1f5444f2977d | 30 | (*_TFT).Text(12 + 10, 62 + 45, 31, 0, humidityStr); |
| Ksenia | 0:1f5444f2977d | 31 | (*_TFT).DL(TAG_MASK(0)); |
| Ksenia | 0:1f5444f2977d | 32 | |
| Ksenia | 0:1f5444f2977d | 33 | // create blue rectangle with current temperature including |
| Ksenia | 0:1f5444f2977d | 34 | // rectangle is tagged as CURR_TEMP_PRESS |
| Ksenia | 0:1f5444f2977d | 35 | (*_TFT).DL(TAG_MASK(1)); |
| Ksenia | 0:1f5444f2977d | 36 | (*_TFT).DL(TAG(CURR_TEMP_PRESS)); |
| Ksenia | 0:1f5444f2977d | 37 | (*_TFT).DL(COLOR_RGB(9, 0, 63)); |
| Ksenia | 0:1f5444f2977d | 38 | // if rectangle is already pressed, draw it with lighter color |
| Ksenia | 0:1f5444f2977d | 39 | if (pressedButton == CURR_TEMP_PRESS) { |
| Ksenia | 0:1f5444f2977d | 40 | (*_TFT).DL(COLOR_RGB(75, 70, 108)); |
| Ksenia | 0:1f5444f2977d | 41 | } |
| Ksenia | 0:1f5444f2977d | 42 | (*_TFT).DL(BEGIN(RECTS)); |
| Ksenia | 0:1f5444f2977d | 43 | (*_TFT).DL(VERTEX2II(12, 62 + 93 + 12, 0, 0)); |
| Ksenia | 0:1f5444f2977d | 44 | (*_TFT).DL(VERTEX2II(12 + 400, 62 + 93 + 12 + 93, 0, 0)); |
| Ksenia | 0:1f5444f2977d | 45 | (*_TFT).DL(COLOR_RGB(255, 255, 255)); |
| Ksenia | 0:1f5444f2977d | 46 | (*_TFT).Text(12 + 10, 62 + 93 + 12 + 5, 30, 0, "Current temperature"); |
| Ksenia | 0:1f5444f2977d | 47 | CreateStringTempHum(temperatureStr, temperature, 1); |
| Ksenia | 0:1f5444f2977d | 48 | (*_TFT).Text(12 + 10, 62 + 93 + 12 + 45, 31, 0, temperatureStr); |
| Ksenia | 0:1f5444f2977d | 49 | (*_TFT).DL(TAG_MASK(0)); |
| Ksenia | 0:1f5444f2977d | 50 | |
| Ksenia | 0:1f5444f2977d | 51 | // finish FT800 display list |
| Ksenia | 0:1f5444f2977d | 52 | FinishDL(); |
| Ksenia | 0:1f5444f2977d | 53 | } |