Andrew Reed
/
CITY3032-template
Template for working forward
main.cpp@1:402b32a1025f, 2019-11-19 (annotated)
- Committer:
- reedas
- Date:
- Tue Nov 19 10:04:48 2019 +0000
- Revision:
- 1:402b32a1025f
- Parent:
- 0:6beb6f498640
- Child:
- 2:ad262f2c84ca
Basic Hello World tft display library program
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
reedas | 1:402b32a1025f | 1 | /* Hello World! for the TextLCD Enhanced Library*/ |
reedas | 1:402b32a1025f | 2 | |
romilly | 0:6beb6f498640 | 3 | #include "mbed.h" |
reedas | 1:402b32a1025f | 4 | #include "GUI.h" |
reedas | 1:402b32a1025f | 5 | #include "cy8ckit_028_tft.h" |
reedas | 1:402b32a1025f | 6 | |
reedas | 1:402b32a1025f | 7 | void Display_Init(void) |
reedas | 1:402b32a1025f | 8 | { |
reedas | 1:402b32a1025f | 9 | |
reedas | 1:402b32a1025f | 10 | /* Set font size, foreground and background Colours */ |
reedas | 1:402b32a1025f | 11 | GUI_SetFont(GUI_FONT_16B_1); |
reedas | 1:402b32a1025f | 12 | GUI_SetColor(GUI_WHITE); |
reedas | 1:402b32a1025f | 13 | GUI_SetBkColor(GUI_BLACK); |
romilly | 0:6beb6f498640 | 14 | |
reedas | 1:402b32a1025f | 15 | /* Clear screen and print splash screen */ |
reedas | 1:402b32a1025f | 16 | GUI_Clear(); |
reedas | 1:402b32a1025f | 17 | GUI_SetTextAlign(GUI_TA_HCENTER); |
reedas | 1:402b32a1025f | 18 | GUI_DispStringAt("TFT Demo", 160, 20); |
reedas | 1:402b32a1025f | 19 | } |
reedas | 1:402b32a1025f | 20 | |
reedas | 1:402b32a1025f | 21 | int main() |
reedas | 1:402b32a1025f | 22 | { |
reedas | 1:402b32a1025f | 23 | /* Initialise EmWin driver*/ |
reedas | 1:402b32a1025f | 24 | GUI_Init(); |
romilly | 0:6beb6f498640 | 25 | |
reedas | 1:402b32a1025f | 26 | /* Initialise display */ |
reedas | 1:402b32a1025f | 27 | Display_Init(); |
reedas | 1:402b32a1025f | 28 | |
reedas | 1:402b32a1025f | 29 | |
reedas | 1:402b32a1025f | 30 | GUI_SetFont(GUI_FONT_8X16X2X2); |
reedas | 1:402b32a1025f | 31 | GUI_SetTextAlign(GUI_TA_HCENTER); |
reedas | 1:402b32a1025f | 32 | GUI_DispStringAt("Hello World!", 160, 200); |
reedas | 1:402b32a1025f | 33 | |
romilly | 0:6beb6f498640 | 34 | } |
reedas | 1:402b32a1025f | 35 | |
reedas | 1:402b32a1025f | 36 | |
reedas | 1:402b32a1025f | 37 |