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