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