Check this one ! mbos setup changed, WTX hor pos changed, no font style check, no checksum check
Dependencies: 4DGL MODSERIAL mbed mbos
Fork of CDU_Mbed_21 by
display.cpp@8:422544d24df3, 2014-07-20 (annotated)
- Committer:
- LvdK
- Date:
- Sun Jul 20 16:33:53 2014 +0000
- Revision:
- 8:422544d24df3
- Parent:
- 7:6576a287e563
- Child:
- 11:d60c746c097c
CDU_Mbed_26; - other mbos setup !; - WTX hor. pos. changed; - no fontstyle check; - no checksum check
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
LvdK | 7:6576a287e563 | 1 | //Display control functions -- |
LvdK | 7:6576a287e563 | 2 | #include "mbed.h" |
LvdK | 7:6576a287e563 | 3 | #include "TFT_4DGL.h" |
LvdK | 7:6576a287e563 | 4 | #include "display.h" |
LvdK | 8:422544d24df3 | 5 | #include <string> |
LvdK | 7:6576a287e563 | 6 | using namespace std; |
LvdK | 7:6576a287e563 | 7 | DigitalOut VGA_SOURCE( p7 ); //control line for video switch between INT and EXT video |
LvdK | 7:6576a287e563 | 8 | DigitalOut VGA_SELECT( p8 ); //control line to select/deselect video switch |
LvdK | 7:6576a287e563 | 9 | /* |
LvdK | 7:6576a287e563 | 10 | ===================================================== |
LvdK | 7:6576a287e563 | 11 | SGC (Serial Graphics Controller) PLATFORM OUTPUT FILE |
LvdK | 7:6576a287e563 | 12 | ===================================================== |
LvdK | 7:6576a287e563 | 13 | ******************************************************* |
LvdK | 7:6576a287e563 | 14 | * Must set 'New image format' for usage on Picaso SGC * |
LvdK | 7:6576a287e563 | 15 | * Data: * |
LvdK | 7:6576a287e563 | 16 | * 0x59, 0x06, 0x00 * |
LvdK | 7:6576a287e563 | 17 | * 4DSL command: * |
LvdK | 7:6576a287e563 | 18 | * Control(6,0) * |
LvdK | 7:6576a287e563 | 19 | ******************************************************* |
LvdK | 7:6576a287e563 | 20 | --------------------------------------------------------------------------------------- |
LvdK | 7:6576a287e563 | 21 | File "logo_flyengravity.jpg" (logo_flyengravity.jpg) |
LvdK | 7:6576a287e563 | 22 | Sector Address 0x000000 |
LvdK | 7:6576a287e563 | 23 | X = 0 Y = 135 Width = 640 Height = 215 Bits = 16 |
LvdK | 7:6576a287e563 | 24 | Display Image from Memory Card (Serial Command): |
LvdK | 7:6576a287e563 | 25 | Syntax: |
LvdK | 7:6576a287e563 | 26 | @, I, x, y, SectorAdd(hi), SectorAdd(mid), SectorAdd(lo) |
LvdK | 7:6576a287e563 | 27 | Picaso Data: |
LvdK | 7:6576a287e563 | 28 | 0x40, 0x49, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00 |
LvdK | 7:6576a287e563 | 29 | 4DSL command: |
LvdK | 7:6576a287e563 | 30 | NewUSDImage(0, 135, 0x000000) |
LvdK | 7:6576a287e563 | 31 | --------------------------------------------------------------------------------------- |
LvdK | 7:6576a287e563 | 32 | File "Testscreen.png" (Testscreen.png) |
LvdK | 7:6576a287e563 | 33 | Sector Address 0x00021A |
LvdK | 7:6576a287e563 | 34 | X = 0 Y = 0 Width = 640 Height = 480 Bits = 16 |
LvdK | 7:6576a287e563 | 35 | Display Image from Memory Card (Serial Command): |
LvdK | 7:6576a287e563 | 36 | Syntax: |
LvdK | 7:6576a287e563 | 37 | @, I, x, y, SectorAdd(hi), SectorAdd(mid), SectorAdd(lo) |
LvdK | 7:6576a287e563 | 38 | Picaso Data: |
LvdK | 7:6576a287e563 | 39 | 0x40, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x1A |
LvdK | 7:6576a287e563 | 40 | 4DSL command: |
LvdK | 7:6576a287e563 | 41 | NewUSDImage(0, 0, 0x00021A) |
LvdK | 7:6576a287e563 | 42 | */ |
LvdK | 7:6576a287e563 | 43 | /*Display Commands |
LvdK | 7:6576a287e563 | 44 | $PCDUCLS Erase to active background colour (default black) or white |
LvdK | 7:6576a287e563 | 45 | =================================================================== |
LvdK | 7:6576a287e563 | 46 | Syntax: $PCDUCLS, <mode>*<checksum>CRLF |
LvdK | 8:422544d24df3 | 47 | <mode>=0 : Clear screen to current background colour (default=black) |
LvdK | 8:422544d24df3 | 48 | <mode>=1 : Clear screen to white |
LvdK | 7:6576a287e563 | 49 | $PCDUSBC Set Background Color |
LvdK | 7:6576a287e563 | 50 | ==================================================================== |
LvdK | 7:6576a287e563 | 51 | Syntax: $PCDUSBC,<Rcolour>,<Gcolour>,<Bcolour>*<checksum>CRLF |
LvdK | 8:422544d24df3 | 52 | < Rcolour > : RED (000‐255) |
LvdK | 8:422544d24df3 | 53 | < Gcolour > : GREEN (000‐255) |
LvdK | 8:422544d24df3 | 54 | < Bcolour > : BLUE (000‐255) |
LvdK | 8:422544d24df3 | 55 | Set background colour to RGB as defined in the three data fields. |
LvdK | 7:6576a287e563 | 56 | $PCDUWTX WTX=WRITE TEXT Write text on any X,Y position on the screen. |
LvdK | 7:6576a287e563 | 57 | ===================================================================== |
LvdK | 7:6576a287e563 | 58 | Syntax: $PCDUWTX,<Fsize>,<Fstyle>,<Rcolour>,<Gcolour>,<Bcolour>,<Text><Col>,<Row>*<checksum>CRLF |
LvdK | 8:422544d24df3 | 59 | <Fsize> : Font size (F0..F9). Currently F0 and F1 are implemented. |
LvdK | 8:422544d24df3 | 60 | <Fstyle> : Font style (S=Standard, B=Bold, I=Italic, U=Underline, N=Negative) |
LvdK | 8:422544d24df3 | 61 | < Rcolour > : RED (000‐255) |
LvdK | 8:422544d24df3 | 62 | < Gcolour > : GREEN (000‐255) |
LvdK | 8:422544d24df3 | 63 | < Bcolour > : BLUE (000‐255) |
LvdK | 8:422544d24df3 | 64 | <Text> : Any printable ASCII character except the * character as this is used as the text field delimiter. |
LvdK | 7:6576a287e563 | 65 | Maximum length is 24 characters, minimum length is 1 character for font F0. |
LvdK | 7:6576a287e563 | 66 | Maximum length is 48 characters, minumum length is 1 character for font F1. |
LvdK | 8:422544d24df3 | 67 | <Col> : Horizontal position of the first character (1..24) |
LvdK | 8:422544d24df3 | 68 | <Row> : Vertical position of the line (1..14) |
LvdK | 7:6576a287e563 | 69 | $PCDUETX ETX=ERASE TEXT |
LvdK | 8:422544d24df3 | 70 | ============================================================= |
LvdK | 7:6576a287e563 | 71 | Syntax: $PCDUETX, <Col>,<Row>,<n>*<checksum>CRLF |
LvdK | 8:422544d24df3 | 72 | <Col> : Horizontal position of the first character (1..24 for font F0 or 1..48 for font F1) |
LvdK | 8:422544d24df3 | 73 | <Row> : Vertical position of the line (1‐14) |
LvdK | 8:422544d24df3 | 74 | <n> : number of characters to be erased (1..24 for font F0 or 1..48 for font F1) |
LvdK | 7:6576a287e563 | 75 | $PCDUKTX Write text attached to a Select Key |
LvdK | 7:6576a287e563 | 76 | =========================================================== |
LvdK | 7:6576a287e563 | 77 | Syntax: $PCDUKTX,<KeyID>,<Texttype>,<Fsize>,<Fstyle>,<Rcolour>,<Gcolour>,<Bcolour>,<Text>*< checksum>CRLF |
LvdK | 8:422544d24df3 | 78 | <KeyID> : Numbering is 00 – 49 for left keys and 50 – 99 for right keys. Top keys are 00 and 50. |
LvdK | 8:422544d24df3 | 79 | <Texttype> : M or S, meaning Main text or Subtext. |
LvdK | 8:422544d24df3 | 80 | <Fsize> : Font size (F0..F9). Currently F0 and F1 are implemented. |
LvdK | 8:422544d24df3 | 81 | <Fstyle> : Font style (S=Standard, B=Bold, I=Italic, U=Underline, N=Negative) |
LvdK | 8:422544d24df3 | 82 | < Rcolour > : RED (000‐255) |
LvdK | 8:422544d24df3 | 83 | < Gcolour > : GREEN (000‐255) |
LvdK | 8:422544d24df3 | 84 | < Bcolour > : BLUE (000‐255) |
LvdK | 8:422544d24df3 | 85 | <Text> : Any printable ASCII character within the character set.except the * character as this is used as the text field delimiter. |
LvdK | 7:6576a287e563 | 86 | Maximum length is 24 characters, minimum length is 1 character for font F0 |
LvdK | 8:422544d24df3 | 87 | Maximum length is 48 characters, minumum length is 1 character for font F1. |
LvdK | 7:6576a287e563 | 88 | */ |
LvdK | 7:6576a287e563 | 89 | //Control lines for VGA driver board |
LvdK | 7:6576a287e563 | 90 | TFT_4DGL display(p13,p14,p15); // serial tx, serial rx, reset pin |
LvdK | 7:6576a287e563 | 91 | //Character & String functions |
LvdK | 7:6576a287e563 | 92 | char* str2char( string cString ) //convert a string to a character array |
LvdK | 7:6576a287e563 | 93 | { |
LvdK | 7:6576a287e563 | 94 | int nStrLen=cString.size(); |
LvdK | 7:6576a287e563 | 95 | std::string cInput( cString ); |
LvdK | 7:6576a287e563 | 96 | char* cText = new char[nStrLen+1]; |
LvdK | 7:6576a287e563 | 97 | strncpy(cText, cInput.c_str(), nStrLen); |
LvdK | 7:6576a287e563 | 98 | cText[nStrLen] = '\0'; |
LvdK | 7:6576a287e563 | 99 | return cText; |
LvdK | 7:6576a287e563 | 100 | } |
LvdK | 8:422544d24df3 | 101 | |
LvdK | 7:6576a287e563 | 102 | int centertext( string cString, int nChars, int nCharWidth ) |
LvdK | 7:6576a287e563 | 103 | //calculates the startposition on the screen to center the text |
LvdK | 7:6576a287e563 | 104 | //needs the actual string (cString), screenwidth in characters (nChars) and the character width (nCharWidth) |
LvdK | 7:6576a287e563 | 105 | { |
LvdK | 7:6576a287e563 | 106 | int nStart; |
LvdK | 7:6576a287e563 | 107 | nStart = nCharWidth*( nChars/2-( cString.size()/2 )); |
LvdK | 7:6576a287e563 | 108 | return nStart; |
LvdK | 7:6576a287e563 | 109 | } |
LvdK | 8:422544d24df3 | 110 | |
LvdK | 7:6576a287e563 | 111 | int righttext( string cString, int nChars, int nCharWidth ) |
LvdK | 7:6576a287e563 | 112 | //calculates the startposition on the screen to right-align the text |
LvdK | 7:6576a287e563 | 113 | //needs the actual string (cString), screenwidth in characters (nChars) and the character width (nCharWidth) |
LvdK | 7:6576a287e563 | 114 | { |
LvdK | 7:6576a287e563 | 115 | int nStart; |
LvdK | 7:6576a287e563 | 116 | nStart = nCharWidth*( nChars - cString.size()); |
LvdK | 7:6576a287e563 | 117 | return nStart; |
LvdK | 7:6576a287e563 | 118 | } |
LvdK | 7:6576a287e563 | 119 | int nFontSize( int nfont_number ) |
LvdK | 7:6576a287e563 | 120 | { |
LvdK | 8:422544d24df3 | 121 | int nFontWidth = 24; |
LvdK | 7:6576a287e563 | 122 | switch ( nfont_number ) |
LvdK | 7:6576a287e563 | 123 | { |
LvdK | 7:6576a287e563 | 124 | case 0: |
LvdK | 7:6576a287e563 | 125 | { |
LvdK | 8:422544d24df3 | 126 | nFontWidth = SMALLCHAR; |
LvdK | 8:422544d24df3 | 127 | //nFontWidth = FONT_12X34; |
LvdK | 7:6576a287e563 | 128 | break; |
LvdK | 7:6576a287e563 | 129 | } |
LvdK | 7:6576a287e563 | 130 | case 1: |
LvdK | 7:6576a287e563 | 131 | { |
LvdK | 8:422544d24df3 | 132 | nFontWidth = LARGECHAR; |
LvdK | 8:422544d24df3 | 133 | //nFontWidth = FONT_24X34; |
LvdK | 7:6576a287e563 | 134 | break; |
LvdK | 7:6576a287e563 | 135 | } |
LvdK | 7:6576a287e563 | 136 | } |
LvdK | 8:422544d24df3 | 137 | return ( nFontWidth ); |
LvdK | 8:422544d24df3 | 138 | } |
LvdK | 7:6576a287e563 | 139 | |
LvdK | 7:6576a287e563 | 140 | int nFontWidth (int nfont_number ) |
LvdK | 7:6576a287e563 | 141 | { |
LvdK | 7:6576a287e563 | 142 | int nFont = 12; |
LvdK | 7:6576a287e563 | 143 | switch ( nfont_number ) |
LvdK | 7:6576a287e563 | 144 | { |
LvdK | 7:6576a287e563 | 145 | case 0: |
LvdK | 7:6576a287e563 | 146 | { |
LvdK | 7:6576a287e563 | 147 | nFont = 12; |
LvdK | 7:6576a287e563 | 148 | break; |
LvdK | 7:6576a287e563 | 149 | } |
LvdK | 7:6576a287e563 | 150 | case 1: |
LvdK | 7:6576a287e563 | 151 | { |
LvdK | 7:6576a287e563 | 152 | nFont = 24; |
LvdK | 7:6576a287e563 | 153 | break; |
LvdK | 7:6576a287e563 | 154 | } |
LvdK | 7:6576a287e563 | 155 | } |
LvdK | 7:6576a287e563 | 156 | return ( nFont ); |
LvdK | 8:422544d24df3 | 157 | } |
LvdK | 7:6576a287e563 | 158 | |
LvdK | 7:6576a287e563 | 159 | unsigned int cRGB( char cRED, char cGREEN, char cBLUE ) |
LvdK | 7:6576a287e563 | 160 | { |
LvdK | 7:6576a287e563 | 161 | //assemble separate colors into 1 integer value as 0xRRGGBB |
LvdK | 7:6576a287e563 | 162 | //Display driver requires this format |
LvdK | 7:6576a287e563 | 163 | unsigned int RGB = cBLUE + 256*cGREEN + 65536*cRED; |
LvdK | 7:6576a287e563 | 164 | return ( RGB ); |
LvdK | 8:422544d24df3 | 165 | } |
LvdK | 7:6576a287e563 | 166 | |
LvdK | 7:6576a287e563 | 167 | int LeftOrRight( int nTextLine, string cString, int nChars, int nCharWidth ) |
LvdK | 7:6576a287e563 | 168 | { |
LvdK | 8:422544d24df3 | 169 | // nChars is the maximum numbers of characters on the line |
LvdK | 8:422544d24df3 | 170 | // nCharWidth is the characterwidth in pixels |
LvdK | 7:6576a287e563 | 171 | //decide to print data left aligned or right aligned |
LvdK | 7:6576a287e563 | 172 | //00 - 49 is left side of screen |
LvdK | 7:6576a287e563 | 173 | //50 - 99 is right side of screen |
LvdK | 8:422544d24df3 | 174 | int nHorPos = 0; |
LvdK | 7:6576a287e563 | 175 | // nChars is number of characters on this line (24 or 48) |
LvdK | 7:6576a287e563 | 176 | // nCharWidth is the character width in pixels |
LvdK | 8:422544d24df3 | 177 | |
LvdK | 7:6576a287e563 | 178 | if ( nTextLine < 50 ) |
LvdK | 7:6576a287e563 | 179 | // Left side adjust |
LvdK | 7:6576a287e563 | 180 | { |
LvdK | 7:6576a287e563 | 181 | nHorPos = 0; |
LvdK | 7:6576a287e563 | 182 | } |
LvdK | 7:6576a287e563 | 183 | else |
LvdK | 7:6576a287e563 | 184 | // Right side adjust |
LvdK | 7:6576a287e563 | 185 | { |
LvdK | 7:6576a287e563 | 186 | nHorPos = righttext( cString, nChars, nCharWidth ); |
LvdK | 7:6576a287e563 | 187 | } |
LvdK | 7:6576a287e563 | 188 | return ( nHorPos ); |
LvdK | 7:6576a287e563 | 189 | } |
LvdK | 7:6576a287e563 | 190 | int nLine2Pixel( int nLine ) |
LvdK | 7:6576a287e563 | 191 | { |
LvdK | 7:6576a287e563 | 192 | //calculate vertical pixelposition from linenumber |
LvdK | 7:6576a287e563 | 193 | int nPixel = 0; |
LvdK | 7:6576a287e563 | 194 | switch ( nLine ) |
LvdK | 7:6576a287e563 | 195 | { |
LvdK | 7:6576a287e563 | 196 | case 1: |
LvdK | 7:6576a287e563 | 197 | { |
LvdK | 7:6576a287e563 | 198 | nPixel = LINE1; |
LvdK | 7:6576a287e563 | 199 | break; |
LvdK | 7:6576a287e563 | 200 | } |
LvdK | 7:6576a287e563 | 201 | case 2: |
LvdK | 7:6576a287e563 | 202 | { |
LvdK | 7:6576a287e563 | 203 | nPixel = LINE2; |
LvdK | 7:6576a287e563 | 204 | break; |
LvdK | 7:6576a287e563 | 205 | } |
LvdK | 8:422544d24df3 | 206 | |
LvdK | 7:6576a287e563 | 207 | case 3: |
LvdK | 7:6576a287e563 | 208 | { |
LvdK | 7:6576a287e563 | 209 | nPixel = LINE3; |
LvdK | 7:6576a287e563 | 210 | break; |
LvdK | 7:6576a287e563 | 211 | } |
LvdK | 8:422544d24df3 | 212 | |
LvdK | 7:6576a287e563 | 213 | case 4: |
LvdK | 7:6576a287e563 | 214 | { |
LvdK | 7:6576a287e563 | 215 | nPixel = LINE4; |
LvdK | 7:6576a287e563 | 216 | break; |
LvdK | 7:6576a287e563 | 217 | } |
LvdK | 8:422544d24df3 | 218 | |
LvdK | 7:6576a287e563 | 219 | case 5: |
LvdK | 7:6576a287e563 | 220 | { |
LvdK | 7:6576a287e563 | 221 | nPixel = LINE5; |
LvdK | 7:6576a287e563 | 222 | break; |
LvdK | 7:6576a287e563 | 223 | } |
LvdK | 8:422544d24df3 | 224 | |
LvdK | 7:6576a287e563 | 225 | case 6: |
LvdK | 7:6576a287e563 | 226 | { |
LvdK | 7:6576a287e563 | 227 | nPixel = LINE6; |
LvdK | 7:6576a287e563 | 228 | break; |
LvdK | 7:6576a287e563 | 229 | } |
LvdK | 8:422544d24df3 | 230 | |
LvdK | 7:6576a287e563 | 231 | case 7: |
LvdK | 7:6576a287e563 | 232 | { |
LvdK | 7:6576a287e563 | 233 | nPixel = LINE7; |
LvdK | 7:6576a287e563 | 234 | break; |
LvdK | 7:6576a287e563 | 235 | } |
LvdK | 8:422544d24df3 | 236 | |
LvdK | 7:6576a287e563 | 237 | case 8: |
LvdK | 7:6576a287e563 | 238 | { |
LvdK | 7:6576a287e563 | 239 | nPixel = LINE8; |
LvdK | 7:6576a287e563 | 240 | break; |
LvdK | 7:6576a287e563 | 241 | } |
LvdK | 8:422544d24df3 | 242 | |
LvdK | 7:6576a287e563 | 243 | case 9: |
LvdK | 7:6576a287e563 | 244 | { |
LvdK | 7:6576a287e563 | 245 | nPixel = LINE9; |
LvdK | 7:6576a287e563 | 246 | break; |
LvdK | 7:6576a287e563 | 247 | } |
LvdK | 8:422544d24df3 | 248 | |
LvdK | 7:6576a287e563 | 249 | case 10: |
LvdK | 7:6576a287e563 | 250 | { |
LvdK | 7:6576a287e563 | 251 | nPixel = LINE10; |
LvdK | 7:6576a287e563 | 252 | break; |
LvdK | 7:6576a287e563 | 253 | } |
LvdK | 8:422544d24df3 | 254 | |
LvdK | 7:6576a287e563 | 255 | case 11: |
LvdK | 7:6576a287e563 | 256 | { |
LvdK | 7:6576a287e563 | 257 | nPixel = LINE11; |
LvdK | 7:6576a287e563 | 258 | break; |
LvdK | 7:6576a287e563 | 259 | } |
LvdK | 8:422544d24df3 | 260 | |
LvdK | 7:6576a287e563 | 261 | case 12: |
LvdK | 7:6576a287e563 | 262 | { |
LvdK | 7:6576a287e563 | 263 | nPixel = LINE12; |
LvdK | 7:6576a287e563 | 264 | break; |
LvdK | 7:6576a287e563 | 265 | } |
LvdK | 8:422544d24df3 | 266 | |
LvdK | 7:6576a287e563 | 267 | case 13: |
LvdK | 7:6576a287e563 | 268 | { |
LvdK | 7:6576a287e563 | 269 | nPixel = LINE13; |
LvdK | 7:6576a287e563 | 270 | break; |
LvdK | 7:6576a287e563 | 271 | } |
LvdK | 8:422544d24df3 | 272 | |
LvdK | 7:6576a287e563 | 273 | case 14: |
LvdK | 7:6576a287e563 | 274 | { |
LvdK | 7:6576a287e563 | 275 | nPixel = LINE14; |
LvdK | 7:6576a287e563 | 276 | break; |
LvdK | 7:6576a287e563 | 277 | } |
LvdK | 8:422544d24df3 | 278 | |
LvdK | 7:6576a287e563 | 279 | } |
LvdK | 7:6576a287e563 | 280 | return ( nPixel ) ; |
LvdK | 7:6576a287e563 | 281 | } |
LvdK | 7:6576a287e563 | 282 | void VGA_SIGNAL( int Source, int On_Off) |
LvdK | 7:6576a287e563 | 283 | { |
LvdK | 7:6576a287e563 | 284 | VGA_SOURCE = Source; |
LvdK | 7:6576a287e563 | 285 | VGA_SELECT = On_Off; |
LvdK | 7:6576a287e563 | 286 | } |
LvdK | 7:6576a287e563 | 287 | void CDU_InitDisplay() |
LvdK | 7:6576a287e563 | 288 | { |
LvdK | 7:6576a287e563 | 289 | display.baudrate( 9600 ); //init uVGAIII card |
LvdK | 7:6576a287e563 | 290 | VGA_SIGNAL( VGA_INT, VGA_ON ); //select INTERNTAL video and set VGA switch ON |
LvdK | 7:6576a287e563 | 291 | } |
LvdK | 7:6576a287e563 | 292 | void CDU_StartScreen() |
LvdK | 8:422544d24df3 | 293 | { |
LvdK | 7:6576a287e563 | 294 | string cTitle1="ENGRAVITY"; |
LvdK | 7:6576a287e563 | 295 | string cTitle2="CONTROL & DISPLAY UNIT"; |
LvdK | 8:422544d24df3 | 296 | display.cls(); |
LvdK | 7:6576a287e563 | 297 | |
LvdK | 7:6576a287e563 | 298 | display.graphic_string( str2char( cTitle1 ), centertext( cTitle1, 24, LARGECHAR), LINE6, FONT_24X34, WHITE, 1, 1 ); |
LvdK | 8:422544d24df3 | 299 | wait_ms(100); |
LvdK | 7:6576a287e563 | 300 | display.graphic_string( str2char( cTitle2 ), centertext( cTitle2, 24, LARGECHAR), LINE8, FONT_24X34, RED, 1, 1 ); |
LvdK | 8:422544d24df3 | 301 | wait_ms(100); |
LvdK | 7:6576a287e563 | 302 | display.graphic_string( str2char( cTitle2 ), centertext( cTitle2, 24, LARGECHAR), LINE8, FONT_24X34, GREEN, 1, 1 ); |
LvdK | 8:422544d24df3 | 303 | wait_ms(100); |
LvdK | 7:6576a287e563 | 304 | display.graphic_string( str2char( cTitle2) , centertext( cTitle2, 24, LARGECHAR), LINE8, FONT_24X34, BLUE, 1, 1 ); |
LvdK | 8:422544d24df3 | 305 | wait_ms(100); |
LvdK | 7:6576a287e563 | 306 | display.graphic_string( str2char( cTitle2) , centertext( cTitle2, 24, LARGECHAR), LINE8, FONT_24X34, WHITE, 1, 1 ); |
LvdK | 8:422544d24df3 | 307 | wait_ms(100); |
LvdK | 8:422544d24df3 | 308 | } |
LvdK | 7:6576a287e563 | 309 | void CDU_ScreenAlign() |
LvdK | 7:6576a287e563 | 310 | //Draw a wireframe for aligning the screen on display with keys |
LvdK | 7:6576a287e563 | 311 | { |
LvdK | 7:6576a287e563 | 312 | display.cls(); |
LvdK | 8:422544d24df3 | 313 | |
LvdK | 7:6576a287e563 | 314 | display.pen_size(WIREFRAME); |
LvdK | 7:6576a287e563 | 315 | display.rectangle(XMIN,YMIN,XMAX,YMAX, WHITE); |
LvdK | 7:6576a287e563 | 316 | display.line(XMIN,LINE2,XMAX,LINE2, WHITE); |
LvdK | 7:6576a287e563 | 317 | display.line(XMIN,LINE3,XMAX,LINE3, WHITE); |
LvdK | 7:6576a287e563 | 318 | display.line(XMIN,LINE4,XMAX,LINE4, WHITE); |
LvdK | 7:6576a287e563 | 319 | display.line(XMIN,LINE5,XMAX,LINE5, WHITE); |
LvdK | 7:6576a287e563 | 320 | display.line(XMIN,LINE6,XMAX,LINE6, WHITE); |
LvdK | 7:6576a287e563 | 321 | display.line(XMIN,LINE7,XMAX,LINE7, WHITE); |
LvdK | 7:6576a287e563 | 322 | display.line(XMIN,LINE8,XMAX,LINE8, WHITE); |
LvdK | 7:6576a287e563 | 323 | display.line(XMIN,LINE9,XMAX,LINE9, WHITE); |
LvdK | 7:6576a287e563 | 324 | display.line(XMIN,LINE10,XMAX,LINE10, WHITE); |
LvdK | 7:6576a287e563 | 325 | display.line(XMIN,LINE11,XMAX,LINE11, WHITE); |
LvdK | 7:6576a287e563 | 326 | display.line(XMIN,LINE12,XMAX,LINE12, WHITE); |
LvdK | 7:6576a287e563 | 327 | display.line(XMIN,LINE13,XMAX,LINE13, WHITE); |
LvdK | 7:6576a287e563 | 328 | display.line(XMIN,LINE14,XMAX,LINE14, WHITE); |
LvdK | 7:6576a287e563 | 329 | } |
LvdK | 7:6576a287e563 | 330 | void CDU_TestScreen() |
LvdK | 7:6576a287e563 | 331 | { |
LvdK | 7:6576a287e563 | 332 | display.display_control(IMAGE_FORMAT, NEW); //set correct image for reading from SD |
LvdK | 7:6576a287e563 | 333 | display.cls(); |
LvdK | 7:6576a287e563 | 334 | display.showpicture(0x00, 0x00, 0x00, 0x14, 0x00, 0x01, 0xB5); // Testscreen |
LvdK | 7:6576a287e563 | 335 | } |
LvdK | 7:6576a287e563 | 336 | void CDU_LogoScreen() |
LvdK | 7:6576a287e563 | 337 | { |
LvdK | 8:422544d24df3 | 338 | display.display_control(IMAGE_FORMAT, NEW); //set correct image for reading from SD |
LvdK | 7:6576a287e563 | 339 | display.cls(); |
LvdK | 7:6576a287e563 | 340 | display.showpicture(0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00); // Engravity logo |
LvdK | 7:6576a287e563 | 341 | } |
LvdK | 8:422544d24df3 | 342 | |
LvdK | 7:6576a287e563 | 343 | void CDU_Page() |
LvdK | 7:6576a287e563 | 344 | { |
LvdK | 7:6576a287e563 | 345 | display.cls(); |
LvdK | 7:6576a287e563 | 346 | display.graphic_string( "PERF INIT" , 8*24, LINE1, FONT_24X34, WHITE, 1, 1 ); |
LvdK | 8:422544d24df3 | 347 | |
LvdK | 7:6576a287e563 | 348 | display.graphic_string( "GW/CRZ CG" , 0, LINE2, FONT_12X34, WHITE, 1, 1 ); |
LvdK | 7:6576a287e563 | 349 | display.graphic_string( "CRZ ALT" , 41*12, LINE2, FONT_12X34, WHITE, 1, 1 ); |
LvdK | 8:422544d24df3 | 350 | |
LvdK | 7:6576a287e563 | 351 | display.graphic_string( "___._ / 26.2%" , 0, LINE3, FONT_24X34, WHITE, 1, 1 ); |
LvdK | 7:6576a287e563 | 352 | display.graphic_string( "_____" , 19*24, LINE3, FONT_24X34, WHITE, 1, 1 ); |
LvdK | 7:6576a287e563 | 353 | display.graphic_string( "FUEL" , 0, LINE4, FONT_12X34, WHITE, 1, 1 ); |
LvdK | 7:6576a287e563 | 354 | display.graphic_string( "CRZ/WIND" , 40*12, LINE4, FONT_12X34, WHITE, 1, 1 ); |
LvdK | 8:422544d24df3 | 355 | |
LvdK | 7:6576a287e563 | 356 | display.graphic_string( "0.0" , 0, LINE5, FONT_24X34, WHITE, 1, 1 ); |
LvdK | 7:6576a287e563 | 357 | display.graphic_string( "000$ /---" , 15*24, LINE5, FONT_24X34, WHITE, 1, 1 ); |
LvdK | 8:422544d24df3 | 358 | |
LvdK | 7:6576a287e563 | 359 | display.graphic_string( "ZFW" , 0, LINE6, FONT_12X34, WHITE, 1, 1 ); |
LvdK | 7:6576a287e563 | 360 | display.graphic_string( "___._ " , 0, LINE7, FONT_24X34, WHITE, 1, 1 ); |
LvdK | 8:422544d24df3 | 361 | |
LvdK | 7:6576a287e563 | 362 | display.graphic_string( "RESERVES" , 0, LINE8, FONT_12X34, WHITE, 1, 1 ); |
LvdK | 7:6576a287e563 | 363 | display.graphic_string( "__._ " , 0, LINE9, FONT_24X34, WHITE, 1, 1 ); |
LvdK | 8:422544d24df3 | 364 | |
LvdK | 7:6576a287e563 | 365 | display.graphic_string( "COST INDEX" , 0, LINE10, FONT_12X34, WHITE, 1, 1 ); |
LvdK | 8:422544d24df3 | 366 | display.graphic_string( "TRANS ALT" , 39*12, LINE10, FONT_12X34, WHITE, 1, 1 ); |
LvdK | 7:6576a287e563 | 367 | |
LvdK | 7:6576a287e563 | 368 | display.graphic_string( "___" , 0, LINE11, FONT_24X34, WHITE, 1, 1 ); |
LvdK | 7:6576a287e563 | 369 | display.graphic_string( "_____" , 19*24, LINE11, FONT_24X34, WHITE, 1, 1 ); |
LvdK | 8:422544d24df3 | 370 | |
LvdK | 8:422544d24df3 | 371 | display.graphic_string( "------------------------------------------------" , 0, LINE12, FONT_12X34, WHITE, 1, 1 ); |
LvdK | 7:6576a287e563 | 372 | |
LvdK | 7:6576a287e563 | 373 | display.graphic_string( "<INDEX" , 0, LINE13, FONT_24X34, WHITE, 1, 1 ); |
LvdK | 7:6576a287e563 | 374 | display.graphic_string( "N1 LIMIT>" , 15*24, LINE13, FONT_24X34, WHITE, 1, 1 ); |
LvdK | 8:422544d24df3 | 375 | |
LvdK | 7:6576a287e563 | 376 | display.graphic_string( "SCRATCHPAD DATA LINE", centertext("SCRATCHPAD DATA LINE", 24, LARGECHAR) , LINE14, FONT_24X34, RED, 1, 1 ); |
LvdK | 8:422544d24df3 | 377 | |
LvdK | 7:6576a287e563 | 378 | } |
LvdK | 8:422544d24df3 | 379 | |
LvdK | 7:6576a287e563 | 380 | void CDU_displayclear(){ |
LvdK | 7:6576a287e563 | 381 | display.cls(); |
LvdK | 7:6576a287e563 | 382 | } |
LvdK | 8:422544d24df3 | 383 | |
LvdK | 7:6576a287e563 | 384 |