Rihards Balass / 4DGL-mbed-32PTU
Committer:
CaptainR
Date:
Tue Sep 27 11:49:34 2016 +0000
Revision:
25:015631f9e875
Parent:
24:19c77967674e
Child:
26:c6a803706a42
File Exists - OK

Who changed what in which revision?

UserRevisionLine numberNew contents of line
CaptainR 0:a5ef6bc3c2e8 1
CaptainR 0:a5ef6bc3c2e8 2 #include "mbed.h"
CaptainR 0:a5ef6bc3c2e8 3 #include "Picaso_4DGL-32PTU.h"
CaptainR 0:a5ef6bc3c2e8 4
CaptainR 0:a5ef6bc3c2e8 5 #define SHORT_WAIT 500
CaptainR 12:29f5ad896382 6 #define LONG_WAIT 1000
CaptainR 0:a5ef6bc3c2e8 7
CaptainR 22:cea582ea74c1 8 // local declarations
CaptainR 22:cea582ea74c1 9 void clearBuf(char *);
CaptainR 20:88e137b9ea46 10
CaptainR 20:88e137b9ea46 11 //**************************************************************************
CaptainR 20:88e137b9ea46 12 // Demo program that goes through file system based functions
CaptainR 20:88e137b9ea46 13 //**************************************************************************
CaptainR 20:88e137b9ea46 14 void PICASO_4DGL :: fileSystemDemo() {
CaptainR 20:88e137b9ea46 15
CaptainR 23:dd2c28fa4dfd 16 int i;
CaptainR 20:88e137b9ea46 17 cls();
CaptainR 20:88e137b9ea46 18 screenMode(landscape); // set orientation to landscape
CaptainR 20:88e137b9ea46 19 puts("\n\rThis is the File system functions demo");
CaptainR 20:88e137b9ea46 20 wait_ms(LONG_WAIT);
CaptainR 20:88e137b9ea46 21 cls();
CaptainR 20:88e137b9ea46 22
CaptainR 22:cea582ea74c1 23 if (file_Mount()) puts("\rFAT16 Mount: OK");
CaptainR 22:cea582ea74c1 24 else puts("\rFAT16 Mount: FAIL");
CaptainR 22:cea582ea74c1 25 char buf[100];
CaptainR 22:cea582ea74c1 26 sprintf(buf, "\n\rFAT16 Error = %i", file_Error());
CaptainR 21:ea68a8a3cea4 27 puts(buf);
CaptainR 22:cea582ea74c1 28 sprintf(buf, "\n\rFile count on disc = %i\n\r", file_Count("*.*"));
CaptainR 22:cea582ea74c1 29 puts(buf);
CaptainR 25:015631f9e875 30 sprintf(buf, "\n\rFound %i files maching 1*.*", file_Dir("1*.*"));
CaptainR 22:cea582ea74c1 31 puts(buf);
CaptainR 22:cea582ea74c1 32 file_FindFirst("*.TXT");
CaptainR 23:dd2c28fa4dfd 33 char filename[FILENAME_LENGTH];
CaptainR 23:dd2c28fa4dfd 34 for (i = 0; i < FILENAME_LENGTH; i++)
CaptainR 23:dd2c28fa4dfd 35 filename[i] = 0;
CaptainR 23:dd2c28fa4dfd 36 short len = file_FindFirstRet("*.TXT", filename);
CaptainR 24:19c77967674e 37 sprintf(buf, "\n\rFirst filename = %s\n Length = %i", filename, len);
CaptainR 24:19c77967674e 38 puts(buf);
CaptainR 24:19c77967674e 39 for (i = 0; i < FILENAME_LENGTH; i++)
CaptainR 24:19c77967674e 40 filename[i] = 0;
CaptainR 24:19c77967674e 41 file_FindNext();
CaptainR 24:19c77967674e 42 len = file_FindNextRet(filename);
CaptainR 24:19c77967674e 43 sprintf(buf, "\n\rNext filename = %s\n Length = %i", filename, len);
CaptainR 23:dd2c28fa4dfd 44 puts(buf);
CaptainR 25:015631f9e875 45 file_FindNext();
CaptainR 25:015631f9e875 46 file_FindNext();
CaptainR 25:015631f9e875 47 file_FindNext();
CaptainR 25:015631f9e875 48 if (file_Exists("3.TXT")) puts("\n\r3.TXT : EXISTS");
CaptainR 25:015631f9e875 49 else puts("\n\r3.TXT : DOES NOT EXIST");
CaptainR 25:015631f9e875 50 if (file_Exists("4.TXT")) puts("\n\r4.TXT : EXISTS");
CaptainR 25:015631f9e875 51 else puts("\n\r4.TXT : DOES NOT EXIST");
CaptainR 25:015631f9e875 52
CaptainR 20:88e137b9ea46 53 }
CaptainR 0:a5ef6bc3c2e8 54 //**************************************************************************
CaptainR 12:29f5ad896382 55 // Demo program that goes through media based functions
CaptainR 12:29f5ad896382 56 //**************************************************************************
CaptainR 12:29f5ad896382 57 void PICASO_4DGL :: mediaDemo() {
CaptainR 12:29f5ad896382 58
CaptainR 12:29f5ad896382 59 cls();
CaptainR 12:29f5ad896382 60 screenMode(landscape); // set orientation to landscape
CaptainR 12:29f5ad896382 61 puts("\n\rThis is the Media functions demo");
CaptainR 12:29f5ad896382 62 wait_ms(LONG_WAIT);
CaptainR 12:29f5ad896382 63 cls();
CaptainR 12:29f5ad896382 64
CaptainR 12:29f5ad896382 65 wait_ms(SHORT_WAIT);
CaptainR 12:29f5ad896382 66 if (media_Init()) puts("\n\r uSD card Initialization: OK");
CaptainR 12:29f5ad896382 67 else puts("\n\r uSD card Initialization: FAIL");
CaptainR 14:561cb06a2739 68 if (media_SetAdd(513)) puts("\n\r Byte address set: OK");
CaptainR 14:561cb06a2739 69 else puts("\n\r Byte address set: FAIL");
CaptainR 12:29f5ad896382 70 if (media_SetSector(1)) puts("\n\r Sector address set: OK");
CaptainR 12:29f5ad896382 71 else puts("\n\r Sector address set: FAIL");
CaptainR 16:cb072eea16e9 72 /*
CaptainR 16:cb072eea16e9 73 puts("\n\r Now write some data in multiple sectors");
CaptainR 15:86bdf382e6f7 74
CaptainR 15:86bdf382e6f7 75 char array[1030];
CaptainR 15:86bdf382e6f7 76 for (int i = 0; i < 1030; i++)
CaptainR 15:86bdf382e6f7 77 array[i] = 1;
CaptainR 15:86bdf382e6f7 78
CaptainR 12:29f5ad896382 79 wait_ms(LONG_WAIT);
CaptainR 15:86bdf382e6f7 80 if (media_WrSector(array)) puts("\n\r Write Data: OK");
CaptainR 15:86bdf382e6f7 81 else puts("\n\r Write Data: FAIL");
CaptainR 14:561cb06a2739 82 wait_ms(LONG_WAIT);
CaptainR 16:cb072eea16e9 83 puts("\n\r Now read the same data");
CaptainR 14:561cb06a2739 84 if (media_SetSector(1)) puts("\n\r Sector address set: OK");
CaptainR 15:86bdf382e6f7 85 if (media_RdSector()) puts("\n\r Read Sector 1: OK");
CaptainR 15:86bdf382e6f7 86 else puts("\n\r Read Sector 1: FAIL");
CaptainR 15:86bdf382e6f7 87 if (media_RdSector()) puts("\n\r Read Sector 2: OK");
CaptainR 15:86bdf382e6f7 88 else puts("\n\r Read Sector 2: FAIL");
CaptainR 15:86bdf382e6f7 89 if (media_RdSector()) puts("\n\r Read Sector 3: OK");
CaptainR 15:86bdf382e6f7 90 else puts("\n\r Read Sector 3: FAIL");
CaptainR 15:86bdf382e6f7 91 if (media_RdSector()) puts("\n\r Read Sector 4: OK");
CaptainR 15:86bdf382e6f7 92 else puts("\n\r Read Sector 4: FAIL");
CaptainR 15:86bdf382e6f7 93 if (media_RdSector()) puts("\n\r Read Sector 5: OK");
CaptainR 15:86bdf382e6f7 94 else puts("\n\r Read Sector 5: FAIL");
CaptainR 16:cb072eea16e9 95 */
CaptainR 16:cb072eea16e9 96 media_SetSector(1);
CaptainR 16:cb072eea16e9 97 puts("\n\r Now write some data in one sector");
CaptainR 16:cb072eea16e9 98 wait_ms(LONG_WAIT);
CaptainR 16:cb072eea16e9 99 if (media_WrSector("Such data Much WOW")) puts("\n\r Write Data: OK");
CaptainR 16:cb072eea16e9 100 else puts("\n\r Write Data: FAIL");
CaptainR 16:cb072eea16e9 101 wait_ms(LONG_WAIT);
CaptainR 16:cb072eea16e9 102 puts("\n\r Now read the same data");
CaptainR 16:cb072eea16e9 103 media_SetSector(1);
CaptainR 16:cb072eea16e9 104 if (media_RdSector()) {
CaptainR 16:cb072eea16e9 105 puts("\n\r Read Sector : OK");
CaptainR 16:cb072eea16e9 106 pc.printf("\n\r Data: ");
CaptainR 16:cb072eea16e9 107 for(int i = 0; i < BUFFER_SIZE; i++) pc.printf("%c", buffer[i]);
CaptainR 16:cb072eea16e9 108 pc.printf("\n\r");
CaptainR 16:cb072eea16e9 109 }
CaptainR 16:cb072eea16e9 110 else puts("\n\r Read Sector : FAIL");
CaptainR 12:29f5ad896382 111
CaptainR 16:cb072eea16e9 112 puts("\n\r Now read one byte");
CaptainR 18:829f3e2c064c 113 media_SetAdd(510);
CaptainR 16:cb072eea16e9 114 if (media_ReadByte()) puts("\n\r Read Byte : OK");
CaptainR 16:cb072eea16e9 115 else puts("\n\r Read Byte : FAIL");
CaptainR 18:829f3e2c064c 116
CaptainR 18:829f3e2c064c 117 puts("\n\r Now read one word");
CaptainR 18:829f3e2c064c 118 if (media_ReadByte()) puts("\n\r Read word : OK");
CaptainR 18:829f3e2c064c 119 else puts("\n\r Read word : FAIL");
CaptainR 19:a259bc128867 120
CaptainR 19:a259bc128867 121 puts("\n\r Now write one byte");
CaptainR 19:a259bc128867 122 media_SetSector(1);
CaptainR 19:a259bc128867 123 if (media_WriteByte('a')) puts("\n\r Write Byte : OK");
CaptainR 19:a259bc128867 124 else puts("\n\r Write Byte : FAIL");
CaptainR 20:88e137b9ea46 125 if (media_Flush()) puts("\n\r Flush : OK");
CaptainR 20:88e137b9ea46 126 else puts("\n\r Flush : FAIL");
CaptainR 20:88e137b9ea46 127
CaptainR 20:88e137b9ea46 128 puts("\n\r Now write one word (2 bytes)");
CaptainR 20:88e137b9ea46 129 //media_SetSector(1);
CaptainR 20:88e137b9ea46 130 if (media_WriteWord(19)) puts("\n\r Write Word : OK");
CaptainR 20:88e137b9ea46 131 else puts("\n\r Write Word : FAIL");
CaptainR 20:88e137b9ea46 132 if (media_Flush()) puts("\n\r Flush : OK");
CaptainR 20:88e137b9ea46 133 else puts("\n\r Flush : FAIL");
CaptainR 21:ea68a8a3cea4 134 wait_ms(LONG_WAIT);
CaptainR 19:a259bc128867 135
CaptainR 12:29f5ad896382 136 }
CaptainR 12:29f5ad896382 137 //**************************************************************************
CaptainR 0:a5ef6bc3c2e8 138 // Demo program that goes through graphics based functions
CaptainR 0:a5ef6bc3c2e8 139 //**************************************************************************
CaptainR 3:dcfbceb81fef 140 void PICASO_4DGL :: graphicsDemo() {
CaptainR 0:a5ef6bc3c2e8 141
CaptainR 12:29f5ad896382 142
CaptainR 12:29f5ad896382 143 cls();
CaptainR 11:3ebd2263f3e9 144 screenMode(landscape); // set orientation to landscape
CaptainR 0:a5ef6bc3c2e8 145 puts("This is the Graphics functions demo");
CaptainR 0:a5ef6bc3c2e8 146 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 147 cls();
CaptainR 12:29f5ad896382 148
CaptainR 11:3ebd2263f3e9 149 puts("\nLets change background color:");
CaptainR 11:3ebd2263f3e9 150 bgColor(Purple);
CaptainR 11:3ebd2263f3e9 151 cls();
CaptainR 11:3ebd2263f3e9 152 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 153 bgColor(White);
CaptainR 11:3ebd2263f3e9 154 cls();
CaptainR 11:3ebd2263f3e9 155 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 156 bgColor(Blue);
CaptainR 11:3ebd2263f3e9 157 cls();
CaptainR 11:3ebd2263f3e9 158 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 159 bgColor(Red);
CaptainR 11:3ebd2263f3e9 160 cls();
CaptainR 11:3ebd2263f3e9 161 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 162 bgColor(Aqua);
CaptainR 11:3ebd2263f3e9 163 cls();
CaptainR 11:3ebd2263f3e9 164 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 165 bgColor(Black);
CaptainR 11:3ebd2263f3e9 166 cls();
CaptainR 12:29f5ad896382 167 wait_ms(LONG_WAIT);
CaptainR 12:29f5ad896382 168
CaptainR 11:3ebd2263f3e9 169 puts("\nLets change contrast");
CaptainR 11:3ebd2263f3e9 170 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 171 contrast(DISABLE);
CaptainR 12:29f5ad896382 172 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 173 contrast(ENABLE);
CaptainR 12:29f5ad896382 174 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 175 cls();
CaptainR 12:29f5ad896382 176
CaptainR 11:3ebd2263f3e9 177 puts("\nLets change outline color ");
CaptainR 11:3ebd2263f3e9 178 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 179 drawFilledCircle(50, 50, 20, Red);
CaptainR 11:3ebd2263f3e9 180 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 181 outlineColor(White);
CaptainR 11:3ebd2263f3e9 182 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 183 drawFilledCircle(100, 50, 20, Red);
CaptainR 11:3ebd2263f3e9 184 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 185 cls();
CaptainR 12:29f5ad896382 186
CaptainR 0:a5ef6bc3c2e8 187 puts("\nLets change all the ");
CaptainR 2:81eaaa491a02 188 textFgColor(Purple);
CaptainR 0:a5ef6bc3c2e8 189 puts("PURPLE");
CaptainR 2:81eaaa491a02 190 textFgColor(Yellow);
CaptainR 0:a5ef6bc3c2e8 191 puts(" bits to yellow");
CaptainR 3:dcfbceb81fef 192 textFgColor(Green); // set Color back to green
CaptainR 0:a5ef6bc3c2e8 193 wait_ms(LONG_WAIT);
CaptainR 2:81eaaa491a02 194 changeColor(Purple, Yellow);
CaptainR 0:a5ef6bc3c2e8 195 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 196 cls();
CaptainR 12:29f5ad896382 197
CaptainR 0:a5ef6bc3c2e8 198 puts("Lets draw some shapes:");
CaptainR 3:dcfbceb81fef 199 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 200 drawCircle(100, 100, 20, Aqua);
CaptainR 3:dcfbceb81fef 201 wait_ms(SHORT_WAIT);
CaptainR 3:dcfbceb81fef 202 drawFilledCircle(50, 50, 20, Red);
CaptainR 3:dcfbceb81fef 203 wait_ms(SHORT_WAIT);
CaptainR 3:dcfbceb81fef 204 drawLine(20, 20, 100, 30, Blue);
CaptainR 3:dcfbceb81fef 205 wait_ms(SHORT_WAIT);
CaptainR 3:dcfbceb81fef 206 drawRectangle(120, 20, 200, 60, Pink);
CaptainR 3:dcfbceb81fef 207 wait_ms(SHORT_WAIT);
CaptainR 3:dcfbceb81fef 208 drawFilledRectangle(210, 0, 250, 80, Orange);
CaptainR 3:dcfbceb81fef 209 wait_ms(SHORT_WAIT);
CaptainR 3:dcfbceb81fef 210 short xPolyline[3] = {10, 80, 180};
CaptainR 3:dcfbceb81fef 211 short yPolyline[3] = {10, 200, 80};
CaptainR 3:dcfbceb81fef 212 drawPolyline(3, xPolyline, yPolyline, Green);
CaptainR 3:dcfbceb81fef 213 wait_ms(SHORT_WAIT);
CaptainR 3:dcfbceb81fef 214 short xPolygon[5] = {0, 30, 5, 50, 40};
CaptainR 3:dcfbceb81fef 215 short yPolygon[5] = {50, 100, 220, 230, 170};
CaptainR 3:dcfbceb81fef 216 drawPolygon(5, xPolygon, yPolygon, Grey);
CaptainR 3:dcfbceb81fef 217 wait_ms(SHORT_WAIT);
CaptainR 3:dcfbceb81fef 218 short xFilledPolygon[5] = {260, 280, 290, 300, 255};
CaptainR 3:dcfbceb81fef 219 short yFilledPolygon[5] = {0, 20, 35, 55, 22};
CaptainR 3:dcfbceb81fef 220 drawFilledPolygon(5, xFilledPolygon, yFilledPolygon, White);
CaptainR 3:dcfbceb81fef 221 wait_ms(SHORT_WAIT);
CaptainR 3:dcfbceb81fef 222 drawTriangle(70, 130, 90, 150, 110, 120, Cream);
CaptainR 3:dcfbceb81fef 223 wait_ms(SHORT_WAIT);
CaptainR 3:dcfbceb81fef 224 drawFilledTriangle(260, 50, 300, 90, 240, 120, Yellow);
CaptainR 3:dcfbceb81fef 225 wait_ms(SHORT_WAIT);
CaptainR 10:b959bb206e6b 226 drawElipse(200, 130, 20, 10, Olive);
CaptainR 10:b959bb206e6b 227 wait_ms(SHORT_WAIT);
CaptainR 10:b959bb206e6b 228 drawFilledElipse(200, 100, 30, 20, Navy);
CaptainR 12:29f5ad896382 229 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 230 linePatern(10);
CaptainR 11:3ebd2263f3e9 231 drawLine(200, 200, 100, 300, White);
CaptainR 11:3ebd2263f3e9 232 wait_ms(LONG_WAIT);
CaptainR 4:50511ed54ab4 233 cls();
CaptainR 12:29f5ad896382 234
CaptainR 6:a1a85f2bc04b 235 /*
CaptainR 6:a1a85f2bc04b 236 // somehow after this function display stops (but the calculation is right)
CaptainR 4:50511ed54ab4 237 puts("Lets calculate distance from point 0,0 on angle 40, 60 pixels away:");
CaptainR 4:50511ed54ab4 238 wait_ms(LONG_WAIT);
CaptainR 4:50511ed54ab4 239 cls();
CaptainR 4:50511ed54ab4 240 calculateOrbit(40, 60);
CaptainR 6:a1a85f2bc04b 241 wait_ms(SHORT_WAIT);
CaptainR 6:a1a85f2bc04b 242 cls();
CaptainR 6:a1a85f2bc04b 243 */
CaptainR 12:29f5ad896382 244
CaptainR 6:a1a85f2bc04b 245 puts("Lets draw some pixels:");
CaptainR 6:a1a85f2bc04b 246 wait_ms(LONG_WAIT);
CaptainR 12:29f5ad896382 247 cls();
CaptainR 12:29f5ad896382 248 for (int i = 0; i <= 10; i++) {
CaptainR 12:29f5ad896382 249 for (int j = 0; j <= 10; j++) {
CaptainR 12:29f5ad896382 250 putPixel(i, j, Red);
CaptainR 12:29f5ad896382 251 }
CaptainR 12:29f5ad896382 252 }
CaptainR 6:a1a85f2bc04b 253 wait_ms(LONG_WAIT);
CaptainR 6:a1a85f2bc04b 254 cls();
CaptainR 12:29f5ad896382 255
CaptainR 7:f064ae670553 256 puts("Lets move origin point:");
CaptainR 7:f064ae670553 257 wait_ms(LONG_WAIT);
CaptainR 7:f064ae670553 258 moveOrigin(100, 100);
CaptainR 7:f064ae670553 259 puts("This is the new origin!");
CaptainR 8:b634ac9c92f8 260 wait_ms(LONG_WAIT);
CaptainR 8:b634ac9c92f8 261 cls();
CaptainR 12:29f5ad896382 262
CaptainR 8:b634ac9c92f8 263 puts("Now draw line from here:");
CaptainR 8:b634ac9c92f8 264 wait_ms(SHORT_WAIT);
CaptainR 8:b634ac9c92f8 265 lineTo(100, 100);
CaptainR 12:29f5ad896382 266 wait_ms(LONG_WAIT);
CaptainR 8:b634ac9c92f8 267 puts("To here!");
CaptainR 8:b634ac9c92f8 268 wait_ms(LONG_WAIT);
CaptainR 9:32eb75c01e9d 269 cls();
CaptainR 12:29f5ad896382 270
CaptainR 9:32eb75c01e9d 271 puts("Change clipping window, to test it, we use changeColor function, that works only in clipping area:");
CaptainR 9:32eb75c01e9d 272 wait_ms(LONG_WAIT);
CaptainR 12:29f5ad896382 273 wait_ms(LONG_WAIT);
CaptainR 9:32eb75c01e9d 274 setClipWindow(0, 0, 200, 20);
CaptainR 9:32eb75c01e9d 275 changeColor(Green, Red);
CaptainR 9:32eb75c01e9d 276 puts("\n\n\rDone!!!!");
CaptainR 9:32eb75c01e9d 277 wait_ms(LONG_WAIT);
CaptainR 9:32eb75c01e9d 278 puts("\n\n\rNow extend to here!");
CaptainR 12:29f5ad896382 279 wait_ms(LONG_WAIT);
CaptainR 9:32eb75c01e9d 280 extendClipRegion();
CaptainR 9:32eb75c01e9d 281 changeColor(Green, Red);
CaptainR 9:32eb75c01e9d 282 puts("\n\n\rHow does it look?");
CaptainR 9:32eb75c01e9d 283 wait_ms(LONG_WAIT);
CaptainR 10:b959bb206e6b 284 cls();
CaptainR 12:29f5ad896382 285
CaptainR 10:b959bb206e6b 286 puts("\nLets place a button:");
CaptainR 10:b959bb206e6b 287 wait_ms(LONG_WAIT);
CaptainR 10:b959bb206e6b 288 cls();
CaptainR 12:29f5ad896382 289 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 10:b959bb206e6b 290 puts("\n\n\n\nDid it work?");
CaptainR 10:b959bb206e6b 291 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 292 cls();
CaptainR 12:29f5ad896382 293
CaptainR 11:3ebd2263f3e9 294 puts("\nNow lets change bevel width");
CaptainR 11:3ebd2263f3e9 295 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 296 if (bevelWidth(0)) {
CaptainR 11:3ebd2263f3e9 297 puts("\nNo bevel");
CaptainR 12:29f5ad896382 298 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 299 }
CaptainR 12:29f5ad896382 300 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 301 cls();
CaptainR 11:3ebd2263f3e9 302 if (bevelWidth(1)) {
CaptainR 11:3ebd2263f3e9 303 puts("\nbevel 1");
CaptainR 12:29f5ad896382 304 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 305 }
CaptainR 12:29f5ad896382 306 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 307 cls();
CaptainR 11:3ebd2263f3e9 308 if (bevelWidth(10)) {
CaptainR 11:3ebd2263f3e9 309 puts("\nbevel 10");
CaptainR 12:29f5ad896382 310 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 311 }
CaptainR 12:29f5ad896382 312 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 313 cls();
CaptainR 11:3ebd2263f3e9 314 if (bevelWidth(16)) {
CaptainR 11:3ebd2263f3e9 315 puts("\nbevel 16");
CaptainR 12:29f5ad896382 316 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 317 }
CaptainR 12:29f5ad896382 318 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 319 cls();
CaptainR 11:3ebd2263f3e9 320 if (bevelWidth(2)) {
CaptainR 11:3ebd2263f3e9 321 puts("\nbevel 2");
CaptainR 12:29f5ad896382 322 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 323 }
CaptainR 12:29f5ad896382 324 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 325 cls();
CaptainR 12:29f5ad896382 326
CaptainR 10:b959bb206e6b 327 puts("\nNow lets change bevel shadow level");
CaptainR 10:b959bb206e6b 328 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 329 if (bevelShadow(0)) {
CaptainR 11:3ebd2263f3e9 330 puts("\nNo shadow");
CaptainR 12:29f5ad896382 331 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 332 }
CaptainR 10:b959bb206e6b 333 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 334 if (bevelShadow(1)) {
CaptainR 11:3ebd2263f3e9 335 puts("\nShadow 1");
CaptainR 12:29f5ad896382 336 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 337 }
CaptainR 10:b959bb206e6b 338 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 339 if (bevelShadow(2)) {
CaptainR 11:3ebd2263f3e9 340 puts("\nShadow 2");
CaptainR 12:29f5ad896382 341 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 342 }
CaptainR 10:b959bb206e6b 343 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 344 if (bevelShadow(3)) {
CaptainR 11:3ebd2263f3e9 345 puts("\nShadow 3");
CaptainR 12:29f5ad896382 346 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 347 }
CaptainR 11:3ebd2263f3e9 348 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 349 if (bevelShadow(4)) {
CaptainR 11:3ebd2263f3e9 350 puts("\nShadow 4");
CaptainR 12:29f5ad896382 351 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 352 }
CaptainR 10:b959bb206e6b 353 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 354 if (bevelShadow(5)) {
CaptainR 11:3ebd2263f3e9 355 puts("\nShadow 5");
CaptainR 12:29f5ad896382 356 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 357 }
CaptainR 10:b959bb206e6b 358 wait_ms(SHORT_WAIT);
CaptainR 11:3ebd2263f3e9 359 if (bevelShadow(1)) {
CaptainR 11:3ebd2263f3e9 360 puts("\nShadow 1");
CaptainR 12:29f5ad896382 361 drawButton(DEPRESSED, 100, 100, Aqua, Violet, 2, 2, 2, "Press Me");
CaptainR 11:3ebd2263f3e9 362 }
CaptainR 12:29f5ad896382 363 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 364 cls();
CaptainR 12:29f5ad896382 365
CaptainR 10:b959bb206e6b 366 puts("\nLets place a panel:");
CaptainR 10:b959bb206e6b 367 wait_ms(LONG_WAIT);
CaptainR 10:b959bb206e6b 368 cls();
CaptainR 12:29f5ad896382 369 drawPanel(RECESSED, 0, 0, 200, 20, Cream);
CaptainR 12:29f5ad896382 370 wait_ms(SHORT_WAIT);
CaptainR 10:b959bb206e6b 371 puts("\nDid it work?");
CaptainR 10:b959bb206e6b 372 wait_ms(LONG_WAIT);
CaptainR 10:b959bb206e6b 373 cls();
CaptainR 12:29f5ad896382 374
CaptainR 10:b959bb206e6b 375 puts("\nLets place a slider:");
CaptainR 10:b959bb206e6b 376 wait_ms(LONG_WAIT);
CaptainR 10:b959bb206e6b 377 cls();
CaptainR 10:b959bb206e6b 378 drawSlider(RAISED, 30, 40, 210, 90, Violet, 100, 0);
CaptainR 10:b959bb206e6b 379 puts("\nDid it work?");
CaptainR 10:b959bb206e6b 380 wait_ms(LONG_WAIT);
CaptainR 10:b959bb206e6b 381 cls();
CaptainR 12:29f5ad896382 382
CaptainR 10:b959bb206e6b 383 puts("\nThis particular function is going to copy a specified portion of the creen and paste it somewhere else!");
CaptainR 10:b959bb206e6b 384 wait_ms(LONG_WAIT);
CaptainR 10:b959bb206e6b 385 wait_ms(LONG_WAIT);
CaptainR 12:29f5ad896382 386 wait_ms(LONG_WAIT);
CaptainR 10:b959bb206e6b 387 //cls();
CaptainR 10:b959bb206e6b 388 screenCopyPaste(0, 0, 50, 100, 200, 50);
CaptainR 10:b959bb206e6b 389 puts("\nDid it work?");
CaptainR 10:b959bb206e6b 390 wait_ms(LONG_WAIT);
CaptainR 10:b959bb206e6b 391 cls();
CaptainR 12:29f5ad896382 392
CaptainR 11:3ebd2263f3e9 393 puts("\nLets get Xmax:");
CaptainR 11:3ebd2263f3e9 394 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 395 short Xmax = getGraphics(currentXMax);
CaptainR 11:3ebd2263f3e9 396 puts("\nLets get Ymax:");
CaptainR 11:3ebd2263f3e9 397 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 398 short Ymax = getGraphics(currentYMax);
CaptainR 11:3ebd2263f3e9 399 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 400 pc.printf("\nCurrent orientation xMax = %i, yMax = %i\n\r", Xmax, Ymax);
CaptainR 12:29f5ad896382 401 cls();
CaptainR 21:ea68a8a3cea4 402 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 403 }
CaptainR 0:a5ef6bc3c2e8 404
CaptainR 0:a5ef6bc3c2e8 405 //**************************************************************************
CaptainR 0:a5ef6bc3c2e8 406 // Demo program that goes through main functions
CaptainR 0:a5ef6bc3c2e8 407 //**************************************************************************
CaptainR 3:dcfbceb81fef 408 void PICASO_4DGL :: mainDemo() {
CaptainR 0:a5ef6bc3c2e8 409
CaptainR 0:a5ef6bc3c2e8 410 cls();
CaptainR 0:a5ef6bc3c2e8 411 puts("This is the main functions demo");
CaptainR 0:a5ef6bc3c2e8 412 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 413 cls();
CaptainR 12:29f5ad896382 414 /*
CaptainR 0:a5ef6bc3c2e8 415 puts("\nBaudrates:");
CaptainR 0:a5ef6bc3c2e8 416 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 417 cls();
CaptainR 12:29f5ad896382 418
CaptainR 0:a5ef6bc3c2e8 419 baudrate(4800);
CaptainR 0:a5ef6bc3c2e8 420 puts("\n4800");
CaptainR 0:a5ef6bc3c2e8 421 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 422 cls();
CaptainR 0:a5ef6bc3c2e8 423 baudrate(9600);
CaptainR 0:a5ef6bc3c2e8 424 puts("\n9600");
CaptainR 0:a5ef6bc3c2e8 425 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 426 cls();
CaptainR 0:a5ef6bc3c2e8 427 baudrate(14400);
CaptainR 0:a5ef6bc3c2e8 428 puts("\n14400");
CaptainR 0:a5ef6bc3c2e8 429 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 430 cls();
CaptainR 0:a5ef6bc3c2e8 431 baudrate(19200);
CaptainR 0:a5ef6bc3c2e8 432 puts("\n19200");
CaptainR 0:a5ef6bc3c2e8 433 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 434 cls();
CaptainR 0:a5ef6bc3c2e8 435 baudrate(38400);
CaptainR 0:a5ef6bc3c2e8 436 puts("\n38400");
CaptainR 0:a5ef6bc3c2e8 437 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 438 cls();
CaptainR 0:a5ef6bc3c2e8 439 baudrate(56000);
CaptainR 0:a5ef6bc3c2e8 440 puts("\n56000");
CaptainR 0:a5ef6bc3c2e8 441 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 442 cls();
CaptainR 0:a5ef6bc3c2e8 443 baudrate(57600);
CaptainR 0:a5ef6bc3c2e8 444 puts("\n57600");
CaptainR 0:a5ef6bc3c2e8 445 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 446 cls();
CaptainR 12:29f5ad896382 447 baudrate(9600);
CaptainR 12:29f5ad896382 448 puts("\n9600");
CaptainR 2:81eaaa491a02 449 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 450 cls();
CaptainR 12:29f5ad896382 451 */
CaptainR 0:a5ef6bc3c2e8 452 puts("\nOrientation:");
CaptainR 0:a5ef6bc3c2e8 453 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 454 cls();
CaptainR 11:3ebd2263f3e9 455 screenMode(landscape);
CaptainR 0:a5ef6bc3c2e8 456 puts("landscape");
CaptainR 0:a5ef6bc3c2e8 457 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 458 cls();
CaptainR 11:3ebd2263f3e9 459 screenMode(landscapeRew);
CaptainR 0:a5ef6bc3c2e8 460 puts("landscape rewersed");
CaptainR 0:a5ef6bc3c2e8 461 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 462 cls();
CaptainR 11:3ebd2263f3e9 463 screenMode(portrait);
CaptainR 0:a5ef6bc3c2e8 464 puts("portrait");
CaptainR 0:a5ef6bc3c2e8 465 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 466 cls();
CaptainR 11:3ebd2263f3e9 467 screenMode(portraitRew);
CaptainR 0:a5ef6bc3c2e8 468 puts("portrait rewersed");
CaptainR 0:a5ef6bc3c2e8 469 wait_ms(LONG_WAIT);
CaptainR 11:3ebd2263f3e9 470 screenMode(landscape); // set back screen to landscape
CaptainR 0:a5ef6bc3c2e8 471 cls();
CaptainR 0:a5ef6bc3c2e8 472
CaptainR 0:a5ef6bc3c2e8 473 }
CaptainR 0:a5ef6bc3c2e8 474
CaptainR 0:a5ef6bc3c2e8 475 //**************************************************************************
CaptainR 0:a5ef6bc3c2e8 476 // Demo program that goes through text based functions
CaptainR 0:a5ef6bc3c2e8 477 //**************************************************************************
CaptainR 3:dcfbceb81fef 478 void PICASO_4DGL :: textDemo() {
CaptainR 0:a5ef6bc3c2e8 479
CaptainR 0:a5ef6bc3c2e8 480 cls();
CaptainR 11:3ebd2263f3e9 481 screenMode(landscape); // set screen to landscape
CaptainR 0:a5ef6bc3c2e8 482 puts("This is the Text functions demo");
CaptainR 0:a5ef6bc3c2e8 483 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 484 cls();
CaptainR 0:a5ef6bc3c2e8 485
CaptainR 0:a5ef6bc3c2e8 486 puts("\nText attributes:");
CaptainR 0:a5ef6bc3c2e8 487 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 488 //cls();
CaptainR 0:a5ef6bc3c2e8 489 puts("\n\n");
CaptainR 2:81eaaa491a02 490 textAttributes(bold);
CaptainR 0:a5ef6bc3c2e8 491 puts("\nBOLD");
CaptainR 0:a5ef6bc3c2e8 492 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 493 textAttributes(bold + italic);
CaptainR 0:a5ef6bc3c2e8 494 puts("\nBOLD & ITALIC");
CaptainR 0:a5ef6bc3c2e8 495 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 496 textAttributes(bold + italic + inverse);
CaptainR 0:a5ef6bc3c2e8 497 puts("\nBOLD & ITALIC & INVERSE");
CaptainR 0:a5ef6bc3c2e8 498 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 499 textAttributes(bold + italic + inverse + underline);
CaptainR 0:a5ef6bc3c2e8 500 puts("\nBOLD & ITALIC & INVERSE & UNDERLINE");
CaptainR 0:a5ef6bc3c2e8 501 wait_ms(LONG_WAIT);
CaptainR 2:81eaaa491a02 502 textAttributes(DISABLE); // set everything back to normal
CaptainR 0:a5ef6bc3c2e8 503 cls();
CaptainR 0:a5ef6bc3c2e8 504
CaptainR 0:a5ef6bc3c2e8 505 puts("\nText modes:");
CaptainR 0:a5ef6bc3c2e8 506 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 507 cls();
CaptainR 2:81eaaa491a02 508 textBold(ENABLE);
CaptainR 0:a5ef6bc3c2e8 509 puts("\nBOLD:");
CaptainR 0:a5ef6bc3c2e8 510 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 511 textBold(DISABLE);
CaptainR 2:81eaaa491a02 512 textInverse(ENABLE);
CaptainR 0:a5ef6bc3c2e8 513 puts("\nINVERSE:");
CaptainR 0:a5ef6bc3c2e8 514 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 515 textInverse(DISABLE);
CaptainR 2:81eaaa491a02 516 textItalic(ENABLE);
CaptainR 0:a5ef6bc3c2e8 517 puts("\nITALIC:");
CaptainR 0:a5ef6bc3c2e8 518 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 519 textItalic(DISABLE);
CaptainR 2:81eaaa491a02 520 textUnderline(ENABLE);
CaptainR 0:a5ef6bc3c2e8 521 puts("\nUNDERLINE:");
CaptainR 0:a5ef6bc3c2e8 522 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 523 textUnderline(DISABLE);
CaptainR 0:a5ef6bc3c2e8 524 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 525 cls();
CaptainR 0:a5ef6bc3c2e8 526
CaptainR 0:a5ef6bc3c2e8 527 puts("\nText gaps:");
CaptainR 0:a5ef6bc3c2e8 528 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 529 cls();
CaptainR 0:a5ef6bc3c2e8 530 if (textXGap(0) == 1) puts("\nX gap: 0");
CaptainR 0:a5ef6bc3c2e8 531 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 532 if (textXGap(1) == 1) puts("\nX gap: 1");
CaptainR 0:a5ef6bc3c2e8 533 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 534 if (textXGap(2) == 1) puts("\nX gap: 2");
CaptainR 0:a5ef6bc3c2e8 535 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 536 if (textXGap(3) == 1) puts("\nX gap: 3");
CaptainR 0:a5ef6bc3c2e8 537 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 538 if (textXGap(4) == 1) puts("\nX gap: 4");
CaptainR 0:a5ef6bc3c2e8 539 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 540 if (textXGap(5) == 1) puts("\nX gap: 5");
CaptainR 0:a5ef6bc3c2e8 541 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 542 if (textXGap(6) == 1) puts("\nX gap: 6");
CaptainR 0:a5ef6bc3c2e8 543 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 544 puts("\n");
CaptainR 0:a5ef6bc3c2e8 545 textXGap(0);
CaptainR 0:a5ef6bc3c2e8 546 if (textYGap(0) == 1) puts("\nY gap: 0");
CaptainR 0:a5ef6bc3c2e8 547 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 548 if (textYGap(1) == 1) puts("\nY gap: 1");
CaptainR 0:a5ef6bc3c2e8 549 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 550 if (textYGap(2) == 1) puts("\nY gap: 2");
CaptainR 0:a5ef6bc3c2e8 551 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 552 if (textYGap(3) == 1) puts("\nY gap: 3");
CaptainR 0:a5ef6bc3c2e8 553 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 554 if (textYGap(4) == 1) puts("\nY gap: 4");
CaptainR 0:a5ef6bc3c2e8 555 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 556 if (textYGap(5) == 1) puts("\nY gap: 5");
CaptainR 0:a5ef6bc3c2e8 557 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 558 if (textYGap(6) == 1) puts("\nY gap: 6");
CaptainR 0:a5ef6bc3c2e8 559 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 560 textYGap(0);
CaptainR 0:a5ef6bc3c2e8 561 cls();
CaptainR 0:a5ef6bc3c2e8 562
CaptainR 0:a5ef6bc3c2e8 563 puts("Text width:");
CaptainR 0:a5ef6bc3c2e8 564 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 565 if (textWidth(1) == 1) puts("\nWidth: 1");
CaptainR 0:a5ef6bc3c2e8 566 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 567 if (textWidth(2) == 1) puts("\nWidth: 2");
CaptainR 0:a5ef6bc3c2e8 568 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 569 if (textWidth(3) == 1) puts("\nWidth: 3");
CaptainR 0:a5ef6bc3c2e8 570 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 571 if (textWidth(4) == 1) puts("\nWidth: 4");
CaptainR 0:a5ef6bc3c2e8 572 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 573 textWidth(1);
CaptainR 0:a5ef6bc3c2e8 574 puts("\nText height:");
CaptainR 0:a5ef6bc3c2e8 575 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 576 //cls();
CaptainR 0:a5ef6bc3c2e8 577 if (textHeight(1) == 1) puts("\nHeight: 1");
CaptainR 0:a5ef6bc3c2e8 578 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 579 if (textHeight(2) == 1) puts("\nHeight: 2");
CaptainR 0:a5ef6bc3c2e8 580 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 581 if (textHeight(3) == 1) puts("\nHeight: 3");
CaptainR 0:a5ef6bc3c2e8 582 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 583 if (textHeight(4) == 1) puts("\nHeight: 4");
CaptainR 0:a5ef6bc3c2e8 584 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 585 textHeight(1);
CaptainR 0:a5ef6bc3c2e8 586 cls();
CaptainR 2:81eaaa491a02 587
CaptainR 0:a5ef6bc3c2e8 588 puts("Fonts:");
CaptainR 0:a5ef6bc3c2e8 589 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 590 cls();
CaptainR 2:81eaaa491a02 591 setFont(font1);
CaptainR 0:a5ef6bc3c2e8 592 puts("\nThis is Font 1");
CaptainR 0:a5ef6bc3c2e8 593 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 594 setFont(font2);
CaptainR 0:a5ef6bc3c2e8 595 puts("\nThis is Font 2");
CaptainR 0:a5ef6bc3c2e8 596 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 597 setFont(font3);
CaptainR 0:a5ef6bc3c2e8 598 puts("\nThis is Font 3");
CaptainR 0:a5ef6bc3c2e8 599 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 600 cls();
CaptainR 0:a5ef6bc3c2e8 601
CaptainR 2:81eaaa491a02 602
CaptainR 11:3ebd2263f3e9 603 screenMode(portrait);
CaptainR 0:a5ef6bc3c2e8 604 puts("\nText Background colors:");
CaptainR 0:a5ef6bc3c2e8 605 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 606 cls();
CaptainR 2:81eaaa491a02 607 textBgColor(Black);
CaptainR 3:dcfbceb81fef 608 puts("\nBG Color = BLACK");
CaptainR 0:a5ef6bc3c2e8 609 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 610 textBgColor(Navy);
CaptainR 3:dcfbceb81fef 611 puts("\nBG Color = NAVY");
CaptainR 0:a5ef6bc3c2e8 612 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 613 textFgColor(Black);
CaptainR 2:81eaaa491a02 614 textBgColor(DGreen);
CaptainR 3:dcfbceb81fef 615 puts("\nBG Color = DARK GREEN");
CaptainR 0:a5ef6bc3c2e8 616 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 617 textBgColor(DCyan);
CaptainR 3:dcfbceb81fef 618 puts("\nBG Color = DARK CYAN");
CaptainR 0:a5ef6bc3c2e8 619 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 620 textBgColor(Purple);
CaptainR 3:dcfbceb81fef 621 puts("\nBG Color = PURPLE");
CaptainR 0:a5ef6bc3c2e8 622 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 623 textBgColor(Olive);
CaptainR 3:dcfbceb81fef 624 puts("\nBG Color = OLIVE");
CaptainR 0:a5ef6bc3c2e8 625 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 626 textBgColor(Grey);
CaptainR 3:dcfbceb81fef 627 puts("\nBG Color = GREY");
CaptainR 0:a5ef6bc3c2e8 628 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 629 textBgColor(Blue);
CaptainR 3:dcfbceb81fef 630 puts("\nBG Color = BLUE");
CaptainR 0:a5ef6bc3c2e8 631 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 632 textBgColor(Green);
CaptainR 3:dcfbceb81fef 633 puts("\nBG Color = GREEN");
CaptainR 0:a5ef6bc3c2e8 634 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 635 textBgColor(Red);
CaptainR 3:dcfbceb81fef 636 puts("\nBG Color = RED");
CaptainR 0:a5ef6bc3c2e8 637 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 638 textBgColor(Yellow);
CaptainR 3:dcfbceb81fef 639 puts("\nBG Color = YELLOW");
CaptainR 0:a5ef6bc3c2e8 640 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 641 textBgColor(GYellow);
CaptainR 3:dcfbceb81fef 642 puts("\nBG Color = GREEN YELLOW");
CaptainR 0:a5ef6bc3c2e8 643 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 644 textBgColor(White);
CaptainR 3:dcfbceb81fef 645 puts("\nBG Color = WHITE");
CaptainR 0:a5ef6bc3c2e8 646 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 647 textBgColor(Orange);
CaptainR 3:dcfbceb81fef 648 puts("\nBG Color = ORANGE");
CaptainR 0:a5ef6bc3c2e8 649 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 650 textBgColor(Pink);
CaptainR 3:dcfbceb81fef 651 puts("\nBG Color = PINK");
CaptainR 0:a5ef6bc3c2e8 652 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 653 textBgColor(Violet);
CaptainR 3:dcfbceb81fef 654 puts("\nBG Color = VIOLET");
CaptainR 0:a5ef6bc3c2e8 655 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 656 textBgColor(Aqua);
CaptainR 3:dcfbceb81fef 657 puts("\nBG Color = AQUA");
CaptainR 0:a5ef6bc3c2e8 658 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 659 textBgColor(Cream);
CaptainR 3:dcfbceb81fef 660 puts("\nBG Color = CREAM");
CaptainR 0:a5ef6bc3c2e8 661 wait_ms(LONG_WAIT);
CaptainR 3:dcfbceb81fef 662 textBgColor(Black); // set Color back
CaptainR 3:dcfbceb81fef 663 textFgColor(Green); // set Color back
CaptainR 0:a5ef6bc3c2e8 664 cls();
CaptainR 0:a5ef6bc3c2e8 665
CaptainR 12:29f5ad896382 666 screenMode(landscape);
CaptainR 0:a5ef6bc3c2e8 667 puts("Lets try moving cursor...");
CaptainR 0:a5ef6bc3c2e8 668 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 669 cls();
CaptainR 0:a5ef6bc3c2e8 670 if (moveCursor(5, 5) == 1) puts("+");
CaptainR 0:a5ef6bc3c2e8 671 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 672 if (moveCursor(10, 10) == 1) puts("+");
CaptainR 0:a5ef6bc3c2e8 673 wait_ms(SHORT_WAIT);
CaptainR 12:29f5ad896382 674 screenMode(portraitRew);
CaptainR 0:a5ef6bc3c2e8 675 if (moveCursor(50, 50) == 1) puts("+");
CaptainR 0:a5ef6bc3c2e8 676 wait_ms(SHORT_WAIT);
CaptainR 0:a5ef6bc3c2e8 677 if (moveCursor(19, 29) == 1) puts("+");
CaptainR 0:a5ef6bc3c2e8 678 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 679 cls();
CaptainR 0:a5ef6bc3c2e8 680
CaptainR 0:a5ef6bc3c2e8 681
CaptainR 11:3ebd2263f3e9 682 screenMode(portrait);
CaptainR 3:dcfbceb81fef 683 puts("\nText Foreground Colors:");
CaptainR 0:a5ef6bc3c2e8 684 wait_ms(LONG_WAIT);
CaptainR 0:a5ef6bc3c2e8 685 cls();
CaptainR 2:81eaaa491a02 686 textBgColor(White);
CaptainR 2:81eaaa491a02 687 textFgColor(Black);
CaptainR 3:dcfbceb81fef 688 puts("\nFG Color = BLACK");
CaptainR 2:81eaaa491a02 689 textBgColor(Black);
CaptainR 0:a5ef6bc3c2e8 690 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 691 textFgColor(Navy);
CaptainR 3:dcfbceb81fef 692 puts("\nFG Color = NAVY");
CaptainR 0:a5ef6bc3c2e8 693 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 694 textFgColor(DGreen);
CaptainR 3:dcfbceb81fef 695 puts("\nFG Color = DARK GREEN");
CaptainR 0:a5ef6bc3c2e8 696 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 697 textFgColor(DCyan);
CaptainR 3:dcfbceb81fef 698 puts("\nFG Color = DARK CYAN");
CaptainR 0:a5ef6bc3c2e8 699 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 700 textFgColor(Purple);
CaptainR 3:dcfbceb81fef 701 puts("\nFG Color = PURPLE");
CaptainR 0:a5ef6bc3c2e8 702 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 703 textFgColor(Olive);
CaptainR 3:dcfbceb81fef 704 puts("\nFG Color = OLIVE");
CaptainR 0:a5ef6bc3c2e8 705 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 706 textFgColor(Grey);
CaptainR 3:dcfbceb81fef 707 puts("\nFG Color = GREY");
CaptainR 0:a5ef6bc3c2e8 708 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 709 textFgColor(Blue);
CaptainR 3:dcfbceb81fef 710 puts("\nFG Color = BLUE");
CaptainR 0:a5ef6bc3c2e8 711 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 712 textFgColor(Green);
CaptainR 3:dcfbceb81fef 713 puts("\nFG Color = GREEN");
CaptainR 0:a5ef6bc3c2e8 714 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 715 textFgColor(Red);
CaptainR 3:dcfbceb81fef 716 puts("\nFG Color = RED");
CaptainR 0:a5ef6bc3c2e8 717 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 718 textFgColor(Yellow);
CaptainR 3:dcfbceb81fef 719 puts("\nFG Color = YELLOW");
CaptainR 0:a5ef6bc3c2e8 720 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 721 textFgColor(GYellow);
CaptainR 3:dcfbceb81fef 722 puts("\nFG Color = GREEN YELLOW");
CaptainR 0:a5ef6bc3c2e8 723 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 724 textFgColor(White);
CaptainR 3:dcfbceb81fef 725 puts("\nFG Color = WHITE");
CaptainR 0:a5ef6bc3c2e8 726 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 727 textFgColor(Orange);
CaptainR 3:dcfbceb81fef 728 puts("\nFG Color = ORANGE");
CaptainR 0:a5ef6bc3c2e8 729 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 730 textFgColor(Pink);
CaptainR 3:dcfbceb81fef 731 puts("\nFG Color = PINK");
CaptainR 0:a5ef6bc3c2e8 732 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 733 textFgColor(Violet);
CaptainR 3:dcfbceb81fef 734 puts("\nFG Color = VIOLET");
CaptainR 0:a5ef6bc3c2e8 735 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 736 textFgColor(Aqua);
CaptainR 3:dcfbceb81fef 737 puts("\nFG Color = AQUA");
CaptainR 0:a5ef6bc3c2e8 738 wait_ms(SHORT_WAIT);
CaptainR 2:81eaaa491a02 739 textFgColor(Cream);
CaptainR 3:dcfbceb81fef 740 puts("\nFG Color = CREAM");
CaptainR 2:81eaaa491a02 741 wait_ms(LONG_WAIT);
CaptainR 3:dcfbceb81fef 742 textFgColor(Green); // set Color back
CaptainR 21:ea68a8a3cea4 743 wait_ms(LONG_WAIT);
CaptainR 2:81eaaa491a02 744
CaptainR 2:81eaaa491a02 745
CaptainR 22:cea582ea74c1 746 }
CaptainR 22:cea582ea74c1 747
CaptainR 22:cea582ea74c1 748 void clearBuf(char *str) {
CaptainR 22:cea582ea74c1 749 int i;
CaptainR 22:cea582ea74c1 750 for (i = 0; i < strlen(str); i++)
CaptainR 22:cea582ea74c1 751 str[i] = 0;
CaptainR 0:a5ef6bc3c2e8 752 }