Graphics Drawing Interface EZLCD4 display using serial
gdiezl4.cpp@0:607ac6f9ce7a, 2011-03-14 (annotated)
- Committer:
- wbasser
- Date:
- Mon Mar 14 15:58:13 2011 +0000
- Revision:
- 0:607ac6f9ce7a
- Child:
- 1:683ac9b65344
Version 00_00_01
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wbasser | 0:607ac6f9ce7a | 1 | /***************************************************************************** |
wbasser | 0:607ac6f9ce7a | 2 | // $Workfile: $ |
wbasser | 0:607ac6f9ce7a | 3 | // Function: graphics drive - EZLCD04 implementation |
wbasser | 0:607ac6f9ce7a | 4 | // Author: Bill Basser |
wbasser | 0:607ac6f9ce7a | 5 | // $JustDate: $ |
wbasser | 0:607ac6f9ce7a | 6 | // $Revision: $ |
wbasser | 0:607ac6f9ce7a | 7 | // |
wbasser | 0:607ac6f9ce7a | 8 | // This document contains proprietary data and information of |
wbasser | 0:607ac6f9ce7a | 9 | // Cyber Integration LLC. It is the exclusive property of |
wbasser | 0:607ac6f9ce7a | 10 | // Cyber Integration, LLC and will not be disclosed in any form to |
wbasser | 0:607ac6f9ce7a | 11 | // any party without prior written permission of Cyber Integration, LLC. |
wbasser | 0:607ac6f9ce7a | 12 | // This document may not be reproduced or further used without the |
wbasser | 0:607ac6f9ce7a | 13 | // prior written permission of Cyber Integration, LLC. |
wbasser | 0:607ac6f9ce7a | 14 | // |
wbasser | 0:607ac6f9ce7a | 15 | // Copyright (C) 2011 Cyber Integration, LLC. All Rights Reserved |
wbasser | 0:607ac6f9ce7a | 16 | // |
wbasser | 0:607ac6f9ce7a | 17 | // $History: $ |
wbasser | 0:607ac6f9ce7a | 18 | * |
wbasser | 0:607ac6f9ce7a | 19 | *****************************************************************************/ |
wbasser | 0:607ac6f9ce7a | 20 | |
wbasser | 0:607ac6f9ce7a | 21 | // local includes |
wbasser | 0:607ac6f9ce7a | 22 | #include "gdiezl4.h" |
wbasser | 0:607ac6f9ce7a | 23 | |
wbasser | 0:607ac6f9ce7a | 24 | // define the MSB/LSB extraction utilities |
wbasser | 0:607ac6f9ce7a | 25 | #define MSB(w) (( w >> 8 ) & 0xFF ) |
wbasser | 0:607ac6f9ce7a | 26 | #define LSB(w) ( w & 0xFF ) |
wbasser | 0:607ac6f9ce7a | 27 | |
wbasser | 0:607ac6f9ce7a | 28 | /****************************************************************************** |
wbasser | 0:607ac6f9ce7a | 29 | // Function Name: GdiEzL4( tTx, tRx ) |
wbasser | 0:607ac6f9ce7a | 30 | // Description: construction |
wbasser | 0:607ac6f9ce7a | 31 | // Entry: tTx = transmit pin |
wbasser | 0:607ac6f9ce7a | 32 | // tRx = receive pin |
wbasser | 0:607ac6f9ce7a | 33 | // Exit: none |
wbasser | 0:607ac6f9ce7a | 34 | // Globals modified: none |
wbasser | 0:607ac6f9ce7a | 35 | // Locals modified: none |
wbasser | 0:607ac6f9ce7a | 36 | // Locals modified: none |
wbasser | 0:607ac6f9ce7a | 37 | ******************************************************************************/ |
wbasser | 0:607ac6f9ce7a | 38 | GdiEzL4::GdiEzL4( PinName pinTx, PinName pinRx ) : m_serDisp( pinTx, pinRx ) |
wbasser | 0:607ac6f9ce7a | 39 | { |
wbasser | 0:607ac6f9ce7a | 40 | // create the interface |
wbasser | 0:607ac6f9ce7a | 41 | m_serDisp.baud( 115200 ); |
wbasser | 0:607ac6f9ce7a | 42 | m_serDisp.attach( this, &LocalCallback ); |
wbasser | 0:607ac6f9ce7a | 43 | |
wbasser | 0:607ac6f9ce7a | 44 | // initialize |
wbasser | 0:607ac6f9ce7a | 45 | m_serDisp.putc( EZ_BTP ); |
wbasser | 0:607ac6f9ce7a | 46 | m_serDisp.putc( ON ); |
wbasser | 0:607ac6f9ce7a | 47 | |
wbasser | 0:607ac6f9ce7a | 48 | // turn the backlight on/clear screen to white |
wbasser | 0:607ac6f9ce7a | 49 | BacklightCtl( ON ); |
wbasser | 0:607ac6f9ce7a | 50 | ClearScreen( RGB( 255, 255, 255 )); |
wbasser | 0:607ac6f9ce7a | 51 | } |
wbasser | 0:607ac6f9ce7a | 52 | |
wbasser | 0:607ac6f9ce7a | 53 | /****************************************************************************** |
wbasser | 0:607ac6f9ce7a | 54 | // Function Name: GdiEzL4( ) |
wbasser | 0:607ac6f9ce7a | 55 | // Description: destruction |
wbasser | 0:607ac6f9ce7a | 56 | // Entry: none |
wbasser | 0:607ac6f9ce7a | 57 | // Exit: none |
wbasser | 0:607ac6f9ce7a | 58 | // Globals modified: none |
wbasser | 0:607ac6f9ce7a | 59 | // Locals modified: none |
wbasser | 0:607ac6f9ce7a | 60 | // Locals modified: none |
wbasser | 0:607ac6f9ce7a | 61 | ******************************************************************************/ |
wbasser | 0:607ac6f9ce7a | 62 | GdiEzL4::~GdiEzL4( void ) |
wbasser | 0:607ac6f9ce7a | 63 | { |
wbasser | 0:607ac6f9ce7a | 64 | } |
wbasser | 0:607ac6f9ce7a | 65 | |
wbasser | 0:607ac6f9ce7a | 66 | /****************************************************************************** |
wbasser | 0:607ac6f9ce7a | 67 | // Function Name: GdiBacklightCtl( bOffOn ) |
wbasser | 0:607ac6f9ce7a | 68 | // Description: turn backlight off/on |
wbasser | 0:607ac6f9ce7a | 69 | // Entry: bOffOn |
wbasser | 0:607ac6f9ce7a | 70 | // Exit: none |
wbasser | 0:607ac6f9ce7a | 71 | // Globals modified: none |
wbasser | 0:607ac6f9ce7a | 72 | // Locals modified: anBuffer, nBufLen |
wbasser | 0:607ac6f9ce7a | 73 | ******************************************************************************/ |
wbasser | 0:607ac6f9ce7a | 74 | void GdiEzL4::BacklightCtl( BOOL bOffOn ) |
wbasser | 0:607ac6f9ce7a | 75 | { |
wbasser | 0:607ac6f9ce7a | 76 | // set the correct state of the backlight |
wbasser | 0:607ac6f9ce7a | 77 | m_serDisp.putc(( bOffOn ) ? EZ_LON : EZ_LOF ); |
wbasser | 0:607ac6f9ce7a | 78 | } |
wbasser | 0:607ac6f9ce7a | 79 | |
wbasser | 0:607ac6f9ce7a | 80 | /****************************************************************************** |
wbasser | 0:607ac6f9ce7a | 81 | // Function Name: GdiClearScreen( wColor ) |
wbasser | 0:607ac6f9ce7a | 82 | // Description: clear the screen to the color |
wbasser | 0:607ac6f9ce7a | 83 | // Entry: wColor = background color |
wbasser | 0:607ac6f9ce7a | 84 | // Exit: none |
wbasser | 0:607ac6f9ce7a | 85 | // Globals modified: none |
wbasser | 0:607ac6f9ce7a | 86 | // Locals modified: anBuffer, nBufLen |
wbasser | 0:607ac6f9ce7a | 87 | ******************************************************************************/ |
wbasser | 0:607ac6f9ce7a | 88 | void GdiEzL4::ClearScreen( U16 wColor ) |
wbasser | 0:607ac6f9ce7a | 89 | { |
wbasser | 0:607ac6f9ce7a | 90 | // clear the screen |
wbasser | 0:607ac6f9ce7a | 91 | m_serDisp.putc( EZ_FGC ); |
wbasser | 0:607ac6f9ce7a | 92 | m_serDisp.putc( LSB( wColor )); |
wbasser | 0:607ac6f9ce7a | 93 | m_serDisp.putc( MSB( wColor )); |
wbasser | 0:607ac6f9ce7a | 94 | m_serDisp.putc( EZ_CLS ); |
wbasser | 0:607ac6f9ce7a | 95 | } |
wbasser | 0:607ac6f9ce7a | 96 | |
wbasser | 0:607ac6f9ce7a | 97 | /****************************************************************************** |
wbasser | 0:607ac6f9ce7a | 98 | // Function Name: GdiDrawRect( U16 wColor, U16 wSx, U8 nSy, U16 wWidth, U8 nHeight, BOOL bFill ) |
wbasser | 0:607ac6f9ce7a | 99 | // Description: draw a rectangle |
wbasser | 0:607ac6f9ce7a | 100 | // Entry: wColor = rectangle color |
wbasser | 0:607ac6f9ce7a | 101 | // wSx = starting X |
wbasser | 0:607ac6f9ce7a | 102 | // nSy = starting Y |
wbasser | 0:607ac6f9ce7a | 103 | // wWidth = width of box |
wbasser | 0:607ac6f9ce7a | 104 | // nHeight = height of box |
wbasser | 0:607ac6f9ce7a | 105 | // bFill = fill color |
wbasser | 0:607ac6f9ce7a | 106 | // Exit: none |
wbasser | 0:607ac6f9ce7a | 107 | // Globals modified: none |
wbasser | 0:607ac6f9ce7a | 108 | // Locals modified: anBuffer, nBufLen |
wbasser | 0:607ac6f9ce7a | 109 | ******************************************************************************/ |
wbasser | 0:607ac6f9ce7a | 110 | void GdiEzL4::DrawRect( U16 wColor, U16 wSx, U8 nSy, U16 wWidth, U8 nHeight, BOOL bFill ) |
wbasser | 0:607ac6f9ce7a | 111 | { |
wbasser | 0:607ac6f9ce7a | 112 | U16 wEx = wSx + wWidth - 1; |
wbasser | 0:607ac6f9ce7a | 113 | U8 nEy = nSy + nHeight - 1; |
wbasser | 0:607ac6f9ce7a | 114 | |
wbasser | 0:607ac6f9ce7a | 115 | // draw a rectangle |
wbasser | 0:607ac6f9ce7a | 116 | m_serDisp.putc( EZ_FGC ); |
wbasser | 0:607ac6f9ce7a | 117 | m_serDisp.putc( LSB( wColor )); |
wbasser | 0:607ac6f9ce7a | 118 | m_serDisp.putc( MSB( wColor )); |
wbasser | 0:607ac6f9ce7a | 119 | m_serDisp.putc( EZ_SXY ); |
wbasser | 0:607ac6f9ce7a | 120 | m_serDisp.putc( MSB( wSx )); |
wbasser | 0:607ac6f9ce7a | 121 | m_serDisp.putc( LSB( wSx )); |
wbasser | 0:607ac6f9ce7a | 122 | m_serDisp.putc( nSy ); |
wbasser | 0:607ac6f9ce7a | 123 | m_serDisp.putc( ( bFill ) ? EZ_BXF : EZ_BOX ); |
wbasser | 0:607ac6f9ce7a | 124 | m_serDisp.putc( MSB( wEx )); |
wbasser | 0:607ac6f9ce7a | 125 | m_serDisp.putc( LSB( wEx )); |
wbasser | 0:607ac6f9ce7a | 126 | m_serDisp.putc( nEy ); |
wbasser | 0:607ac6f9ce7a | 127 | } |
wbasser | 0:607ac6f9ce7a | 128 | |
wbasser | 0:607ac6f9ce7a | 129 | /****************************************************************************** |
wbasser | 0:607ac6f9ce7a | 130 | // Function Name: GdiDrawLine( wColor, wSx, nSy, wEx, nEy ) |
wbasser | 0:607ac6f9ce7a | 131 | // Description: draw line |
wbasser | 0:607ac6f9ce7a | 132 | // Entry: wColor = color |
wbasser | 0:607ac6f9ce7a | 133 | // wSx = starting X |
wbasser | 0:607ac6f9ce7a | 134 | // nSy = starting Y |
wbasser | 0:607ac6f9ce7a | 135 | // wEx = ending X |
wbasser | 0:607ac6f9ce7a | 136 | // nEy = ending Y |
wbasser | 0:607ac6f9ce7a | 137 | // Exit: none |
wbasser | 0:607ac6f9ce7a | 138 | // Globals modified: none |
wbasser | 0:607ac6f9ce7a | 139 | // Locals modified: anBuffer, nBufLen |
wbasser | 0:607ac6f9ce7a | 140 | ******************************************************************************/ |
wbasser | 0:607ac6f9ce7a | 141 | void GdiEzL4::DrawLine( U16 wColor, U16 wSx, U8 nSy, U16 wEx, U8 nEy ) |
wbasser | 0:607ac6f9ce7a | 142 | { |
wbasser | 0:607ac6f9ce7a | 143 | // set the color/set starting x/y |
wbasser | 0:607ac6f9ce7a | 144 | m_serDisp.putc( EZ_FGC ); |
wbasser | 0:607ac6f9ce7a | 145 | m_serDisp.putc( LSB( wColor )); |
wbasser | 0:607ac6f9ce7a | 146 | m_serDisp.putc( MSB( wColor )); |
wbasser | 0:607ac6f9ce7a | 147 | m_serDisp.putc( EZ_SXY ); |
wbasser | 0:607ac6f9ce7a | 148 | m_serDisp.putc( MSB( wSx )); |
wbasser | 0:607ac6f9ce7a | 149 | m_serDisp.putc( LSB( wSx )); |
wbasser | 0:607ac6f9ce7a | 150 | m_serDisp.putc( nSy ); |
wbasser | 0:607ac6f9ce7a | 151 | |
wbasser | 0:607ac6f9ce7a | 152 | // determine type of line |
wbasser | 0:607ac6f9ce7a | 153 | if ( wSx == wEx ) |
wbasser | 0:607ac6f9ce7a | 154 | { |
wbasser | 0:607ac6f9ce7a | 155 | // vertical line |
wbasser | 0:607ac6f9ce7a | 156 | m_serDisp.putc( EZ_VLN ); |
wbasser | 0:607ac6f9ce7a | 157 | m_serDisp.putc( nEy ); |
wbasser | 0:607ac6f9ce7a | 158 | } |
wbasser | 0:607ac6f9ce7a | 159 | else if ( nSy == nEy ) |
wbasser | 0:607ac6f9ce7a | 160 | { |
wbasser | 0:607ac6f9ce7a | 161 | // horizontal line |
wbasser | 0:607ac6f9ce7a | 162 | m_serDisp.putc( EZ_HLN ); |
wbasser | 0:607ac6f9ce7a | 163 | m_serDisp.putc( MSB( wEx )); |
wbasser | 0:607ac6f9ce7a | 164 | m_serDisp.putc( LSB( wEx )); |
wbasser | 0:607ac6f9ce7a | 165 | } |
wbasser | 0:607ac6f9ce7a | 166 | else |
wbasser | 0:607ac6f9ce7a | 167 | { |
wbasser | 0:607ac6f9ce7a | 168 | // diagonal line |
wbasser | 0:607ac6f9ce7a | 169 | m_serDisp.putc( EZ_LIN ); |
wbasser | 0:607ac6f9ce7a | 170 | m_serDisp.putc( MSB( wEx )); |
wbasser | 0:607ac6f9ce7a | 171 | m_serDisp.putc( LSB( wEx )); |
wbasser | 0:607ac6f9ce7a | 172 | m_serDisp.putc( nEy ); |
wbasser | 0:607ac6f9ce7a | 173 | } |
wbasser | 0:607ac6f9ce7a | 174 | } |
wbasser | 0:607ac6f9ce7a | 175 | |
wbasser | 0:607ac6f9ce7a | 176 | |
wbasser | 0:607ac6f9ce7a | 177 | /****************************************************************************** |
wbasser | 0:607ac6f9ce7a | 178 | // Function Name: GdiDrawIcon( wSx, nSy, nIcon ) |
wbasser | 0:607ac6f9ce7a | 179 | // Description: draw an icon |
wbasser | 0:607ac6f9ce7a | 180 | // Entry: wSx = starting X |
wbasser | 0:607ac6f9ce7a | 181 | // nSy = starting Y |
wbasser | 0:607ac6f9ce7a | 182 | // nIcon = icon number |
wbasser | 0:607ac6f9ce7a | 183 | // Exit: none |
wbasser | 0:607ac6f9ce7a | 184 | // Globals modified: none |
wbasser | 0:607ac6f9ce7a | 185 | // Locals modified: anBuffer, nBufLen |
wbasser | 0:607ac6f9ce7a | 186 | ******************************************************************************/ |
wbasser | 0:607ac6f9ce7a | 187 | void GdiEzL4::DrawIcon( U16 wSx, U8 nSy, U8 nIcon ) |
wbasser | 0:607ac6f9ce7a | 188 | { |
wbasser | 0:607ac6f9ce7a | 189 | // draw a icon |
wbasser | 0:607ac6f9ce7a | 190 | m_serDisp.putc( EZ_SXY ); |
wbasser | 0:607ac6f9ce7a | 191 | m_serDisp.putc( MSB( wSx )); |
wbasser | 0:607ac6f9ce7a | 192 | m_serDisp.putc( LSB( wSx )); |
wbasser | 0:607ac6f9ce7a | 193 | m_serDisp.putc( nSy ); |
wbasser | 0:607ac6f9ce7a | 194 | m_serDisp.putc( EZ_ICF ); |
wbasser | 0:607ac6f9ce7a | 195 | m_serDisp.putc( nIcon ); |
wbasser | 0:607ac6f9ce7a | 196 | } |
wbasser | 0:607ac6f9ce7a | 197 | |
wbasser | 0:607ac6f9ce7a | 198 | /****************************************************************************** |
wbasser | 0:607ac6f9ce7a | 199 | // Function Name: GdiDrawChar( wColor, nFont, wSx, nSy, bBackground, nDir, cChar ) |
wbasser | 0:607ac6f9ce7a | 200 | // Description: draw a character with the designated font, color |
wbasser | 0:607ac6f9ce7a | 201 | // Entry: wColor = color |
wbasser | 0:607ac6f9ce7a | 202 | // nFont = font number |
wbasser | 0:607ac6f9ce7a | 203 | // wSx = starting X |
wbasser | 0:607ac6f9ce7a | 204 | // nSy = starting Y |
wbasser | 0:607ac6f9ce7a | 205 | // bBackground = true if drawn on background |
wbasser | 0:607ac6f9ce7a | 206 | // nDir = text direction |
wbasser | 0:607ac6f9ce7a | 207 | // cChar = color |
wbasser | 0:607ac6f9ce7a | 208 | // Exit: none |
wbasser | 0:607ac6f9ce7a | 209 | // Globals modified: none |
wbasser | 0:607ac6f9ce7a | 210 | // Locals modified: anBuffer, nBufLen |
wbasser | 0:607ac6f9ce7a | 211 | ******************************************************************************/ |
wbasser | 0:607ac6f9ce7a | 212 | void GdiEzL4::DrawChar( U16 wColor, U8 nFont, U16 wSx, U8 nSy, BOOL bBackground, GDITXTDIR eDir, C8 cChar ) |
wbasser | 0:607ac6f9ce7a | 213 | { |
wbasser | 0:607ac6f9ce7a | 214 | // set the color/set xy/set font/draw character |
wbasser | 0:607ac6f9ce7a | 215 | m_serDisp.putc( EZ_FGC ); |
wbasser | 0:607ac6f9ce7a | 216 | m_serDisp.putc( LSB( wColor )); |
wbasser | 0:607ac6f9ce7a | 217 | m_serDisp.putc( MSB( wColor )); |
wbasser | 0:607ac6f9ce7a | 218 | m_serDisp.putc( EZ_SXY ); |
wbasser | 0:607ac6f9ce7a | 219 | m_serDisp.putc( MSB( wSx )); |
wbasser | 0:607ac6f9ce7a | 220 | m_serDisp.putc( LSB( wSx )); |
wbasser | 0:607ac6f9ce7a | 221 | m_serDisp.putc( nSy ); |
wbasser | 0:607ac6f9ce7a | 222 | m_serDisp.putc( EZ_FNT ); |
wbasser | 0:607ac6f9ce7a | 223 | m_serDisp.putc( nFont ); |
wbasser | 0:607ac6f9ce7a | 224 | m_serDisp.putc( EZ_TXN + ( U8 )eDir ); |
wbasser | 0:607ac6f9ce7a | 225 | m_serDisp.putc(( bBackground ) ? EZ_CHB : EZ_CHR ); |
wbasser | 0:607ac6f9ce7a | 226 | m_serDisp.putc( cChar ); |
wbasser | 0:607ac6f9ce7a | 227 | } |
wbasser | 0:607ac6f9ce7a | 228 | |
wbasser | 0:607ac6f9ce7a | 229 | /****************************************************************************** |
wbasser | 0:607ac6f9ce7a | 230 | // Function Name: GdiDrawString( wFgcClr, wBgcClr, nFont, wSx, nSy, bBackground, eDir, szMsg ) |
wbasser | 0:607ac6f9ce7a | 231 | // Description: draw a string with the desinated font, color |
wbasser | 0:607ac6f9ce7a | 232 | // Entry: wFgClr = foreground color |
wbasser | 0:607ac6f9ce7a | 233 | // wBgClr = background color |
wbasser | 0:607ac6f9ce7a | 234 | // nFont = font number |
wbasser | 0:607ac6f9ce7a | 235 | // wSx = starting X |
wbasser | 0:607ac6f9ce7a | 236 | // nSy = starting Y |
wbasser | 0:607ac6f9ce7a | 237 | // bBackground = true if drawn on background |
wbasser | 0:607ac6f9ce7a | 238 | // eDir = text direction |
wbasser | 0:607ac6f9ce7a | 239 | // szMsg -> pointer to zero delimited string |
wbasser | 0:607ac6f9ce7a | 240 | // Exit: none |
wbasser | 0:607ac6f9ce7a | 241 | // Globals modified: none |
wbasser | 0:607ac6f9ce7a | 242 | // Locals modified: anBuffer, nBufLen |
wbasser | 0:607ac6f9ce7a | 243 | ******************************************************************************/ |
wbasser | 0:607ac6f9ce7a | 244 | void GdiEzL4::DrawString( U16 wFgClr, U16 wBgClr, U8 nFont, U16 wSx, U8 nSy, BOOL bBackground, GDITXTDIR eDir, PC8 pszMsg ) |
wbasser | 0:607ac6f9ce7a | 245 | { |
wbasser | 0:607ac6f9ce7a | 246 | // if backgound |
wbasser | 0:607ac6f9ce7a | 247 | if ( bBackground ) |
wbasser | 0:607ac6f9ce7a | 248 | { |
wbasser | 0:607ac6f9ce7a | 249 | // set the background color |
wbasser | 0:607ac6f9ce7a | 250 | m_serDisp.putc( EZ_BGC ); |
wbasser | 0:607ac6f9ce7a | 251 | m_serDisp.putc( LSB( wBgClr )); |
wbasser | 0:607ac6f9ce7a | 252 | m_serDisp.putc( MSB( wBgClr )); |
wbasser | 0:607ac6f9ce7a | 253 | } |
wbasser | 0:607ac6f9ce7a | 254 | |
wbasser | 0:607ac6f9ce7a | 255 | // set color/set sx/set font/send command |
wbasser | 0:607ac6f9ce7a | 256 | m_serDisp.putc( EZ_FGC ); |
wbasser | 0:607ac6f9ce7a | 257 | m_serDisp.putc( LSB( wFgClr )); |
wbasser | 0:607ac6f9ce7a | 258 | m_serDisp.putc( MSB( wFgClr )); |
wbasser | 0:607ac6f9ce7a | 259 | m_serDisp.putc( EZ_SXY ); |
wbasser | 0:607ac6f9ce7a | 260 | m_serDisp.putc( MSB( wSx )); |
wbasser | 0:607ac6f9ce7a | 261 | m_serDisp.putc( LSB( wSx )); |
wbasser | 0:607ac6f9ce7a | 262 | m_serDisp.putc( nSy ); |
wbasser | 0:607ac6f9ce7a | 263 | m_serDisp.putc( EZ_FNT ); |
wbasser | 0:607ac6f9ce7a | 264 | m_serDisp.putc( nFont ); |
wbasser | 0:607ac6f9ce7a | 265 | m_serDisp.putc( EZ_TXN + ( U8 )eDir ); |
wbasser | 0:607ac6f9ce7a | 266 | m_serDisp.putc(( bBackground ) ? EZ_STB : EZ_STR ); |
wbasser | 0:607ac6f9ce7a | 267 | |
wbasser | 0:607ac6f9ce7a | 268 | // copy the string till buffer size |
wbasser | 0:607ac6f9ce7a | 269 | U8 nChar = 0; |
wbasser | 0:607ac6f9ce7a | 270 | while (( nChar = *( pszMsg++ )) != '\0' ) |
wbasser | 0:607ac6f9ce7a | 271 | m_serDisp.putc( nChar ); |
wbasser | 0:607ac6f9ce7a | 272 | |
wbasser | 0:607ac6f9ce7a | 273 | // stuff the delimiter |
wbasser | 0:607ac6f9ce7a | 274 | m_serDisp.putc( nChar ); |
wbasser | 0:607ac6f9ce7a | 275 | } |
wbasser | 0:607ac6f9ce7a | 276 | |
wbasser | 0:607ac6f9ce7a | 277 | /***************************************************************************** |
wbasser | 0:607ac6f9ce7a | 278 | // Function Name: GdiDrawButton( nIndex, ptBtnDef ) |
wbasser | 0:607ac6f9ce7a | 279 | // Description: draws a button |
wbasser | 0:607ac6f9ce7a | 280 | // Entry: nIndex = button index |
wbasser | 0:607ac6f9ce7a | 281 | // ptBtnDef -> button definition structure |
wbasser | 0:607ac6f9ce7a | 282 | // Exit: none |
wbasser | 0:607ac6f9ce7a | 283 | // Globals modified: none |
wbasser | 0:607ac6f9ce7a | 284 | // Locals modified: none |
wbasser | 0:607ac6f9ce7a | 285 | ******************************************************************************/ |
wbasser | 0:607ac6f9ce7a | 286 | void GdiEzL4::DrawButton( U8 nBtnIdx, GDIBTNDEF* ptBtnDef ) |
wbasser | 0:607ac6f9ce7a | 287 | { |
wbasser | 0:607ac6f9ce7a | 288 | // draw a button |
wbasser | 0:607ac6f9ce7a | 289 | m_serDisp.putc( EZ_BTD ); |
wbasser | 0:607ac6f9ce7a | 290 | m_serDisp.putc( nBtnIdx ); |
wbasser | 0:607ac6f9ce7a | 291 | m_serDisp.putc( ptBtnDef->eInitalState ); |
wbasser | 0:607ac6f9ce7a | 292 | m_serDisp.putc( ptBtnDef->nUpIcon ); |
wbasser | 0:607ac6f9ce7a | 293 | m_serDisp.putc( ptBtnDef->nDnIcon ); |
wbasser | 0:607ac6f9ce7a | 294 | m_serDisp.putc( ptBtnDef->nDsIcon ); |
wbasser | 0:607ac6f9ce7a | 295 | m_serDisp.putc( MSB( ptBtnDef->wUpLfX )); |
wbasser | 0:607ac6f9ce7a | 296 | m_serDisp.putc( LSB( ptBtnDef->wUpLfX )); |
wbasser | 0:607ac6f9ce7a | 297 | m_serDisp.putc( ptBtnDef->nUpLfY ); |
wbasser | 0:607ac6f9ce7a | 298 | m_serDisp.putc( ptBtnDef->nTouchWidth ); |
wbasser | 0:607ac6f9ce7a | 299 | m_serDisp.putc( ptBtnDef->nTouchHeight ); |
wbasser | 0:607ac6f9ce7a | 300 | } |
wbasser | 0:607ac6f9ce7a | 301 | |
wbasser | 0:607ac6f9ce7a | 302 | /***************************************************************************** |
wbasser | 0:607ac6f9ce7a | 303 | // Function Name: GdiRemoveAllButton( ) |
wbasser | 0:607ac6f9ce7a | 304 | // Description: remove all button |
wbasser | 0:607ac6f9ce7a | 305 | // Entry: none |
wbasser | 0:607ac6f9ce7a | 306 | // Exit: none |
wbasser | 0:607ac6f9ce7a | 307 | // Globals modified: none |
wbasser | 0:607ac6f9ce7a | 308 | // Locals modified: none |
wbasser | 0:607ac6f9ce7a | 309 | ******************************************************************************/ |
wbasser | 0:607ac6f9ce7a | 310 | void GdiEzL4::RemoveAllButtons( void ) |
wbasser | 0:607ac6f9ce7a | 311 | { |
wbasser | 0:607ac6f9ce7a | 312 | // send the remove all buttons command |
wbasser | 0:607ac6f9ce7a | 313 | m_serDisp.putc( EZ_BDL ); |
wbasser | 0:607ac6f9ce7a | 314 | } |
wbasser | 0:607ac6f9ce7a | 315 | |
wbasser | 0:607ac6f9ce7a | 316 | void GdiEzL4::PingDisplay( void ) |
wbasser | 0:607ac6f9ce7a | 317 | { |
wbasser | 0:607ac6f9ce7a | 318 | // send a ping |
wbasser | 0:607ac6f9ce7a | 319 | m_serDisp.putc( EZ_PNG ); |
wbasser | 0:607ac6f9ce7a | 320 | } |
wbasser | 0:607ac6f9ce7a | 321 | |
wbasser | 0:607ac6f9ce7a | 322 | void GdiEzL4::LocalCallback( void ) |
wbasser | 0:607ac6f9ce7a | 323 | { |
wbasser | 0:607ac6f9ce7a | 324 | U8 nChar; |
wbasser | 0:607ac6f9ce7a | 325 | |
wbasser | 0:607ac6f9ce7a | 326 | // call the callback |
wbasser | 0:607ac6f9ce7a | 327 | nChar = m_serDisp.getc( ); |
wbasser | 0:607ac6f9ce7a | 328 | m_pvFuncCallBack.call( nChar ); |
wbasser | 0:607ac6f9ce7a | 329 | } |