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.
Diff: demo.cpp
- Revision:
- 2:81eaaa491a02
- Parent:
- 0:a5ef6bc3c2e8
- Child:
- 3:dcfbceb81fef
--- a/demo.cpp Thu Sep 08 13:40:36 2016 +0000 +++ b/demo.cpp Fri Sep 09 06:17:05 2016 +0000 @@ -11,26 +11,26 @@ void TFT_4DGL :: graphicsDemo() { cls(); - screenOrientation(1); // set orientation to landscape + screenOrientation(landscape); // set orientation to landscape puts("This is the Graphics functions demo"); wait_ms(LONG_WAIT); cls(); puts("\nLets change all the "); - textFgColor(PURPLE_MSB, PURPLE_LSB); + textFgColor(Purple); puts("PURPLE"); - textFgColor(YELLOW_MSB, YELLOW_LSB); + textFgColor(Yellow); puts(" bits to yellow"); - textFgColor(GREEN_MSB, GREEN_LSB); // set color back to green + textFgColor(Green); // set color back to green wait_ms(LONG_WAIT); - changeColor(PURPLE_MSB, PURPLE_LSB, YELLOW_MSB, YELLOW_LSB); + changeColor(Purple, Yellow); wait_ms(LONG_WAIT); cls(); puts("Lets draw some shapes:"); wait_ms(LONG_WAIT); cls(); - drawCircle(100, 100, 20, RED_MSB, RED_LSB); + drawCircle(100, 100, 20, Aqua); } @@ -43,7 +43,7 @@ puts("This is the main functions demo"); wait_ms(LONG_WAIT); cls(); - + puts("\nBaudrates:"); wait_ms(LONG_WAIT); cls(); @@ -79,30 +79,54 @@ puts("\n115200"); wait_ms(SHORT_WAIT); cls(); + baudrate(128000); + puts("\n128000"); + wait_ms(SHORT_WAIT); + cls(); + baudrate(256000); + puts("\n256000"); + wait_ms(SHORT_WAIT); + cls(); + baudrate(300000); + puts("\n300000"); + wait_ms(SHORT_WAIT); + cls(); + baudrate(375000); + puts("\n375000"); + wait_ms(SHORT_WAIT); + cls(); + baudrate(500000); + puts("\n500000"); + wait_ms(SHORT_WAIT); + cls(); + baudrate(600000); + puts("\n600000"); + wait_ms(SHORT_WAIT); + cls(); baudrate(9600); puts("\nSet back to 9600"); wait_ms(LONG_WAIT); cls(); - + puts("\nOrientation:"); wait_ms(LONG_WAIT); cls(); - screenOrientation(1); + screenOrientation(landscape); puts("landscape"); wait_ms(SHORT_WAIT); cls(); - screenOrientation(2); + screenOrientation(landscapeRew); puts("landscape rewersed"); wait_ms(SHORT_WAIT); cls(); - screenOrientation(3); + screenOrientation(portrait); puts("portrait"); wait_ms(SHORT_WAIT); cls(); - screenOrientation(4); + screenOrientation(portraitRew); puts("portrait rewersed"); wait_ms(LONG_WAIT); - screenOrientation(1); // set back screen to landscape + screenOrientation(landscape); // set back screen to landscape cls(); } @@ -113,7 +137,7 @@ void TFT_4DGL :: textDemo() { cls(); - screenOrientation(1); // set screen to landscape + screenOrientation(landscape); // set screen to landscape puts("This is the Text functions demo"); wait_ms(LONG_WAIT); cls(); @@ -122,40 +146,40 @@ wait_ms(LONG_WAIT); //cls(); puts("\n\n"); - textAttributes(16); + textAttributes(bold); puts("\nBOLD"); wait_ms(SHORT_WAIT); - textAttributes(16 + 32); + textAttributes(bold + italic); puts("\nBOLD & ITALIC"); wait_ms(SHORT_WAIT); - textAttributes(16 + 32 + 64); + textAttributes(bold + italic + inverse); puts("\nBOLD & ITALIC & INVERSE"); wait_ms(SHORT_WAIT); - textAttributes(16 + 32 + 64 + 128); + textAttributes(bold + italic + inverse + underline); puts("\nBOLD & ITALIC & INVERSE & UNDERLINE"); wait_ms(LONG_WAIT); - textAttributes(0); // set everything back to normal + textAttributes(DISABLE); // set everything back to normal cls(); puts("\nText modes:"); wait_ms(LONG_WAIT); cls(); - textBold(1); + textBold(ENABLE); puts("\nBOLD:"); wait_ms(SHORT_WAIT); - textBold(0); - textInverse(1); + textBold(DISABLE); + textInverse(ENABLE); puts("\nINVERSE:"); wait_ms(SHORT_WAIT); - textInverse(0); - textItalic(1); + textInverse(DISABLE); + textItalic(ENABLE); puts("\nITALIC:"); wait_ms(SHORT_WAIT); - textItalic(0); - textUnderline(1); + textItalic(DISABLE); + textUnderline(ENABLE); puts("\nUNDERLINE:"); wait_ms(SHORT_WAIT); - textUnderline(0); + textUnderline(DISABLE); wait_ms(LONG_WAIT); cls(); @@ -219,83 +243,83 @@ wait_ms(LONG_WAIT); textHeight(1); cls(); - + puts("Fonts:"); wait_ms(LONG_WAIT); cls(); - setFont(1); + setFont(font1); puts("\nThis is Font 1"); wait_ms(SHORT_WAIT); - setFont(2); + setFont(font2); puts("\nThis is Font 2"); wait_ms(SHORT_WAIT); - setFont(3); + setFont(font3); puts("\nThis is Font 3"); wait_ms(LONG_WAIT); cls(); - - screenOrientation(3); + + screenOrientation(portrait); puts("\nText Background colors:"); wait_ms(LONG_WAIT); cls(); - textBgColor(BLACK_MSB, BLACK_LSB); + textBgColor(Black); puts("\nBG color = BLACK"); wait_ms(SHORT_WAIT); - textBgColor(NAVY_MSB, NAVY_LSB); + textBgColor(Navy); puts("\nBG color = NAVY"); wait_ms(SHORT_WAIT); - textFgColor(BLACK_MSB, BLACK_LSB); - textBgColor(DGREEN_MSB, DGREEN_LSB); + textFgColor(Black); + textBgColor(DGreen); puts("\nBG color = DARK GREEN"); wait_ms(SHORT_WAIT); - textBgColor(DCYAN_MSB, DCYAN_LSB); + textBgColor(DCyan); puts("\nBG color = DARK CYAN"); wait_ms(SHORT_WAIT); - textBgColor(PURPLE_MSB, PURPLE_LSB); + textBgColor(Purple); puts("\nBG color = PURPLE"); wait_ms(SHORT_WAIT); - textBgColor(OLIVE_MSB, OLIVE_LSB); + textBgColor(Olive); puts("\nBG color = OLIVE"); wait_ms(SHORT_WAIT); - textBgColor(GREY_MSB, GREY_LSB); + textBgColor(Grey); puts("\nBG color = GREY"); wait_ms(SHORT_WAIT); - textBgColor(BLUE_MSB, BLUE_LSB); + textBgColor(Blue); puts("\nBG color = BLUE"); wait_ms(SHORT_WAIT); - textBgColor(GREEN_MSB, GREEN_LSB); + textBgColor(Green); puts("\nBG color = GREEN"); wait_ms(SHORT_WAIT); - textBgColor(RED_MSB, RED_LSB); + textBgColor(Red); puts("\nBG color = RED"); wait_ms(SHORT_WAIT); - textBgColor(YELLOW_MSB, YELLOW_LSB); + textBgColor(Yellow); puts("\nBG color = YELLOW"); wait_ms(SHORT_WAIT); - textBgColor(G_YELLOW_MSB, G_YELLOW_LSB); + textBgColor(GYellow); puts("\nBG color = GREEN YELLOW"); wait_ms(SHORT_WAIT); - textBgColor(WHITE_MSB, WHITE_LSB); + textBgColor(White); puts("\nBG color = WHITE"); wait_ms(SHORT_WAIT); - textBgColor(ORANGE_MSB, ORANGE_LSB); + textBgColor(Orange); puts("\nBG color = ORANGE"); wait_ms(SHORT_WAIT); - textBgColor(PINK_MSB, PINK_LSB); + textBgColor(Pink); puts("\nBG color = PINK"); wait_ms(SHORT_WAIT); - textBgColor(VIOLET_MSB, VIOLET_LSB); + textBgColor(Violet); puts("\nBG color = VIOLET"); wait_ms(SHORT_WAIT); - textBgColor(AQUA_MSB, AQUA_LSB); + textBgColor(Aqua); puts("\nBG color = AQUA"); wait_ms(SHORT_WAIT); - textBgColor(CREAM_MSB, CREAM_LSB); + textBgColor(Cream); puts("\nBG color = CREAM"); wait_ms(LONG_WAIT); - textBgColor(BLACK_MSB, BLACK_LSB); // set color back - textFgColor(GREEN_MSB, GREEN_LSB); // set color back + textBgColor(Black); // set color back + textFgColor(Green); // set color back cls(); puts("Lets try moving cursor..."); @@ -313,65 +337,67 @@ cls(); - screenOrientation(3); + screenOrientation(portrait); puts("\nText Foreground colors:"); wait_ms(LONG_WAIT); cls(); - textBgColor(WHITE_MSB, WHITE_LSB); - textFgColor(BLACK_MSB, BLACK_LSB); + textBgColor(White); + textFgColor(Black); puts("\nFG color = BLACK"); - textBgColor(BLACK_MSB, BLACK_LSB); + textBgColor(Black); wait_ms(SHORT_WAIT); - textFgColor(NAVY_MSB, NAVY_LSB); + textFgColor(Navy); puts("\nFG color = NAVY"); wait_ms(SHORT_WAIT); - textFgColor(DGREEN_MSB, DGREEN_LSB); + textFgColor(DGreen); puts("\nFG color = DARK GREEN"); wait_ms(SHORT_WAIT); - textFgColor(DCYAN_MSB, DCYAN_LSB); + textFgColor(DCyan); puts("\nFG color = DARK CYAN"); wait_ms(SHORT_WAIT); - textFgColor(PURPLE_MSB, PURPLE_LSB); + textFgColor(Purple); puts("\nFG color = PURPLE"); wait_ms(SHORT_WAIT); - textFgColor(OLIVE_MSB, OLIVE_LSB); + textFgColor(Olive); puts("\nFG color = OLIVE"); wait_ms(SHORT_WAIT); - textFgColor(GREY_MSB, GREY_LSB); + textFgColor(Grey); puts("\nFG color = GREY"); wait_ms(SHORT_WAIT); - textFgColor(BLUE_MSB, BLUE_LSB); + textFgColor(Blue); puts("\nFG color = BLUE"); wait_ms(SHORT_WAIT); - textFgColor(GREEN_MSB, GREEN_LSB); + textFgColor(Green); puts("\nFG color = GREEN"); wait_ms(SHORT_WAIT); - textFgColor(RED_MSB, RED_LSB); + textFgColor(Red); puts("\nFG color = RED"); wait_ms(SHORT_WAIT); - textFgColor(YELLOW_MSB, YELLOW_LSB); + textFgColor(Yellow); puts("\nFG color = YELLOW"); wait_ms(SHORT_WAIT); - textFgColor(G_YELLOW_MSB, G_YELLOW_LSB); + textFgColor(GYellow); puts("\nFG color = GREEN YELLOW"); wait_ms(SHORT_WAIT); - textFgColor(WHITE_MSB, WHITE_LSB); + textFgColor(White); puts("\nFG color = WHITE"); wait_ms(SHORT_WAIT); - textFgColor(ORANGE_MSB, ORANGE_LSB); + textFgColor(Orange); puts("\nFG color = ORANGE"); wait_ms(SHORT_WAIT); - textFgColor(PINK_MSB, PINK_LSB); + textFgColor(Pink); puts("\nFG color = PINK"); wait_ms(SHORT_WAIT); - textFgColor(VIOLET_MSB, VIOLET_LSB); + textFgColor(Violet); puts("\nFG color = VIOLET"); wait_ms(SHORT_WAIT); - textFgColor(AQUA_MSB, AQUA_LSB); + textFgColor(Aqua); puts("\nFG color = AQUA"); wait_ms(SHORT_WAIT); - textFgColor(CREAM_MSB, CREAM_LSB); + textFgColor(Cream); puts("\nFG color = CREAM"); - wait_ms(SHORT_WAIT); - textFgColor(GREEN_MSB, GREEN_LSB); // set color back + wait_ms(LONG_WAIT); + textFgColor(Green); // set color back + + } \ No newline at end of file