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