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