Andrew Reed / Mbed OS CITY1082-i2c_master_wifi_mqtt
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers APP_HouseControl.c Source File

APP_HouseControl.c

00001 /*********************************************************************
00002 *                SEGGER Microcontroller GmbH                         *
00003 *        Solutions for real time microcontroller applications        *
00004 **********************************************************************
00005 *                                                                    *
00006 *        (c) 1996 - 2018  SEGGER Microcontroller GmbH                *
00007 *                                                                    *
00008 *        Internet: www.segger.com    Support:  support@segger.com    *
00009 *                                                                    *
00010 **********************************************************************
00011 
00012 ** emWin V5.48 - Graphical user interface for embedded applications **
00013 All  Intellectual Property rights  in the Software belongs to  SEGGER.
00014 emWin is protected by  international copyright laws.  Knowledge of the
00015 source code may not be used to write a similar product.  This file may
00016 only be used in accordance with the following terms:
00017 
00018 The software  has been licensed to  Cypress Semiconductor Corporation,
00019 whose registered  office is situated  at 198 Champion Ct. San Jose, CA 
00020 95134 USA  solely for the  purposes of creating  libraries for Cypress
00021 PSoC3 and  PSoC5 processor-based devices,  sublicensed and distributed
00022 under  the  terms  and  conditions  of  the  Cypress  End User License
00023 Agreement.
00024 Full source code is available at: www.segger.com
00025 
00026 We appreciate your understanding and fairness.
00027 ----------------------------------------------------------------------
00028 Licensing information
00029 Licensor:                 SEGGER Microcontroller Systems LLC
00030 Licensed to:              Cypress Semiconductor Corp, 198 Champion Ct., San Jose, CA 95134, USA
00031 Licensed SEGGER software: emWin
00032 License number:           GUI-00319
00033 License model:            Services and License Agreement, signed June 10th, 2009
00034 Licensed platform:        Any Cypress platform (Initial targets are: PSoC3, PSoC5)
00035 ----------------------------------------------------------------------
00036 Support and Update Agreement (SUA)
00037 SUA period:               2009-06-12 - 2022-07-27
00038 Contact to extend SUA:    sales@segger.com
00039 ----------------------------------------------------------------------
00040 File        : HouseControl.c
00041 Purpose     : house control demo
00042 Requirements: WindowManager - (x)
00043               MemoryDevices - (x)
00044               AntiAliasing  - (x)
00045               VNC-Server    - ( )
00046               PNG-Library   - ( )
00047               TrueTypeFonts - ( )
00048 ---------------------------END-OF-HEADER------------------------------
00049 */
00050 
00051 #ifndef SKIP_TEST
00052 
00053 #include <stdlib.h>
00054 #include <string.h>
00055 #include <math.h>
00056 #include "GUI.h"
00057 #include "FRAMEWIN.h"
00058 #include "MULTIPAGE.h"
00059 
00060 static void _cbWinAlert(WM_MESSAGE * pMsg);
00061 
00062 typedef void SERIAL_Callback(const char * pStr, int v1, int v2);
00063 
00064 /*********************************************************************
00065 *
00066 *       Defines and statics for serial interface
00067 *       (defined for target hardware only)
00068 *
00069 **********************************************************************
00070 */
00071 #ifndef WIN32
00072   #include "RTOS.h"
00073 
00074   /*********************************************************************
00075   *
00076   *       Defines
00077   */
00078   #define EOL            13   // Sign marking end of line
00079   #define BUFFER_SIZE   512   // Size of receive buffer
00080   #define STRING_SIZE    32   // Size of string buffer
00081 
00082   /*********************************************************************
00083   *
00084   *       Structures
00085   */
00086   typedef struct {
00087     OS_U8 * pDataEnd;
00088     OS_U8 * pWrite;
00089     OS_U8 * pRead;
00090     U16     Size;
00091   } BUFFER;
00092 
00093   /*********************************************************************
00094   *
00095   *       Static data
00096   */
00097   static SERIAL_Callback * _pfcbReceiveCommand;
00098   //
00099   // Buffer to hold string
00100   //
00101   static char   _acString[STRING_SIZE + 2];
00102   static char * _pString = _acString;
00103   //
00104   // Buffer for receiving
00105   //
00106   static OS_U8  _Buffer[BUFFER_SIZE];
00107   static BUFFER _RxBuffer = { _Buffer + BUFFER_SIZE, _Buffer, _Buffer, BUFFER_SIZE };
00108 #endif  // #ifndef WIN32
00109 
00110 /*********************************************************************
00111 *
00112 *       Defines
00113 *
00114 **********************************************************************
00115 */
00116 #define NUM_ALERTS      2
00117 #define PI2             6.2831853f
00118 #define RPM            10
00119 #define UPS           100
00120 #define ARRAY(aItems) aItems, GUI_COUNTOF(aItems)
00121 
00122 //
00123 // Recommended memory to run the sample with adequate performance
00124 //
00125 #define RECOMMENDED_MEMORY (1024L * 30)
00126 
00127 /*********************************************************************
00128 *
00129 *       Typedefs
00130 *
00131 **********************************************************************
00132 */
00133 typedef struct {
00134   I16 xCenter;
00135   I16 yCenter;
00136   I16 xSize;
00137   I16 ySize;
00138 } LOGO;
00139 
00140 typedef struct {
00141   I16      ActV;
00142   I16      NewV;
00143   GUI_RECT Rect;
00144 } OBJECT;
00145 
00146 typedef struct {
00147   OBJECT Light;
00148   I16    Elevator;
00149 } LEVEL;
00150 
00151 typedef struct {
00152   OBJECT  Itself;
00153   OBJECT  Door;
00154   I16     NumToDo;
00155   I16     ToDo[6];
00156   I16     Move;
00157   I16     Pause;
00158   I16     Level;
00159   I16     LastLevel;
00160   int     Time;
00161   WM_HWIN Handle;
00162 } ELEVATOR;
00163 
00164 /*********************************************************************
00165 *
00166 *       Static data
00167 *
00168 **********************************************************************
00169 */
00170 static SCROLLBAR_Handle   _hScroll;
00171 static WM_CALLBACK      * _pfcbFrameWin;
00172 static const char         _acAlertText[NUM_ALERTS][12] = { "Fire", "Burglary" };
00173 static unsigned           _SlidePrevTime;
00174 static WM_HWIN            _hAlert[NUM_ALERTS];
00175 static WM_HWIN            _hDialogLight;
00176 static WM_HWIN            _hWinControl;
00177 static WM_HWIN            _hWinHouse;
00178 static WM_HWIN            _hWinMap;
00179 static float              _LogoAngle    = 0;
00180 static float              _LogoDivisor;
00181 static int                _AlertCnt[NUM_ALERTS];
00182 static int                _LogoWaitTime = 1000 / UPS;
00183 static int                _LogoRPM      = RPM;
00184 static int                _ExecuteCommands;
00185 static int                _ScrollPrevTime;
00186 static int                _LogoPrevTime;
00187 static int                _LogoPrevMulX;
00188 static int                _InitDialog;
00189 static int                _LogoMulX;
00190 
00191 static LEVEL _Level[6] = {
00192   { { 0, 0, { 35, 650, 164, 780 } }, 0 },
00193   { { 0, 0, { 35, 520, 164, 650 } }, 0 },
00194   { { 0, 0, { 35, 390, 164, 520 } }, 0 },
00195   { { 0, 0, { 35, 260, 164, 390 } }, 0 },
00196   { { 0, 0, { 35, 130, 164, 260 } }, 0 },
00197   { { 0, 0, { 35,   0, 164, 130 } }, 0 }
00198 };
00199 
00200 static ELEVATOR _Elevator = {
00201   { 0, 0, { 57, 130, 83, 780 } }, // Elevator
00202   { 0, 0, { 57,  82, 83, 125 } }, // Elevator door
00203   0, { 0, 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0
00204 };
00205 
00206 static LOGO   _Logo;
00207 static OBJECT _Garage         = { 0, 0, {  40, 732,  90, 776 } };
00208 static OBJECT _Jalousie1      = { 0, 0, { 165, 400, 167, 493 } };
00209 static OBJECT _Jalousie2      = { 0, 0, {  32, 140,  34, 233 } };
00210 static OBJECT _Marquee1       = { 0, 0, { 165, 549, 196, 566 } };
00211 static OBJECT _Marquee2       = { 0, 0, {   3, 289,  34, 306 } };
00212 static OBJECT _Scroll         = { 0, 0, {   0,   0, 199, 780 } };
00213 static OBJECT _LogoArrow      = { 0, 0, {  58,  69, 139, 100 } };
00214 static OBJECT _LogoLarge      = { 0, 0, {  58,  46, 139,  69 } };
00215 static OBJECT _LogoSmall      = { 0, 0, {   7,   8,  47,  19 } };
00216 static OBJECT _GarageSmall    = { 0, 0, {  10, 220,  24, 232 } };
00217 static OBJECT _Jalousie1Small = { 0, 0, {  48, 120,  49, 147 } };
00218 static OBJECT _Jalousie2Small = { 0, 0, {   6,  42,   7,  69 } };
00219 static OBJECT _Marquee1Small  = { 0, 0, {  48, 166,  55, 170 } };
00220 static OBJECT _Marquee2Small  = { 0, 0, {   0,  88,   7,  92 } };
00221 static OBJECT _ElevatorSmall  = { 0, 0, {  14,  40,  23, 233 } };
00222 static OBJECT _LightSmall[6] = {
00223   { 0, 0, { 8, 195, 48, 234 } },
00224   { 0, 0, { 8, 156, 48, 195 } },
00225   { 0, 0, { 8, 117, 48, 156 } },
00226   { 0, 0, { 8,  78, 48, 117 } },
00227   { 0, 0, { 8,  39, 48,  78 } },
00228   { 0, 0, { 8,   0, 48,  39 } },
00229 };
00230 
00231 /*********************************************************************
00232 *
00233 *       Static data, dialog resource
00234 *
00235 **********************************************************************
00236 */
00237 /*********************************************************************
00238 *
00239 *       DialogLight
00240 */
00241 static const GUI_WIDGET_CREATE_INFO _aDialogLight[] = {
00242   { WINDOW_CreateIndirect, "",           0,               0,   0, 113, 140, WM_CF_SHOW   },
00243   { TEXT_CreateIndirect,     "5.Floor:", 0,               5,   8,  40,  23, TEXT_CF_LEFT },
00244   { TEXT_CreateIndirect,     "4.Floor:", 0,               5,  33,  40,  23, TEXT_CF_LEFT },
00245   { TEXT_CreateIndirect,     "3.Floor:", 0,               5,  58,  40,  23, TEXT_CF_LEFT },
00246   { TEXT_CreateIndirect,     "2.Floor:", 0,               5,  83,  40,  23, TEXT_CF_LEFT },
00247   { TEXT_CreateIndirect,     "1.Floor:", 0,               5, 108,  40,  23, TEXT_CF_LEFT },
00248   { SLIDER_CreateIndirect,   NULL,       GUI_ID_SLIDER4, 45,   4,  64,  23, 0            },
00249   { SLIDER_CreateIndirect,   NULL,       GUI_ID_SLIDER3, 45,  29,  64,  23, 0            },
00250   { SLIDER_CreateIndirect,   NULL,       GUI_ID_SLIDER2, 45,  54,  64,  23, 0            },
00251   { SLIDER_CreateIndirect,   NULL,       GUI_ID_SLIDER1, 45,  79,  64,  23, 0            },
00252   { SLIDER_CreateIndirect,   NULL,       GUI_ID_SLIDER0, 45, 104,  64,  23, 0            }
00253 };
00254 
00255 /*********************************************************************
00256 *
00257 *       DialogMisc
00258 */
00259 static const GUI_WIDGET_CREATE_INFO _aDialogMisc[] = {
00260   { WINDOW_CreateIndirect, "",           0,               0,   0, 113, 140, WM_CF_SHOW      },
00261   { BUTTON_CreateIndirect, "Jalousie 1", GUI_ID_BUTTON0,  5,   3, 103,  19, TEXT_CF_HCENTER },
00262   { BUTTON_CreateIndirect, "Jalousie 2", GUI_ID_BUTTON1,  5,  24, 103,  19, TEXT_CF_HCENTER },
00263   { BUTTON_CreateIndirect, "Marquee 1",  GUI_ID_BUTTON2,  5,  45, 103,  19, TEXT_CF_HCENTER },
00264   { BUTTON_CreateIndirect, "Marquee 2",  GUI_ID_BUTTON3,  5,  66, 103,  19, TEXT_CF_HCENTER },
00265   { BUTTON_CreateIndirect, "Garage",     GUI_ID_BUTTON4,  5,  87, 103,  19, TEXT_CF_HCENTER },
00266   { BUTTON_CreateIndirect, "<",          GUI_ID_BUTTON5,  5, 108,  20,  19, TEXT_CF_HCENTER },
00267   { BUTTON_CreateIndirect, "LogoStop",   GUI_ID_BUTTON6, 27, 108,  59,  19, TEXT_CF_HCENTER },
00268   { BUTTON_CreateIndirect, ">",          GUI_ID_BUTTON7, 88, 108,  20,  19, TEXT_CF_HCENTER }
00269 };
00270 
00271 /*********************************************************************
00272 *
00273 *       DialogElev
00274 */
00275 static const GUI_WIDGET_CREATE_INFO _aDialogElev[] = {
00276   { WINDOW_CreateIndirect, "",      0,               9,  8, 113, 140, WM_CF_SHOW      },
00277   { BUTTON_CreateIndirect, "",      GUI_ID_BUTTON4, 16, 21,  16,  16, TEXT_CF_HCENTER },
00278   { BUTTON_CreateIndirect, "",      GUI_ID_BUTTON3, 16, 39,  16,  16, TEXT_CF_HCENTER },
00279   { BUTTON_CreateIndirect, "",      GUI_ID_BUTTON2, 16, 57,  16,  16, TEXT_CF_HCENTER },
00280   { BUTTON_CreateIndirect, "",      GUI_ID_BUTTON1, 16, 75,  16,  16, TEXT_CF_HCENTER },
00281   { BUTTON_CreateIndirect, "",      GUI_ID_BUTTON0, 16, 93,  16,  16, TEXT_CF_HCENTER },
00282   { BUTTON_CreateIndirect, "Door",  GUI_ID_BUTTON5, 42, 21,  53,  16, TEXT_CF_HCENTER },
00283   { BUTTON_CreateIndirect, "Pause", GUI_ID_BUTTON6, 42, 39,  53,  16, TEXT_CF_HCENTER }
00284 };
00285 
00286 /*********************************************************************
00287 *
00288 *       Static data, polygons
00289 *
00290 **********************************************************************
00291 */
00292 /*********************************************************************
00293 *
00294 *       Arrows
00295 */
00296 static const GUI_POINT _aArrowUp[] = {
00297   { 1, 0 }, { 4, 3 }, {  1, 3 }, { 1, 8 }, 
00298   { 0, 8 }, { 0, 3 }, { -3, 3 }, { 0, 0 }
00299 };
00300 
00301 static const GUI_POINT _aArrowDown[] = {
00302   { 1, 8 }, { 4, 5 }, {  1, 5 }, { 1, 0 },
00303   { 0, 0 }, { 0, 5 }, { -3, 5 }, { 0, 8 }
00304 };
00305 
00306 static GUI_POINT _aArrowRight[] = {
00307   { 0, 0 }, { 5, 0 }, { 5, -3 }, { 8, 0 },
00308   { 8, 1 }, { 5, 4 }, { 5, 1  }, { 0, 1 }
00309 };
00310 
00311 static GUI_POINT _aArrowLeft[] = {
00312   { 0, 0 }, { 3, -3 }, { 3, 0 }, { 8, 0 },
00313   { 8, 1 }, { 3, 1  }, { 3, 4 }, { 0, 1 }
00314 };
00315 
00316 /*********************************************************************
00317 *
00318 *       Roof
00319 */
00320 static GUI_POINT _aRoof[] = {
00321   { 0, 0 }, { 75, 60 }, { -75, 60 }
00322 };
00323 
00324 static GUI_POINT _aRoofMini[] = {
00325   { 0, 0 }, { 119, 90 }, { -119, 90 }
00326 };
00327 
00328 /*********************************************************************
00329 *
00330 *       Static data, bitmaps
00331 *
00332 **********************************************************************
00333 */
00334 #ifdef NEC_HOUSE
00335 
00336   /*********************************************************************
00337   *
00338   *       NEC_Logo
00339   */
00340   static const GUI_COLOR _ColorsLogoNEC[] = {
00341 #if (GUI_USE_ARGB == 1)
00342     0xFF000000, 0xFF000096, 0xFF0000A1, 0xFF00009B
00343     0xFF0000A9, 0xFF0000B0, 0xFF0000B8, 0xFF0000BD
00344     0xFF2323CC, 0xFF1919C2, 0xFF0000B5, 0xFF0000AC
00345     0xFF2020C9, 0xFF0000BA, 0xFF0000C7, 0xFF0000A4
00346 #else
00347     0x000000, 0x960000, 0xA10000, 0x9B0000
00348     0xA90000, 0xB00000, 0xB80000, 0xBD0000
00349     0xCC2323, 0xC21919, 0xB50000, 0xAC0000
00350     0xC92020, 0xBA0000, 0xC70000, 0xA40000
00351 #endif
00352   };
00353 
00354   static const GUI_LOGPALETTE _PalLogoNEC = {
00355     16, // Number of entries
00356     1,  // No transparency
00357     &_ColorsLogoNEC[0]
00358   };
00359 
00360   static const unsigned char _acLogoNEC[] = {
00361     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00362     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00363     0x01, 0x22, 0x22, 0x22, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x22, 0x21, 0x00, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x01, 0x24, 0x56, 0x77, 0x88, 0x88, 0x97, 0x76, 0xAB, 0x30,
00364     0x02, 0xCC, 0xCC, 0xCC, 0xC8, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xCC, 0xC3, 0x00, 0x7C, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xC7, 0x00, 0x00, 0x00, 0x2A, 0x9C, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x50,
00365     0x02, 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0x10, 0x00, 0x00, 0x00, 0x00, 0x08, 0xCC, 0xC3, 0x00, 0x7C, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xC7, 0x00, 0x00, 0x27, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xE8, 0x8E, 0xCC, 0xCC, 0x50,
00366     0x02, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x08, 0xCC, 0xC3, 0x00, 0x7C, 0xCC, 0xCC, 0xCC, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x7A, 0x00, 0x0F, 0xCC, 0xCC, 0xCC, 0xCC, 0xCE, 0xA4, 0x30, 0x00, 0x00, 0x03, 0x24, 0x20,
00367     0x02, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCA, 0x00, 0x00, 0x00, 0x00, 0x08, 0xCC, 0xC3, 0x00, 0x7C, 0xCC, 0xCC, 0xCC, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0xCC, 0xCC, 0xCC, 0xCC, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00368     0x02, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x50, 0x00, 0x00, 0x00, 0x08, 0xCC, 0xC3, 0x00, 0x7C, 0xCC, 0xCC, 0xCC, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xCC, 0xCC, 0xCC, 0xC5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00369     0x02, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCB, 0x00, 0x00, 0x00, 0x08, 0xCC, 0xC3, 0x00, 0x7C, 0xCC, 0xCC, 0xCC, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xCC, 0xCC, 0xCC, 0xCC, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00370     0x02, 0xCC, 0xC6, 0x6C, 0xCC, 0xCC, 0xCC, 0xCC, 0xF0, 0x00, 0x00, 0x08, 0xCC, 0xC3, 0x00, 0x7C, 0xCC, 0xCC, 0xCC, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0xCC, 0xCC, 0xCC, 0xCC, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00371     0x02, 0xCC, 0xCA, 0x17, 0xCC, 0xCC, 0xCC, 0xCC, 0xC2, 0x00, 0x00, 0x08, 0xCC, 0xC3, 0x00, 0x7C, 0xCC, 0xCC, 0xCC, 0x74, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x30, 0x06, 0xCC, 0xCC, 0xCC, 0xCC, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00372     0x02, 0xCC, 0xCA, 0x01, 0x9C, 0xCC, 0xCC, 0xCC, 0xCE, 0x30, 0x00, 0x08, 0xCC, 0xC3, 0x00, 0x7C, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x40, 0x07, 0xCC, 0xCC, 0xCC, 0xCC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00373     0x02, 0xCC, 0xCA, 0x00, 0xF8, 0xCC, 0xCC, 0xCC, 0xCC, 0x83, 0x00, 0x08, 0xCC, 0xC3, 0x00, 0x7C, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x40, 0x08, 0xCC, 0xCC, 0xCC, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00374     0x02, 0xCC, 0xCA, 0x00, 0x03, 0xEC, 0xCC, 0xCC, 0xCC, 0xC9, 0xF0, 0x08, 0xCC, 0xC3, 0x00, 0x7C, 0xCC, 0xCC, 0xCC, 0x95, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x30, 0x09, 0xCC, 0xCC, 0xCC, 0xCC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00375     0x02, 0xCC, 0xCA, 0x00, 0x00, 0x2C, 0xCC, 0xCC, 0xCC, 0xCC, 0x71, 0x08, 0xCC, 0xC3, 0x00, 0x7C, 0xCC, 0xCC, 0xCC, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0xCC, 0xCC, 0xCC, 0xCC, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00376     0x02, 0xCC, 0xCA, 0x00, 0x00, 0x0F, 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0x08, 0xCC, 0xC3, 0x00, 0x7C, 0xCC, 0xCC, 0xCC, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xCC, 0xCC, 0xCC, 0xCC, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00377     0x02, 0xCC, 0xCA, 0x00, 0x00, 0x00, 0xBC, 0xCC, 0xCC, 0xCC, 0xCC, 0x68, 0xCC, 0xC3, 0x00, 0x7C, 0xCC, 0xCC, 0xCC, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xCC, 0xCC, 0xCC, 0xCC, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00378     0x02, 0xCC, 0xCA, 0x00, 0x00, 0x00, 0x05, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xC3, 0x00, 0xDC, 0xCC, 0xCC, 0xCC, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xEC, 0xCC, 0xCC, 0xCC, 0xC5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00379     0x02, 0xCC, 0xCA, 0x00, 0x00, 0x00, 0x00, 0xAC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xC3, 0x00, 0xAC, 0xCC, 0xCC, 0xCC, 0xC2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBC, 0xCC, 0xCC, 0xCC, 0xCC, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00380     0x02, 0xCC, 0xCA, 0x00, 0x00, 0x00, 0x00, 0x0D, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xC3, 0x00, 0x4C, 0xCC, 0xCC, 0xCC, 0xCC, 0x65, 0xB4, 0x44, 0x44, 0x44, 0x44, 0x4B, 0x00, 0x07, 0xCC, 0xCC, 0xCC, 0xCC, 0xC8, 0x52, 0x10, 0x00, 0x00, 0x03, 0x24, 0x40,
00381     0x02, 0xCC, 0xCA, 0x00, 0x00, 0x00, 0x00, 0x01, 0x7C, 0xCC, 0xCC, 0xCC, 0xCC, 0xC3, 0x00, 0x19, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x00, 0x01, 0xAC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCE, 0x88, 0x8E, 0xCC, 0xCC, 0x70,
00382     0x02, 0xCC, 0xCA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1D, 0xCC, 0xCC, 0xCC, 0xCC, 0xC3, 0x00, 0x03, 0x7C, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x00, 0x00, 0x03, 0xAE, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x70,
00383     0x03, 0xAA, 0xA4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0xAA, 0xAA, 0xAA, 0xA1, 0x00, 0x00, 0x02, 0xB6, 0x77, 0x79, 0x88, 0x88, 0x88, 0x88, 0x77, 0x77, 0x6A, 0x00, 0x00, 0x00, 0x01, 0xF5, 0x78, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xC8, 0xA0,
00384     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x32, 0x22, 0x22, 0x22, 0x33, 0x00, 0x00,
00385     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00386     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
00387   };
00388 
00389   static const GUI_BITMAP _LogoBitmap = {
00390    82, // XSize
00391    26, // YSize
00392    41, // BytesPerLine
00393     4, // BitsPerPixel
00394    _acLogoNEC,   // Pointer to picture data (indices)
00395    &_PalLogoNEC  // Pointer to palette
00396   };
00397 
00398   #define LOGOMULX 1000
00399   #define LOGOMULY 1000
00400 
00401 #else
00402 
00403   /*********************************************************************
00404   *
00405   *       SEGGER_Logo
00406   */
00407   static const GUI_COLOR _ColorsLogoSegger[] = {
00408 #if (GUI_USE_ARGB == 1)
00409     0xFFFF0000, 0xFF000028, 0xFF000050, 0xFF000078,
00410     0xFF0000A0, 0xFFCDCDCC, 0xFFF4F4F4, 0xFFFFFFFF,
00411     0xFFCACAFF, 0xFF0000FF, 0xFF9191FF, 0xFF5656FF,
00412     0xFFA2A09F, 0xFF646260, 0xFF000000, 0xFF1F1F1F
00413 #else
00414     0x0000FF, 0x280000, 0x500000, 0x780000,
00415     0xA00000, 0xCCCDCD, 0xF4F4F4, 0xFFFFFF,
00416     0xFFCACA, 0xFF0000, 0xFF9191, 0xFF5656,
00417     0x9FA0A2, 0x606264, 0x000000, 0x1F1F1F
00418 #endif
00419   };
00420 
00421   static const GUI_LOGPALETTE _PalLogoSegger = {
00422     16, // Number of entries
00423     1,  // Has transparency
00424     &_ColorsLogoSegger[0]
00425   };
00426 
00427   static const unsigned char _acLogoSegger[] = {
00428     0x00, 0x12, 0x34, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x43, 0x21, 0x00,
00429     0x02, 0x34, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x43, 0x20,
00430     0x13, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x31,
00431     0x24, 0x44, 0x56, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x65, 0x44, 0x42,
00432     0x34, 0x45, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x54, 0x43,
00433     0x44, 0x46, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00434     0x44, 0x46, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00435     0x44, 0x46, 0x77, 0x77, 0x76, 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00436     0x44, 0x46, 0x77, 0x77, 0x89, 0x9A, 0x77, 0x77, 0x77, 0x77, 0x77, 0x69, 0x9A, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00437     0x44, 0x46, 0x77, 0x76, 0x99, 0x99, 0x87, 0x77, 0x77, 0x77, 0x77, 0x99, 0x99, 0xA7, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00438     0x44, 0x46, 0x77, 0x76, 0x99, 0x99, 0x96, 0x77, 0x77, 0x77, 0x77, 0x99, 0x99, 0x98, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00439     0x44, 0x46, 0x77, 0x77, 0xA9, 0x99, 0x9B, 0x77, 0x77, 0x77, 0x77, 0x89, 0x99, 0x99, 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00440     0x44, 0x46, 0x77, 0x77, 0x7B, 0x99, 0x99, 0xA7, 0x77, 0x77, 0x77, 0x7A, 0x99, 0x99, 0xA7, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00441     0x44, 0x46, 0x77, 0x77, 0x76, 0x99, 0x99, 0x98, 0x77, 0x77, 0x77, 0x77, 0xB9, 0x99, 0x98, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00442     0x44, 0x46, 0x77, 0x77, 0x77, 0x89, 0x99, 0x99, 0x67, 0x77, 0x77, 0x77, 0x89, 0x99, 0x99, 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00443     0x44, 0x46, 0x77, 0x77, 0x77, 0x7A, 0x99, 0x99, 0xB7, 0x77, 0x77, 0x77, 0x7A, 0x99, 0x99, 0xB7, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00444     0x44, 0x46, 0x77, 0x77, 0x77, 0x77, 0xB9, 0x99, 0x9A, 0x77, 0x77, 0x77, 0x77, 0xB9, 0x99, 0x9A, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00445     0x44, 0x46, 0x77, 0x77, 0x77, 0x77, 0x69, 0x99, 0x99, 0x87, 0x77, 0x77, 0x77, 0x69, 0x99, 0x99, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00446     0x44, 0x46, 0x77, 0x77, 0x77, 0x77, 0x78, 0x99, 0x99, 0x96, 0x77, 0x77, 0x77, 0x78, 0x99, 0x99, 0xB6, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00447     0x44, 0x46, 0x77, 0x77, 0x77, 0x77, 0x77, 0xA9, 0x99, 0x9A, 0x77, 0x77, 0x77, 0x77, 0xA9, 0x99, 0x9A, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00448     0x44, 0x46, 0x77, 0x77, 0x77, 0x77, 0x77, 0x6B, 0x99, 0x99, 0xA7, 0x77, 0x77, 0x77, 0x6B, 0x99, 0x99, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00449     0x44, 0x46, 0x77, 0x66, 0x77, 0x77, 0x77, 0x76, 0x99, 0x99, 0x98, 0x77, 0x77, 0x77, 0x78, 0x99, 0x99, 0x96, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00450     0x44, 0x46, 0x77, 0x6B, 0x67, 0x77, 0x77, 0x77, 0x89, 0x99, 0x99, 0x67, 0x77, 0x77, 0x77, 0xA9, 0x99, 0x9B, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00451     0x44, 0x46, 0x77, 0x69, 0xB6, 0x77, 0x77, 0x77, 0x7A, 0x99, 0x99, 0xB7, 0x77, 0x77, 0x77, 0x7B, 0x99, 0x99, 0xA7, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00452     0x44, 0x46, 0x77, 0x79, 0x9A, 0x77, 0x77, 0x77, 0x76, 0xB9, 0x99, 0x9A, 0x77, 0x77, 0x77, 0x76, 0x99, 0x99, 0x98, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00453     0x44, 0x46, 0x77, 0x69, 0x99, 0x87, 0x77, 0x77, 0x77, 0x69, 0x99, 0x99, 0x87, 0x77, 0x77, 0x77, 0x89, 0x99, 0x9B, 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00454     0x44, 0x46, 0x77, 0x79, 0x99, 0x96, 0x77, 0x77, 0x77, 0x78, 0x99, 0x99, 0x96, 0x77, 0x77, 0x77, 0x7A, 0x99, 0x99, 0xA7, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00455     0x44, 0x46, 0x77, 0x69, 0x99, 0x9B, 0x77, 0x77, 0x77, 0x77, 0xA9, 0x99, 0x9B, 0x77, 0x77, 0x77, 0x76, 0xB9, 0x99, 0x98, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x77, 0x77, 0x77, 0x64, 0x44,
00456     0x44, 0x46, 0x77, 0x79, 0x99, 0x99, 0xA7, 0x77, 0x77, 0x77, 0x6B, 0x99, 0x99, 0xA7, 0x77, 0x77, 0x77, 0x89, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x98, 0x77, 0x77, 0x64, 0x44,
00457     0x44, 0x46, 0x77, 0x69, 0x99, 0x99, 0x98, 0x77, 0x77, 0x77, 0x76, 0x99, 0x99, 0x98, 0x77, 0x77, 0x77, 0x7A, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x67, 0x77, 0x64, 0x44,
00458     0x44, 0x46, 0x77, 0x79, 0x99, 0x99, 0x99, 0x67, 0x77, 0x77, 0x77, 0x89, 0x99, 0x99, 0x67, 0x77, 0x77, 0x77, 0xB9, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x67, 0x77, 0x64, 0x44,
00459     0x44, 0x46, 0x77, 0x69, 0x99, 0x99, 0x99, 0xB7, 0x77, 0x77, 0x77, 0x7A, 0x99, 0x99, 0xB7, 0x77, 0x77, 0x77, 0x69, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x9A, 0x77, 0x77, 0x64, 0x44,
00460     0x44, 0x46, 0x77, 0x79, 0x99, 0x99, 0x99, 0x9A, 0x77, 0x77, 0x77, 0x76, 0xB9, 0x99, 0x98, 0x77, 0x77, 0x77, 0x77, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x67, 0x77, 0x77, 0x64, 0x44,
00461     0x44, 0x46, 0x77, 0x69, 0x99, 0x99, 0x99, 0x9A, 0x77, 0x77, 0x77, 0x77, 0xB9, 0x99, 0x98, 0x77, 0x77, 0x77, 0x77, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x64, 0x44,
00462     0x44, 0x46, 0x77, 0x79, 0x99, 0x99, 0x99, 0xB7, 0x77, 0x77, 0x77, 0x7A, 0x99, 0x99, 0xB7, 0x77, 0x77, 0x77, 0x6B, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x9A, 0x77, 0x77, 0x64, 0x44,
00463     0x44, 0x46, 0x77, 0x69, 0x99, 0x99, 0x99, 0x67, 0x77, 0x77, 0x77, 0x89, 0x99, 0x99, 0x77, 0x77, 0x77, 0x77, 0xB9, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x67, 0x77, 0x64, 0x44,
00464     0x44, 0x46, 0x77, 0x79, 0x99, 0x99, 0x98, 0x77, 0x77, 0x77, 0x76, 0x99, 0x99, 0x98, 0x77, 0x77, 0x77, 0x7A, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x67, 0x77, 0x64, 0x44,
00465     0x44, 0x46, 0x77, 0x69, 0x99, 0x99, 0xA7, 0x77, 0x77, 0x77, 0x7B, 0x99, 0x99, 0xA7, 0x77, 0x77, 0x77, 0x89, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x98, 0x77, 0x77, 0x64, 0x44,
00466     0x44, 0x46, 0x77, 0x79, 0x99, 0x9B, 0x77, 0x77, 0x77, 0x77, 0xA9, 0x99, 0x9B, 0x77, 0x77, 0x77, 0x76, 0xB9, 0x99, 0x98, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x77, 0x77, 0x77, 0x64, 0x44,
00467     0x44, 0x46, 0x77, 0x69, 0x99, 0x96, 0x77, 0x77, 0x77, 0x78, 0x99, 0x99, 0x97, 0x77, 0x77, 0x77, 0x7A, 0x99, 0x99, 0xA7, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00468     0x44, 0x46, 0x77, 0x79, 0x99, 0x87, 0x77, 0x77, 0x77, 0x69, 0x99, 0x99, 0x87, 0x77, 0x77, 0x77, 0x89, 0x99, 0x9B, 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00469     0x44, 0x46, 0x77, 0x69, 0x9A, 0x77, 0x77, 0x77, 0x77, 0xB9, 0x99, 0x9A, 0x77, 0x77, 0x77, 0x76, 0x99, 0x99, 0x98, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00470     0x44, 0x46, 0x77, 0x79, 0xB7, 0x77, 0x77, 0x77, 0x7A, 0x99, 0x99, 0xB7, 0x77, 0x77, 0x77, 0x7B, 0x99, 0x99, 0xA7, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00471     0x44, 0x46, 0x77, 0x6B, 0x67, 0x77, 0x77, 0x77, 0x89, 0x99, 0x99, 0x67, 0x77, 0x77, 0x77, 0xA9, 0x99, 0x9B, 0x77, 0x77, 0x77, 0x75, 0xCC, 0xDC, 0xC6, 0x77, 0x77, 0x77, 0x55, 0x55, 0x55, 0x55, 0x55, 0x67, 0x77, 0x77, 0x75, 0xCC, 0xDC, 0xC6, 0x77, 0x77, 0x77, 0x77, 0x76, 0x5C, 0xDC, 0xCC, 0x67, 0x77, 0x77, 0x77, 0x55, 0x55, 0x55, 0x55, 0x55, 0x77, 0x77, 0x55, 0x55, 0x55, 0x55, 0x67, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00472     0x44, 0x46, 0x77, 0x66, 0x77, 0x77, 0x77, 0x76, 0x99, 0x99, 0x98, 0x77, 0x77, 0x77, 0x78, 0x99, 0x99, 0x96, 0x77, 0x77, 0x75, 0xDE, 0xEE, 0xEE, 0xEE, 0xC6, 0x77, 0x7C, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xD7, 0x77, 0x75, 0xDE, 0xEE, 0xEE, 0xEE, 0xD6, 0x77, 0x77, 0x77, 0xCE, 0xEE, 0xEE, 0xEE, 0xEC, 0x77, 0x77, 0x7D, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xC7, 0x7C, 0xEE, 0xEE, 0xEE, 0xEE, 0xED, 0x57, 0x77, 0x77, 0x77, 0x64, 0x44,
00473     0x44, 0x46, 0x77, 0x77, 0x77, 0x77, 0x77, 0x7B, 0x99, 0x99, 0xA7, 0x77, 0x77, 0x77, 0x6B, 0x99, 0x99, 0x87, 0x77, 0x77, 0x6E, 0xEE, 0xED, 0xDD, 0xEE, 0xED, 0x77, 0x7D, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xD7, 0x77, 0xCE, 0xEE, 0xED, 0xDE, 0xEE, 0xED, 0x67, 0x77, 0x7D, 0xEE, 0xEE, 0xDD, 0xEE, 0xEE, 0xD7, 0x77, 0x6F, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xC7, 0x7D, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xE5, 0x77, 0x77, 0x77, 0x64, 0x44,
00474     0x44, 0x46, 0x77, 0x77, 0x77, 0x77, 0x77, 0xA9, 0x99, 0x9B, 0x77, 0x77, 0x77, 0x77, 0xA9, 0x99, 0x9A, 0x77, 0x77, 0x77, 0xCE, 0xED, 0x67, 0x76, 0xCE, 0xEE, 0x67, 0x7D, 0xEE, 0xD5, 0x55, 0x55, 0x55, 0x77, 0x75, 0xEE, 0xED, 0x56, 0x76, 0xCE, 0xEE, 0xC7, 0x77, 0xCE, 0xEE, 0xD6, 0x67, 0x6C, 0xEE, 0xE5, 0x77, 0x6D, 0xEE, 0xC5, 0x55, 0x55, 0x56, 0x77, 0x6D, 0xEE, 0xC5, 0x55, 0x5C, 0xEE, 0xED, 0x77, 0x77, 0x77, 0x64, 0x44,
00475     0x44, 0x46, 0x77, 0x77, 0x77, 0x77, 0x78, 0x99, 0x99, 0x96, 0x77, 0x77, 0x77, 0x78, 0x99, 0x99, 0xB6, 0x77, 0x77, 0x77, 0xDE, 0xED, 0x77, 0x77, 0x75, 0xDC, 0x77, 0x7D, 0xEE, 0xC7, 0x77, 0x77, 0x77, 0x77, 0x7D, 0xEE, 0xD7, 0x77, 0x77, 0x7C, 0xED, 0x57, 0x76, 0xDE, 0xED, 0x77, 0x77, 0x77, 0xCE, 0xD6, 0x77, 0x6F, 0xEE, 0x57, 0x77, 0x77, 0x77, 0x77, 0x7D, 0xEE, 0xC7, 0x77, 0x77, 0xCE, 0xED, 0x77, 0x77, 0x77, 0x64, 0x44,
00476     0x44, 0x46, 0x77, 0x77, 0x77, 0x77, 0x69, 0x99, 0x99, 0x87, 0x77, 0x77, 0x77, 0x69, 0x99, 0x99, 0x87, 0x77, 0x77, 0x77, 0xCE, 0xEE, 0xDC, 0x56, 0x77, 0x77, 0x77, 0x7D, 0xEE, 0xC6, 0x66, 0x66, 0x67, 0x77, 0x6E, 0xEE, 0xC7, 0x77, 0x77, 0x77, 0x77, 0x77, 0x75, 0xEE, 0xE5, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x7F, 0xEE, 0xC6, 0x66, 0x66, 0x67, 0x77, 0x6D, 0xEE, 0xC7, 0x77, 0x77, 0xDE, 0xED, 0x77, 0x77, 0x77, 0x64, 0x44,
00477     0x44, 0x46, 0x77, 0x77, 0x77, 0x77, 0xB9, 0x99, 0x9A, 0x77, 0x77, 0x77, 0x77, 0xB9, 0x99, 0x9A, 0x77, 0x77, 0x77, 0x77, 0x6D, 0xEE, 0xEE, 0xED, 0xDC, 0x67, 0x77, 0x7D, 0xEE, 0xEE, 0xEE, 0xEE, 0xED, 0x67, 0x5E, 0xEE, 0x67, 0x77, 0x76, 0x66, 0x66, 0x67, 0x7C, 0xEE, 0xE7, 0x77, 0x77, 0x66, 0x66, 0x67, 0x77, 0x6D, 0xEE, 0xEE, 0xEE, 0xEE, 0xEC, 0x67, 0x7D, 0xEE, 0xDC, 0xCC, 0xCD, 0xEE, 0xE5, 0x77, 0x77, 0x77, 0x64, 0x44,
00478     0x44, 0x46, 0x77, 0x77, 0x77, 0x7A, 0x99, 0x99, 0xB7, 0x77, 0x77, 0x77, 0x7A, 0x99, 0x99, 0xB7, 0x77, 0x77, 0x77, 0x77, 0x75, 0xCE, 0xEE, 0xEE, 0xEE, 0xEC, 0x77, 0x7D, 0xEE, 0xEE, 0xEE, 0xEE, 0xEF, 0x67, 0xCE, 0xEE, 0x67, 0x77, 0x5E, 0xEE, 0xEE, 0xD6, 0x7C, 0xEE, 0xD7, 0x77, 0x7C, 0xEE, 0xEE, 0xED, 0x67, 0x6F, 0xEE, 0xEE, 0xEE, 0xEE, 0xED, 0x77, 0x6D, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0x57, 0x77, 0x77, 0x77, 0x64, 0x44,
00479     0x44, 0x46, 0x77, 0x77, 0x77, 0x89, 0x99, 0x99, 0x67, 0x77, 0x77, 0x77, 0x89, 0x99, 0x99, 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x76, 0x5C, 0xDE, 0xEE, 0xEE, 0xC7, 0x7D, 0xEE, 0xD5, 0xC5, 0xC5, 0x55, 0x77, 0x5E, 0xEE, 0x57, 0x77, 0xCE, 0xEE, 0xEE, 0xE5, 0x7C, 0xEE, 0xE6, 0x77, 0x7C, 0xEE, 0xEE, 0xEE, 0x67, 0x6F, 0xEE, 0xCC, 0x55, 0xC5, 0x56, 0x77, 0x7D, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xC6, 0x77, 0x77, 0x77, 0x64, 0x44,
00480     0x44, 0x46, 0x77, 0x77, 0x76, 0x99, 0x99, 0x98, 0x77, 0x77, 0x77, 0x77, 0xB9, 0x99, 0x98, 0x77, 0x77, 0x77, 0x77, 0x77, 0x75, 0x57, 0x77, 0x77, 0xCE, 0xEE, 0xD7, 0x7D, 0xEE, 0xC7, 0x77, 0x77, 0x77, 0x77, 0x6E, 0xEE, 0xC7, 0x77, 0x75, 0x55, 0xDE, 0xE5, 0x75, 0xEE, 0xE5, 0x77, 0x76, 0x55, 0x5F, 0xEE, 0x67, 0x6D, 0xEE, 0x57, 0x77, 0x77, 0x77, 0x77, 0x6D, 0xEE, 0xC6, 0x66, 0x6C, 0xEE, 0xE5, 0x77, 0x77, 0x77, 0x64, 0x44,
00481     0x44, 0x46, 0x77, 0x77, 0x7B, 0x99, 0x99, 0xA7, 0x77, 0x77, 0x77, 0x7A, 0x99, 0x99, 0xA7, 0x77, 0x77, 0x77, 0x77, 0x77, 0xCE, 0xEC, 0x77, 0x77, 0x7C, 0xEE, 0xD6, 0x7D, 0xEE, 0xC7, 0x77, 0x77, 0x77, 0x77, 0x7D, 0xEE, 0xD6, 0x77, 0x77, 0x75, 0xEE, 0xE5, 0x77, 0xDE, 0xED, 0x67, 0x77, 0x77, 0xCE, 0xEE, 0x67, 0x6F, 0xEE, 0x57, 0x77, 0x77, 0x77, 0x77, 0x7D, 0xEE, 0xC7, 0x77, 0x76, 0xEE, 0xEC, 0x77, 0x77, 0x77, 0x64, 0x44,
00482     0x44, 0x46, 0x77, 0x77, 0xA9, 0x99, 0x9B, 0x77, 0x77, 0x77, 0x77, 0x89, 0x99, 0x99, 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0xCE, 0xEE, 0xC6, 0x76, 0x5D, 0xEE, 0xD7, 0x7D, 0xEE, 0xDC, 0xCC, 0xCC, 0xCC, 0x57, 0x75, 0xEE, 0xED, 0xC6, 0x66, 0xCE, 0xEE, 0xE5, 0x77, 0x5E, 0xEE, 0xD5, 0x66, 0x5C, 0xEE, 0xEE, 0x67, 0x7F, 0xEE, 0xCC, 0xCC, 0xCC, 0xCC, 0x67, 0x6D, 0xEE, 0xC7, 0x77, 0x77, 0xEE, 0xEC, 0x77, 0x77, 0x77, 0x64, 0x44,
00483     0x44, 0x46, 0x77, 0x76, 0x99, 0x99, 0x96, 0x77, 0x77, 0x77, 0x77, 0xB9, 0x99, 0x98, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x6D, 0xEE, 0xEE, 0xDE, 0xEE, 0xEE, 0x67, 0x7D, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xF5, 0x77, 0x5E, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xE5, 0x77, 0x7C, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0x67, 0x6D, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xF7, 0x7F, 0xEE, 0xC7, 0x77, 0x77, 0xDE, 0xED, 0x77, 0x77, 0x77, 0x64, 0x44,
00484     0x44, 0x46, 0x77, 0x76, 0x99, 0x99, 0x87, 0x77, 0x77, 0x77, 0x77, 0xB9, 0x99, 0xA7, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x76, 0xCE, 0xEE, 0xEE, 0xEE, 0xD5, 0x77, 0x75, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xF5, 0x77, 0x75, 0xDE, 0xEE, 0xEE, 0xEC, 0x5E, 0xE5, 0x77, 0x77, 0xCD, 0xEE, 0xEE, 0xEE, 0xC5, 0xEE, 0x67, 0x7D, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xD7, 0x7D, 0xEE, 0x57, 0x77, 0x77, 0xCE, 0xEC, 0x77, 0x77, 0x77, 0x64, 0x44,
00485     0x44, 0x46, 0x77, 0x77, 0x89, 0x9A, 0x77, 0x77, 0x77, 0x77, 0x77, 0x6B, 0x9B, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x76, 0xCC, 0xCC, 0xC5, 0x77, 0x77, 0x77, 0x65, 0x55, 0x55, 0x55, 0x55, 0x67, 0x77, 0x77, 0x75, 0xCC, 0xCC, 0x67, 0x75, 0xC7, 0x77, 0x77, 0x77, 0x5C, 0xCC, 0xC6, 0x76, 0xC5, 0x77, 0x77, 0x65, 0x55, 0x55, 0x55, 0x55, 0x77, 0x76, 0x55, 0x77, 0x77, 0x77, 0x65, 0x56, 0x77, 0x77, 0x77, 0x64, 0x44,
00486     0x44, 0x46, 0x77, 0x77, 0x76, 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00487     0x44, 0x46, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00488     0x44, 0x46, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x64, 0x44,
00489     0x34, 0x45, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x54, 0x43,
00490     0x24, 0x44, 0x56, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x65, 0x44, 0x42,
00491     0x13, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x31,
00492     0x02, 0x34, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x43, 0x20,
00493     0x00, 0x12, 0x34, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x43, 0x21, 0x00
00494   };
00495 
00496   static const GUI_BITMAP _LogoBitmap = {
00497    140, // XSize
00498    66,  // YSize
00499    70,  // BytesPerLine
00500    4,   // BitsPerPixel
00501    _acLogoSegger,   // Pointer to picture data (indices)
00502    &_PalLogoSegger  // Pointer to palette
00503   };
00504 
00505   #define LOGOMULX 600
00506   #define LOGOMULY 600
00507 
00508 #endif
00509 
00510 /*********************************************************************
00511 *
00512 *       TouchCursor
00513 */
00514 static const GUI_COLOR _ColorsTouchCursor[] = {
00515 #if (GUI_USE_ARGB == 1)
00516   0xFFFF0000, 0xFF000000, 0xFFFFFFFF
00517 #else
00518   0x0000FF, 0x000000, 0xFFFFFF
00519 #endif
00520 };
00521 
00522 static const GUI_LOGPALETTE _PalTouchCursor = {
00523   3,    // Number of entries
00524   1,    // Has transparency
00525   &_ColorsTouchCursor[0]
00526 };
00527 
00528 static const unsigned char _acTouchCursor[] = {
00529   0x00, 0x00, 0x00, 0x01, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x00, 0x00,
00530   0x00, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x00, 0x00,
00531   0x00, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x00, 0x00,
00532   0x00, 0x00, 0x00, 0x05, 0x94, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x55, 0x56, 0xA5, 0x55, 0x55, 0x55, 0x40,
00533   0x6A, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x40, 0x55, 0x55, 0x55, 0x56, 0xA5, 0x55, 0x55, 0x55, 0x40,
00534   0x00, 0x00, 0x00, 0x05, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x00, 0x00,
00535   0x00, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x00, 0x00,
00536   0x00, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x00, 0x00,
00537   0x00, 0x00, 0x00, 0x01, 0x50, 0x00, 0x00, 0x00, 0x00
00538 };
00539 
00540 static const GUI_BITMAP _bmTouchCursor = {
00541   33, // XSize
00542   17, // YSize
00543   9,  // BytesPerLine
00544   2,  // BitsPerPixel
00545   _acTouchCursor,   // Pointer to picture data (indices)
00546   &_PalTouchCursor  // Pointer to palette
00547 };
00548 
00549 static const GUI_CURSOR _TouchCursor = {
00550   &_bmTouchCursor, 16, 8
00551 };
00552 
00553 /*********************************************************************
00554 *
00555 *       Static code, serial interface
00556 *       (defined for target hardware only)
00557 *
00558 **********************************************************************
00559 */
00560 #ifndef WIN32
00561   /*********************************************************************
00562   *
00563   *       _cbReceiveData
00564   */
00565   static void _cbReceiveData(OS_U8 Data) {
00566     *(_RxBuffer.pWrite)++ = Data;
00567     if (_RxBuffer.pWrite == _RxBuffer.pDataEnd) {
00568       _RxBuffer.pWrite -= _RxBuffer.Size;
00569     }
00570   }
00571 
00572   /*********************************************************************
00573   *
00574   *       _SendString
00575   */
00576   static void _SendString(const char * pStr) {
00577     OS_SendString(pStr);
00578   }
00579 
00580   /*********************************************************************
00581   *
00582   *       _ConvIntToStr
00583   */
00584   static char * _ConvIntToStr(char * pStr, int Value) {
00585     char * Ptr;
00586     int    v;
00587 
00588     Ptr  = pStr + 4;
00589     *Ptr = 0;
00590     v    = Value;
00591     do {
00592       *(--Ptr) = (v % 10) + '0';
00593       v /= 10;
00594     } while (v && (Ptr != pStr));
00595     strcpy(pStr, Ptr);
00596     return pStr;
00597   }
00598 
00599   /*********************************************************************
00600   *
00601   *       _ConvStrToInt
00602   */
00603   static int _ConvStrToInt(char * pStr) {
00604     char * Ptr;
00605     int    r;
00606 
00607     Ptr = pStr;
00608     r   = 0;
00609     while (*Ptr) {
00610       r *= 10;
00611       r += *(Ptr++) - '0';
00612     }
00613     return r;
00614   }
00615 
00616   /*********************************************************************
00617   *
00618   *       _ReceivedString
00619   */
00620   static void _ReceivedString(const char * pStr) {
00621     char * Ptr;
00622     int    v1;
00623     int    v2;
00624 
00625     v1 = -1
00626     v2 = -1;
00627     Ptr = strrchr(pStr, ' ');
00628     if (Ptr != NULL) {
00629       v1 = _ConvStrToInt(Ptr + 1);
00630       *Ptr = 0;
00631     }
00632     Ptr = strrchr(pStr, ' ');
00633     if (Ptr != NULL) {
00634       v2 = v1;
00635       v1 = _ConvStrToInt(Ptr + 1);
00636       *Ptr = 0;
00637     }
00638     if (_pfcbReceiveCommand) {
00639       (*_pfcbReceiveCommand)(pStr, v1, v2);
00640     }
00641   }
00642 
00643   /*********************************************************************
00644   *
00645   *       _ReceivedChar
00646   */
00647   static void _ReceivedChar(char c) {
00648     if (c == EOL) {
00649       _pString = _acString;
00650       _ReceivedString(_acString);
00651     } else {
00652       if (_pString < (_acString + STRING_SIZE)) {
00653         if (c >= 'a' && c <= 'z') {
00654           c -= 'a' - 'A';
00655         }
00656         *_pString++     = c;
00657         *(_pString + 1) = 0;
00658       }
00659     }
00660   }
00661 #endif  // #ifndef WIN32
00662 
00663 /*********************************************************************
00664 *
00665 *       Static code, serial interface
00666 *
00667 **********************************************************************
00668 */
00669 /*********************************************************************
00670 *
00671 *       _SerialSendCommand
00672 */
00673 static void _SerialSendCommand(const char * pStr, int v1, int v2) {
00674   #ifndef WIN32
00675     char Str1[STRING_SIZE + 2];
00676     char Str2[5];
00677     int  Len;
00678     int  i;
00679     int  v;
00680 
00681     Str1[STRING_SIZE] = 0;
00682     strncpy(Str1, pStr, STRING_SIZE);
00683     for (i = 0; i < 2; i++) {
00684       v = (i == 0) ? v1 : v2;
00685       if (v >= 0 && v <= 999) {
00686         _ConvIntToStr(Str2, v);
00687         if ((strlen(Str1) + strlen(Str2) + 1) <= STRING_SIZE) {
00688           strcat(Str1, " ");
00689           strcat(Str1, Str2);
00690         }
00691       }
00692     }
00693     Len = strlen(Str1);
00694     Str1[Len]   = EOL;
00695     Str1[Len+1] = 0;
00696     _SendString(Str1);
00697   #else
00698     (void)pStr;
00699     (void)v1;
00700     (void)v2;
00701   #endif
00702 }
00703 
00704 /*********************************************************************
00705 *
00706 *       _SerialExec
00707 */
00708 static void _SerialExec(void) {
00709   #ifndef WIN32
00710     OS_U8 Data;
00711 
00712     while (_RxBuffer.pRead != _RxBuffer.pWrite) {
00713       Data = *(_RxBuffer.pRead)++;
00714       if (_RxBuffer.pRead == _RxBuffer.pDataEnd) {
00715         _RxBuffer.pRead -= _RxBuffer.Size;
00716       }
00717       _ReceivedChar((char)Data);
00718     }
00719   #endif
00720 }
00721 
00722 /*********************************************************************
00723 *
00724 *       _SerialInit
00725 */
00726 static void _SerialInit(SERIAL_Callback * cb) {
00727   #ifndef WIN32
00728     OS_SetRxCallback(&_cbReceiveData);
00729     _pfcbReceiveCommand = cb;
00730   #else
00731     (void)cb;
00732   #endif
00733 }
00734 
00735 /*********************************************************************
00736 *
00737 *       Static code, helper functions
00738 *
00739 **********************************************************************
00740 */
00741 /*********************************************************************
00742 *
00743 *       _SetSliderValue
00744 */
00745 static void _SetSliderValue(WM_HWIN hWin, int Id, int Min, int Max, int Value) {
00746   WM_HWIN hItem;
00747 
00748   hItem = WM_GetDialogItem(hWin, Id);
00749   SLIDER_SetRange(hItem, Min, Max);
00750   SLIDER_SetValue(hItem, Value);
00751 }
00752 
00753 /*********************************************************************
00754 *
00755 *       _GetSliderValue
00756 */
00757 static int _GetSliderValue(WM_HWIN hDlg, int Id) {
00758   return SLIDER_GetValue(WM_GetDialogItem(hDlg, Id));
00759 }
00760 
00761 /*********************************************************************
00762 *
00763 *       _AddDialog
00764 */
00765 static WM_HWIN _AddDialog(const char  * pText, const GUI_WIDGET_CREATE_INFO * pDialog, int NumItems,
00766                           WM_CALLBACK * cb,    WM_HWIN hMultiPage) {
00767   WM_HWIN hWin;
00768 
00769   hWin = GUI_CreateDialogBox(pDialog, NumItems, cb, WM_GetClientWindow(hMultiPage), 0, 0);
00770   MULTIPAGE_AddPage(hMultiPage, 0, pText);
00771   return hWin;
00772 }
00773 
00774 /*********************************************************************
00775 *
00776 *       _SetDialogLight
00777 */
00778 static void _SetDialogLight(void) {
00779   if (_hDialogLight) {
00780     _InitDialog = 1;
00781     _SetSliderValue(_hDialogLight, GUI_ID_SLIDER0, 0, 100, _Level[0].Light.ActV);
00782     _SetSliderValue(_hDialogLight, GUI_ID_SLIDER1, 0, 100, _Level[1].Light.ActV);
00783     _SetSliderValue(_hDialogLight, GUI_ID_SLIDER2, 0, 100, _Level[2].Light.ActV);
00784     _SetSliderValue(_hDialogLight, GUI_ID_SLIDER3, 0, 100, _Level[3].Light.ActV);
00785     _SetSliderValue(_hDialogLight, GUI_ID_SLIDER4, 0, 100, _Level[4].Light.ActV);
00786     _InitDialog = 0;
00787   }
00788 }
00789 
00790 /*********************************************************************
00791 *
00792 *       _InvalidateObject
00793 */
00794 static void _InvalidateObject(WM_HWIN hWin, GUI_RECT r) {
00795   r.y0 -= _Scroll.ActV;
00796   r.y1 -= _Scroll.ActV;
00797   WM_InvalidateRect(hWin, &r);
00798 }
00799 
00800 /*********************************************************************
00801 *
00802 *       _InvalidateObject2
00803 */
00804 static void _InvalidateObject2(WM_HWIN hWin, GUI_RECT r) {
00805   WM_InvalidateRect(hWin, &r);
00806 }
00807 
00808 /*********************************************************************
00809 *
00810 *       _InvalidateRect
00811 */
00812 static void _InvalidateRect(WM_HWIN hWin, GUI_RECT r, int xOff, int yOff) {
00813   r.x0 += xOff;
00814   r.x1 += xOff;
00815   r.y0 += yOff;
00816   r.y1 += yOff;
00817   WM_InvalidateRect(hWin, &r);
00818 }
00819 
00820 /*********************************************************************
00821 *
00822 *       _AlertOn
00823 */
00824 static void _AlertOn(int Index) {
00825   BUTTON_Handle hBut;
00826   WM_HWIN       hClient;
00827   int           Off;
00828 
00829   if (_hAlert[Index] == 0) {
00830     Off = Index * 10;
00831     _hAlert[Index] = FRAMEWIN_Create(_acAlertText[Index], 0, WM_CF_SHOW, 100 + Off, 85 + Off, 110, 60);
00832     FRAMEWIN_SetMoveable(_hAlert[Index], 1);
00833     FRAMEWIN_SetActive  (_hAlert[Index], 1);
00834     FRAMEWIN_SetBarColor(_hAlert[Index], 0, Index ? GUI_BLUE : GUI_RED);
00835     hClient = WM_GetClientWindow(_hAlert[Index]);
00836     WM_SetCallback(hClient, _cbWinAlert);
00837     hBut = BUTTON_CreateAsChild(20, 10, 65, 20, hClient, 1, WM_CF_SHOW);
00838     BUTTON_SetText(hBut, "OK");
00839     _AlertCnt[Index] = 250;
00840   }
00841 }
00842 
00843 /*********************************************************************
00844 *
00845 *       _AlertOff
00846 */
00847 static void _AlertOff(int Index) {
00848   if (_hAlert[Index]) {
00849     WM_DeleteWindow(_hAlert[Index]);
00850     _hAlert[Index]   = 0;
00851     _AlertCnt[Index] = 0;
00852   }
00853 }
00854 
00855 /*********************************************************************
00856 *
00857 *       _SlideValue
00858 */
00859 static int _SlideValue(OBJECT * pObj, int Step) {
00860   int DiffY;
00861 
00862   DiffY = pObj->NewV - pObj->ActV;
00863   if (DiffY != 0) {
00864     if (DiffY < 0) {
00865       pObj->ActV -= Step;
00866       DiffY = -DiffY;
00867     } else {
00868       pObj->ActV += Step;
00869     }
00870     if ((DiffY - Step) < 0) {
00871       pObj->ActV = pObj->NewV;
00872     }
00873     return 1;
00874   }
00875   return 0;
00876 }
00877 
00878 /*********************************************************************
00879 *
00880 *       _SlideStatus
00881 */
00882 static void _SlideStatus(void) {
00883   int Step;
00884 
00885   Step = ((GUI_GetTime() - _SlidePrevTime) * 5) >> 7;
00886   if (Step != 0) {
00887     _SlidePrevTime = GUI_GetTime();
00888     if (_SlideValue(&_Garage, Step * 2)) {
00889       _InvalidateObject(_hWinHouse, _Garage.Rect);
00890       _InvalidateObject2(_hWinMap, _GarageSmall.Rect);
00891     }
00892     if (_SlideValue(&_Jalousie1, Step)) {
00893       _InvalidateObject(_hWinHouse, _Jalousie1.Rect);
00894       _InvalidateObject2(_hWinMap, _Jalousie1Small.Rect);
00895     }
00896     if (_SlideValue(&_Jalousie2, Step)) {
00897       _InvalidateObject(_hWinHouse, _Jalousie2.Rect);
00898       _InvalidateObject2(_hWinMap, _Jalousie2Small.Rect);
00899     }
00900     if (_SlideValue(&_Marquee1, Step)) {
00901       _InvalidateObject(_hWinHouse, _Marquee1.Rect);
00902       _InvalidateObject2(_hWinMap, _Marquee1Small.Rect);
00903     }
00904     if (_SlideValue(&_Marquee2, Step)) {
00905       _InvalidateObject(_hWinHouse, _Marquee2.Rect);
00906       _InvalidateObject2(_hWinMap, _Marquee2Small.Rect);
00907     }
00908     if (_SlideValue(&_Elevator.Itself, Step)) {
00909       _InvalidateObject(_hWinHouse, _Elevator.Itself.Rect);
00910       _InvalidateObject2(_hWinMap, _ElevatorSmall.Rect);
00911     }
00912     if (_SlideValue(&_Elevator.Door, Step * 2)) {
00913       _InvalidateRect(_hWinHouse, _Elevator.Door.Rect, 0, _Elevator.Itself.ActV - _Scroll.ActV);
00914     }
00915     if (_AlertCnt[0]) {
00916       _AlertCnt[0] -= Step;
00917       if (_AlertCnt[0] <= 0) _AlertOff(0);
00918     }
00919     if (_AlertCnt[1]) {
00920       _AlertCnt[1] -= Step;
00921       if (_AlertCnt[1] <= 0) _AlertOff(1);
00922     }
00923   }
00924   Step = GUI_GetTime() - _ScrollPrevTime;
00925   if (Step != 0) {
00926     _ScrollPrevTime = GUI_GetTime();
00927     if (_SlideValue(&_Scroll, Step * 2)) {
00928       SCROLLBAR_SetValue(_hScroll, _Scroll.ActV);
00929       _InvalidateObject(_hWinHouse, _Scroll.Rect);
00930     }
00931   }
00932 }
00933 
00934 /*********************************************************************
00935 *
00936 *       _Clip
00937 */
00938 static int _Clip(int Value) {
00939   Value = (Value < 100) ? Value : 100;
00940   Value = (Value >   0) ? Value :   0;
00941   return Value;
00942 }
00943 
00944 /*********************************************************************
00945 *
00946 *       Static code, drawing functions
00947 *
00948 **********************************************************************
00949 */
00950 /*********************************************************************
00951 *
00952 *       _DrawRect
00953 */
00954 static void _DrawRect(int x0, int y0_, int x1, int y1_, int PenSize) {
00955   GUI_SetPenSize(PenSize);
00956   GUI_DrawRect(x0, y0_, x1, y1_ + PenSize - 1);
00957 }
00958 
00959 /*********************************************************************
00960 *
00961 *       _DrawElevator2
00962 */
00963 static void _DrawElevator2(int x,     int       y,   int w,  int h,
00964                            int x0,    int       y0_, int x1, int y1_,
00965                            int Index, GUI_COLOR Color) {
00966     const GUI_RECT * OldClipRect;
00967     GUI_RECT         ClipRect;
00968     int              Door;
00969 
00970 
00971   if (y0_ <= y1_ && x0 <= x1) {
00972     Door = (w - 2) * (100 - _Elevator.Door.ActV) / 100;
00973     ClipRect.x0 = x + x0;
00974     ClipRect.y0 = y + y0_;
00975     ClipRect.x1 = x + x1;
00976     ClipRect.y1 = y + y1_;
00977     OldClipRect = WM_SetUserClipRect(&ClipRect);
00978     //
00979     // Draw elevator car
00980     //
00981     GUI_SetColor(LCD_MixColors256(Color, GUI_GRAY, Index ? 150 : 0));
00982     GUI_FillRect(x, y, x + w, y + h);
00983     //
00984     // Draw door frame (inside)
00985     //
00986     GUI_SetColor(LCD_MixColors256(Color, GUI_WHITE, Index ? 150 : 0));
00987     _DrawRect(x, y, x + w, y + h, 1);
00988     //
00989     // Draw elevator door (inside)
00990     //
00991     GUI_SetColor(LCD_MixColors256(Color, GUI_LIGHTGRAY, Index ? 150 : 0));
00992     GUI_FillRect(x + 1, y + 1, x + 1 + Door, y + h - 1);
00993     WM_SetUserClipRect(OldClipRect);
00994   }
00995 }
00996 
00997 /*********************************************************************
00998 *
00999 *       _DrawElevator
01000 */
01001 static void _DrawElevator(int x, int y, int w, int h, int Level) {
01002   GUI_COLOR Color1;
01003   GUI_COLOR Color2;
01004   unsigned  Light;
01005   int       yStart;
01006   int       Door;
01007   int       yEnd;
01008   int       yPos;
01009   int       y0_;
01010   int       y1_;
01011 
01012   Light = _Level[Level].Light.ActV;
01013   //
01014   // Draw elevator shaft
01015   //
01016   Color1  = (0x8F * Light / 100 + 0x60) << 16;
01017   Color1 += (0x7F * Light / 100 + 0x0) << 8;
01018   Color1 += (0x6F * Light / 100 + 0x20);
01019   GUI_SetColor(GUI_MAKE_COLOR(Color1));
01020   GUI_FillRect(x, y, x + w, y + h);
01021   //
01022   // Draw elevator door (outside)
01023   //
01024   Color2 = 0x5F * Light / 100 + 0xA0;
01025   Color2 = (Color2 << 16 | Color2 << 8 | Color2);
01026   GUI_SetColor(GUI_MAKE_COLOR(Color2));
01027   GUI_FillRect(x + 2, y + 80, x + w - 2, y + h - 2);
01028   //
01029   // Draw elevator car
01030   //
01031   yPos   = _Elevator.Itself.ActV - (5 - Level) * 130 + 80;
01032   yStart = (yPos < 0) ? -yPos : 0;
01033   yEnd   = (yPos > 82) ? 125 - yPos : 43;
01034   if (yPos != 80) {
01035     y0_ = (yPos > 80) ? yStart + 44 - (yPos - 80) : yStart;
01036     y1_ = (yPos > 80) ? yEnd : 79 - yPos;
01037     _DrawElevator2(x + 2, y + yPos, w - 4, 43, 0, y0_, w - 4, y1_, 1, GUI_MAKE_COLOR(Color1));
01038   }
01039   y0_ = (yPos < 80) ? yStart + (80 - yPos) : yStart;
01040   y1_ = (yPos > 80) ? 43 - (yPos - 80) : 43;
01041   if (_Elevator.Move) {
01042     GUI_SetColor(Color2);
01043     GUI_FillRect(x + 2, y + 80, x + w - 2, y + h - 2);
01044     _DrawElevator2(x + 2, y + yPos, w - 4, 43, 0, y0_, w - 4, y1_, 1, GUI_MAKE_COLOR(Color2));
01045   } else {
01046     Door = (w - 4) * (100 - _Elevator.Door.ActV) / 100;
01047     _DrawElevator2(x + 2, y + yPos, w - 4, 43, 0,        y0_, Door,  y1_, 1, GUI_MAKE_COLOR(Color2));
01048     _DrawElevator2(x + 2, y + yPos, w - 4, 43, Door + 1, y0_, w - 4, y1_, 0, GUI_MAKE_COLOR(Color2));
01049   }
01050   //
01051   // Draw door frame (outside)
01052   //
01053   Color2 = 0x7F * Light / 100 + 0x50;
01054   GUI_SetColor(GUI_MAKE_COLOR(Color2 << 16));
01055   _DrawRect(x + 1, y + 79, x + w - 1, y + h - 1, 1);
01056   //
01057   // Draw level number
01058   //
01059   if (_Elevator.Itself.ActV == _Elevator.Itself.NewV &&
01060       _Elevator.Itself.ActV == ((5 - Level) * 130)) {
01061     GUI_SetColor(GUI_MAKE_COLOR(0x00FF40));
01062   } else {
01063     Color2 = 0x3F * Light / 100 + 0xC0;
01064     GUI_SetColor(GUI_MAKE_COLOR(Color2 << 8 | Color2));
01065   }
01066   GUI_SetFont(&GUI_Font8x8);
01067   GUI_SetTextMode(GUI_TM_TRANS);
01068   GUI_DispCharAt(Level + 1 + '0', x + (w / 2) - 3, y + 70);
01069 }
01070 
01071 /*********************************************************************
01072 *
01073 *       _DrawWindow
01074 */
01075 static void _DrawWindow(int x, int y, int w, int h, int dy, int Light) {
01076   GUI_COLOR Color;
01077   int       i;
01078 
01079   Color = 0x80 * Light / 100 + 0x7F;
01080   GUI_SetColor(GUI_MAKE_COLOR(Color << 16));
01081   GUI_FillRect(x, y, x + w, y + h);
01082   Color = 0x60 * Light / 100 + 0x9F;
01083   GUI_SetColor(GUI_MAKE_COLOR(Color << 16 | Color << 8 | Color));
01084   GUI_DrawVLine(x, y, y + h);
01085   GUI_DrawVLine(x + w / 2, y, y + h);
01086   GUI_DrawVLine(x + w, y, y + h);
01087   for (i = 0; i < h; i += dy) {
01088     GUI_DrawHLine(y + i, x, x + w);
01089   }
01090   GUI_DrawHLine(y + h, x, x + w);
01091 }
01092 
01093 /*********************************************************************
01094 *
01095 *       _DrawFrame
01096 */
01097 static void _DrawFrame(int x, int y, int w, int h, int Light) {
01098   GUI_COLOR Color;
01099 
01100   Color = 0x88 * Light / 100 + 0x48;
01101   GUI_SetColor(GUI_MAKE_COLOR(Color << 16 | Color << 8 | Color));
01102   GUI_FillRect(x, y, x + w - 1, y + h - 1);
01103   GUI_SetColor(GUI_WHITE);
01104   _DrawRect(x, y, x + w - 1, y + h - 1, 2);
01105   Color = 0xA0 * Light / 100 + 0x5F;
01106   GUI_SetColor(GUI_MAKE_COLOR(Color << 16 | Color << 8 | Color));
01107   GUI_SetPenSize(1);
01108   GUI_DrawLine(x + 2, y + 2, x + w - 2, y + h - 2);
01109   GUI_DrawLine(x + w - 2, y + 2, x + 2, y + h - 2);
01110 }
01111 
01112 /*********************************************************************
01113 *
01114 *       _DrawMarquee
01115 */
01116 static void _DrawMarquee(int x, int y, int w, int h, int d, int Status) {
01117   const GUI_RECT * OldClipRect;
01118   GUI_RECT         ClipRect;
01119 
01120   ClipRect.x0 = (d < 0) ? (x - w - 2) : (x + 1);
01121   ClipRect.y0 = y - 1;
01122   ClipRect.x1 = (d < 0) ? (x - 1) : (x + w + 2);
01123   ClipRect.y1 = y + 61;
01124   OldClipRect = WM_SetUserClipRect(&ClipRect);
01125   GUI_AA_SetFactor(4);
01126   GUI_AA_EnableHiRes();
01127   x *= 4;
01128   y *= 4;
01129   w = (w - 2) * (100 - Status) / 25 + 12;
01130   w = (d > 0) ? w : -w;
01131   h = h * (100 - Status) / 25 + 4;
01132   GUI_SetPenSize(3);
01133   GUI_SetPenShape(GUI_PS_ROUND);
01134   GUI_SetColor(GUI_MAKE_COLOR(0xA08080));
01135   GUI_AA_DrawLine(x + (60 * d), y + 240, x, y + 240); 
01136   GUI_SetPenShape(GUI_PS_FLAT);
01137   GUI_SetColor(GUI_MAKE_COLOR(0x00C0FF));
01138   GUI_AA_DrawLine(x + w, y + h, x, y);
01139   GUI_AA_DrawLine(x + w - (3 * d), y + h, x + w - (3 * d), y + h + 20);
01140   GUI_AA_DisableHiRes();
01141   WM_SetUserClipRect(OldClipRect);
01142 }
01143 
01144 /*********************************************************************
01145 *
01146 *       _DrawJalousie
01147 */
01148 static void _DrawJalousie(int x, int y, int h, int Status) {
01149   GUI_SetColor(GUI_MAKE_COLOR(0x0C0FF));
01150   GUI_SetPenSize(3);
01151   GUI_SetPenShape(GUI_PS_ROUND);
01152   GUI_DrawLine(x, y, x, y + (h * Status / 100) + 2);
01153 }
01154 
01155 /*********************************************************************
01156 *
01157 *       _DrawRoof
01158 */
01159 static void _DrawRoof(int x, int y) {
01160   GUI_SetBkColor(GUI_BLACK);
01161   GUI_ClearRect(35, y - 70, 164, y + 59);
01162   GUI_SetColor(GUI_MAKE_COLOR(0xD82000));
01163   GUI_AA_SetFactor(3);
01164   GUI_AA_FillPolygon(_aRoof, 3, x, y);
01165   GUI_SetColor(GUI_MAKE_COLOR(0x0066FF));
01166   if (_LogoRPM < 0) {
01167     GUI_FillPolygon(_aArrowLeft,  8, x - 4, y + 9);
01168   }
01169   if (_LogoRPM > 0) {
01170     GUI_FillPolygon(_aArrowRight, 8, x - 4, y + 9);
01171   }
01172   GUI_DrawBitmapEx(&_LogoBitmap, x - 1, y - _Logo.ySize / 2 - 3, _Logo.xCenter, _Logo.yCenter, _LogoMulX, LOGOMULY);
01173 }
01174 
01175 /*********************************************************************
01176 *
01177 *       _DrawDoor
01178 */
01179 static void _DrawDoor(int x, int y, int w, int h) {
01180   GUI_SetColor(GUI_BLUE);
01181   GUI_FillRect(x, y, x + w, y + h);
01182   GUI_SetColor(GUI_BLACK);
01183   _DrawRect(x, y, x + w, y + h, 1);
01184   GUI_DrawHLine(y + h/2, x + 4, x + 8);
01185   GUI_DrawVLine(x + 4, y + h/2 - 1, y + h/2 + 3);
01186 }
01187 
01188 /*********************************************************************
01189 *
01190 *       _DrawGarage
01191 */
01192 static void _DrawGarage(int x, int y, int w, int h, int Status) {
01193   GUI_SetColor(GUI_YELLOW);
01194   GUI_FillRect(x, y + 1, x + w, y + ((h - 2) * (100 - Status) / 100) + 1);
01195   GUI_SetColor(GUI_BLACK);
01196   _DrawRect(x, y, x + w, y + h, 1);
01197 }
01198 
01199 /*********************************************************************
01200 *
01201 *       _DrawSmallLevel
01202 */
01203 static void _DrawSmallLevel(int Level, int x0, int y0_, unsigned Light) {
01204   GUI_COLOR Color;
01205   int       i;
01206 
01207   y0_ += (4 - Level) * 39;
01208   //
01209   // Draw frame of levels (background)
01210   //
01211   Color = 0x78 * Light / 100 + 0x58;
01212   GUI_SetColor(GUI_MAKE_COLOR(Color << 16 | Color << 8 | Color));
01213   GUI_FillRect(x0 + 9, y0_ + 40, x0 + 46, y0_ + 78);
01214   //
01215   // Draw frame of levels (rear bracing)
01216   //
01217   Color = 0xA0 * Light / 100 + 0x5F;
01218   GUI_SetColor(GUI_MAKE_COLOR(Color << 16 | Color << 8 | Color));
01219   GUI_DrawLine(x0 + 9, y0_ +  40, x0 + 46, y0_ +  77);
01220   GUI_DrawLine(x0 + 9, y0_ +  77, x0 + 46, y0_ +  40);
01221   //
01222   // Draw windows
01223   //
01224   Color = 0x80 * Light / 100 + 0x7F;
01225   GUI_SetColor(GUI_MAKE_COLOR(Color << 16));
01226   GUI_FillRect(x0 + 32, y0_ +  42, x0 + 40, y0_ +  75);
01227   Color = 0x60 * Light / 100 + 0x9F;
01228   GUI_SetColor(GUI_MAKE_COLOR(Color << 16 | Color << 8 | Color));
01229   GUI_DrawVLine(x0 + 31, y0_ + 41, y0_ + 76);
01230   GUI_DrawVLine(x0 + 36, y0_ + 41, y0_ + 76);
01231   GUI_DrawVLine(x0 + 41, y0_ + 41, y0_ + 76);
01232   for (i = 0; i < ((Level) ? 8 : 5); i++) {
01233     GUI_DrawHLine(y0_ + (i * 5) + 41, x0 + 31, x0 + 40);
01234   }
01235   //
01236   // Draw elevator shaft
01237   //
01238   Color  = (0x8F * Light / 100 + 0x60) << 16;
01239   Color += (0x7F * Light / 100 + 0x0) << 8;
01240   Color += (0x6F * Light / 100 + 0x20);
01241   GUI_SetColor(GUI_MAKE_COLOR(Color));
01242   GUI_FillRect(x0 + 14, y0_ +  40, x0 + 23, y0_ +  77);
01243   Color = 0x5F * Light / 100 + 0xA0;
01244   GUI_SetColor(GUI_MAKE_COLOR(Color << 16 | Color << 8 | Color));
01245   GUI_FillRect(x0 + 15, y0_ +  64, x0 + 22, y0_ +  76);
01246 }
01247 
01248 /*********************************************************************
01249 *
01250 *       _DrawSmallElevatorDoor
01251 */
01252 static void _DrawSmallElevatorDoor(int Level, int x0, int y0_, int Light) {
01253   GUI_COLOR Color;
01254 
01255   y0_    += (4 - Level) * 39;
01256   Color  = 0x7F * Light / 100 + 0x50;
01257   GUI_SetColor(GUI_MAKE_COLOR(Color << 16));
01258   _DrawRect(x0 + 14, y0_ + 63, x0 + 23, y0_ +  77, 1);
01259   if (_Elevator.Itself.ActV == _Elevator.Itself.NewV &&
01260       _Elevator.Itself.ActV == ((5 - Level) * 130)) {
01261     GUI_SetColor(GUI_MAKE_COLOR(0x00FF60));
01262   } else {
01263     Color = 0x2F * Light / 100 + 0xD0;
01264     GUI_SetColor(GUI_MAKE_COLOR(Color << 8 | Color));
01265   }
01266   GUI_DrawHLine(y0_ + 61, x0 + 18, x0 + 19);
01267 }
01268 
01269 /*********************************************************************
01270 *
01271 *       _DrawRotateLogo
01272 */
01273 static int _DrawRotateLogo(void) {
01274   if (_LogoRPM != 0) {
01275     if ((GUI_GetTime() - _LogoPrevTime) >= _LogoWaitTime) {
01276       _LogoDivisor   = 60000 / (float)_LogoRPM / PI2;
01277       _LogoAngle    += (GUI_GetTime() - _LogoPrevTime) / _LogoDivisor;
01278       _LogoPrevTime  = GUI_GetTime();
01279       _LogoMulX      = (int)(cos((double)_LogoAngle) * LOGOMULX);
01280       if (_LogoMulX != _LogoPrevMulX) {
01281         _LogoPrevMulX = _LogoMulX;
01282         return 1;
01283       }
01284     }
01285   }
01286   return 0;
01287 }
01288 
01289 /*********************************************************************
01290 *
01291 *       _DrawLevel
01292 */
01293 static void _DrawLevel(int n, int y) {
01294   if (n != 5) {
01295     _DrawFrame(35, y, 129, 129, _Level[n].Light.ActV);
01296     _DrawElevator(55, y + 2, 30, 125, n);
01297     if (n != 0) {
01298       _DrawWindow(115, y + 5, 30, 119, 17, _Level[n].Light.ActV);
01299     }
01300   }
01301   switch (n) {
01302   case 0:
01303     _DrawWindow(115, y + 5, 30, 76, 17, _Level[0].Light.ActV);
01304     _DrawDoor(115, y + 82, 30, 45);
01305     _DrawGarage(40, y + 82, 50, 45, _Garage.ActV);
01306     break;
01307   case 1:
01308     _DrawMarquee(164, y + 30, 30, 10, 1, _Marquee1.ActV);
01309     break;
01310   case 2:
01311     _DrawJalousie(166, y + 10, 90, _Jalousie1.ActV);
01312     break;
01313   case 3:
01314     _DrawMarquee(35, y + 30, 30, 10, -1, _Marquee2.ActV);
01315     break;
01316   case 4:
01317     _DrawJalousie(33, y + 10, 90, _Jalousie2.ActV);
01318     break;
01319   case 5:
01320     _DrawRoof(99, y + 70);
01321   }
01322 }
01323 
01324 /*********************************************************************
01325 *
01326 *       _DrawHouseMap
01327 */
01328 static void _DrawHouseMap(int x0, int y0_) {
01329   int ElevatorY;
01330   int Status;
01331   int i;
01332 
01333   //
01334   // Draw roof of house
01335   //
01336   GUI_AA_SetFactor(5);
01337   GUI_AA_EnableHiRes();
01338   GUI_SetColor(GUI_MAKE_COLOR(0xD82000));
01339   GUI_AA_FillPolygon(_aRoofMini, 3, (x0 * 5) + 138, (y0_ * 5) + 105);
01340   GUI_AA_DisableHiRes();
01341   GUI_DrawBitmapEx(&_LogoBitmap, x0 + 28, y0_ + 18 - _Logo.ySize / 4, _Logo.xCenter, _Logo.yCenter, _LogoMulX / 2, LOGOMULY / 2);
01342   //
01343   // Draw levels
01344   //
01345   for (i = 0; i < 5; i++) {
01346     _DrawSmallLevel(i, x0, y0_, _Level[i].Light.ActV);
01347   }
01348   //
01349   // Draw elevator car
01350   //
01351   GUI_SetColor(GUI_MAKE_COLOR(0xD0D0D0));
01352   ElevatorY = y0_ + (int)((double)(_Elevator.Itself.ActV) / (10.0 / 3.0)) + 25;
01353   GUI_FillRect(x0 + 15, ElevatorY, x0 + 22, ElevatorY + 12);
01354   //
01355   // Draw elevator doors
01356   //
01357   for (i = 0; i < 5; i++) {
01358     _DrawSmallElevatorDoor(i, x0, y0_, _Level[i].Light.ActV);
01359   }
01360   //
01361   // Draw door
01362   //
01363   GUI_SetColor(GUI_BLUE);
01364   GUI_FillRect(x0 + 32, y0_ + 220, x0 + 40, y0_ + 232);
01365   GUI_SetColor(GUI_BLACK);
01366   _DrawRect(x0 + 31, y0_ + 219, x0 + 41, y0_ + 233, 1);
01367   GUI_SetColor(GUI_MAKE_COLOR(0x707070));
01368   GUI_DrawHLine(y0_ + 219, x0 + 31, x0 + 41);
01369   //
01370   // Draw Garage
01371   //
01372   Status = ((100 - _Garage.ActV) * 12 / 100);
01373   GUI_SetColor(GUI_YELLOW);
01374   GUI_FillRect(x0 + 10, y0_ + 220, x0 + 24, y0_ + 220 + Status);
01375   GUI_SetColor(GUI_BLACK);
01376   _DrawRect(x0 + 9, y0_ + 219, x0 + 25, y0_ + 233, 1);
01377   //
01378   // Draw Jalousie 1
01379   //
01380   Status = (_Jalousie1.ActV * 23 / 100);
01381   GUI_SetColor(GUI_MAKE_COLOR(0x00C0FF));
01382   GUI_DrawVLine(x0 + 48, y0_ + 120, y0_ + 124 + Status);
01383   GUI_SetColor(GUI_MAKE_COLOR(0x006C90));
01384   GUI_DrawVLine(x0 + 49, y0_ + 120, y0_ + 124 + Status);
01385   //
01386   // Draw Jalousie 2
01387   //
01388   Status = (_Jalousie2.ActV * 23 / 100);
01389   GUI_SetColor(GUI_MAKE_COLOR(0x00C0FF));
01390   GUI_DrawVLine(x0 + 7, y0_ + 42, y0_ + 46 + Status);
01391   GUI_SetColor(GUI_MAKE_COLOR(0x006C90));
01392   GUI_DrawVLine(x0 + 6, y0_ + 42, y0_ + 46 + Status);
01393   //
01394   // Draw Marquee 1
01395   //
01396   GUI_AA_SetFactor(5);
01397   GUI_AA_EnableHiRes();
01398   GUI_SetPenSize(2);
01399   Status = ((100 - _Marquee1.ActV) * 28 / 100) + 5;
01400   GUI_SetColor(GUI_MAKE_COLOR(0x0C0FF));
01401   GUI_AA_DrawLine(240, 835, 240 + Status, (int)(835 + Status / 2.5));
01402   GUI_SetColor(GUI_MAKE_COLOR(0xA08080));
01403   GUI_DrawHLine(183, 47, 51);
01404   GUI_DrawHLine(184, 47, 51);
01405   //
01406   // Draw Marquee 2
01407   //
01408   Status = ((100 - _Marquee2.ActV) * 28 / 100) + 5;
01409   GUI_SetColor(GUI_MAKE_COLOR(0x0C0FF));
01410   GUI_AA_DrawLine(40, 445, 40 - Status, (int)(445 + Status / 2.5));
01411   GUI_SetColor(GUI_MAKE_COLOR(0xA08080));
01412   GUI_DrawHLine(105, 4, 8);
01413   GUI_DrawHLine(106, 4, 8);
01414   GUI_SetPenSize(1);
01415   GUI_AA_DisableHiRes();
01416   //
01417   // Draw frame of levels (front bracing)
01418   //
01419   GUI_SetColor(GUI_MAKE_COLOR(0xFFFFFF));
01420   GUI_DrawVLine(x0 +  8, y0_ + 39, y0_ + 234);
01421   GUI_DrawVLine(x0 + 47, y0_ + 39, y0_ + 234);
01422   GUI_DrawHLine(y0_ +  39, x0 + 9, x0 + 46);
01423   GUI_DrawHLine(y0_ +  78, x0 + 9, x0 + 46);
01424   GUI_DrawHLine(y0_ + 117, x0 + 9, x0 + 46);
01425   GUI_DrawHLine(y0_ + 156, x0 + 9, x0 + 46);
01426   GUI_DrawHLine(y0_ + 195, x0 + 9, x0 + 46);
01427   GUI_DrawHLine(y0_ + 234, x0 + 9, x0 + 46);
01428 }
01429 
01430 /*********************************************************************
01431 *
01432 *       Static code, elevator functions
01433 *
01434 **********************************************************************
01435 */
01436 /*********************************************************************
01437 *
01438 *       _ElevatorOpenDoor
01439 */
01440 static void _ElevatorOpenDoor(void) {
01441   _Elevator.Door.NewV = 100;
01442   _Elevator.Time = GUI_GetTime() + 4000;
01443   _SerialSendCommand("LIFT_OPEN", -1, -1);
01444 }
01445 
01446 /*********************************************************************
01447 *
01448 *       _ElevatorCloseDoor
01449 */
01450 static void _ElevatorCloseDoor(void) {
01451   _Elevator.Door.NewV = 0;
01452   _Elevator.Time = GUI_GetTime() + 2000;
01453   _SerialSendCommand("LIFT_CLOSE", -1, -1);
01454 }
01455 
01456 /*********************************************************************
01457 *
01458 *       _ElevatorMoveTo
01459 */
01460 static void _ElevatorMoveTo(int Level) {
01461   if (Level < 5) {
01462     _Elevator.Itself.NewV = (5 - Level) * 130;
01463     _Elevator.Move = (_Elevator.Itself.ActV > _Elevator.Itself.NewV) ? 1 : -1;
01464     WM_InvalidateWindow(_Elevator.Handle);
01465     _SerialSendCommand("LIFT", Level, -1);
01466   }
01467 }
01468 
01469 /*********************************************************************
01470 *
01471 *       _ElevatorStop
01472 */
01473 static void _ElevatorStop(void) {
01474   _Elevator.Move = 0;
01475   _Elevator.Itself.NewV = _Elevator.Itself.ActV;
01476   WM_InvalidateWindow(_Elevator.Handle);
01477 }
01478 
01479 /*********************************************************************
01480 *
01481 *       _ElevatorAddLevel
01482 */
01483 static void _ElevatorAddLevel(int Level) {
01484   if (_Level[Level].Elevator == 0 && Level < 5) {
01485     _Level[Level].Elevator = 1;
01486     _Elevator.ToDo[_Elevator.NumToDo++] = Level;
01487     WM_InvalidateWindow(_Elevator.Handle);
01488   }
01489 }
01490 
01491 /*********************************************************************
01492 *
01493 *       _ElevatorDelLevel
01494 */
01495 static void _ElevatorDelLevel(int Level) {
01496   int i;
01497 
01498   if (_Level[Level].Elevator != 0 && Level < 5) {
01499     _Level[Level].Elevator = 0;
01500     for (i = 0; i < _Elevator.NumToDo; i++) {
01501       if (_Elevator.ToDo[i] == Level) {
01502         break;
01503       }
01504     }
01505     for (; i < (_Elevator.NumToDo - 1); i++) {
01506       _Elevator.ToDo[i] = _Elevator.ToDo[i + 1];
01507     }
01508     _Elevator.NumToDo--;
01509   }
01510 }
01511 
01512 /*********************************************************************
01513 *
01514 *       _ElevatorGetLevel
01515 */
01516 static void _ElevatorGetLevel(void) {
01517   _Elevator.Level = 5 - ((_Elevator.Itself.ActV + 65) / 130);
01518   if (_Elevator.Level != _Elevator.LastLevel) {
01519     WM_InvalidateWindow(_Elevator.Handle);
01520     _Elevator.LastLevel = _Elevator.Level;
01521   }
01522 }
01523 
01524 /*********************************************************************
01525 *
01526 *       _ElevatorOptimize
01527 */
01528 static void _ElevatorOptimize(void) {
01529   int EndLevel;
01530   int Level;
01531   int Diff;
01532   int i;
01533 
01534   EndLevel = 5 - (_Elevator.Itself.NewV / 130);
01535   if (_Elevator.Itself.ActV < _Elevator.Itself.NewV) {
01536     Level = (5 - ((_Elevator.Itself.ActV + 130) / 130));
01537   } else {
01538     Level = (5 - ((_Elevator.Itself.ActV - 1) / 130));
01539   }
01540   Diff = (Level < EndLevel) ? 1 : -1;
01541   for (i = Level; i != EndLevel; i += Diff) {
01542     if (_Level[i].Elevator) {
01543       _ElevatorMoveTo(i);
01544       break;
01545     }
01546   }
01547 }
01548 
01549 /*********************************************************************
01550 *
01551 *       _ElevatorPause
01552 */
01553 static void _ElevatorPause(void) {
01554   _Elevator.Pause = ~(U16)(_Elevator.Pause);
01555   if (_Elevator.Pause) {
01556     _Elevator.Itself.NewV = _Elevator.Itself.ActV;
01557     _SerialSendCommand("LIFT_STOP", -1 , -1);
01558   } else {
01559     if (_Elevator.Door.ActV == 0) {
01560       if (_Elevator.NumToDo > 0) {
01561         _ElevatorMoveTo(_Elevator.ToDo[0]);
01562       }
01563     }
01564   }
01565   WM_InvalidateWindow(_Elevator.Handle);
01566 }
01567 
01568 /*********************************************************************
01569 *
01570 *       _ElevatorMove
01571 */
01572 static void _ElevatorMove(int Level) {
01573   int yPos;
01574 
01575   if (_Level[Level].Elevator == 0) {
01576     yPos = (5 - Level) * 130;
01577     if (yPos != _Elevator.Itself.ActV || _Elevator.Itself.ActV != _Elevator.Itself.NewV) {
01578       _ElevatorAddLevel(Level);
01579     } else {
01580       _ElevatorOpenDoor();
01581     }
01582   }
01583 }
01584 
01585 /*********************************************************************
01586 *
01587 *       _ElevatorExec
01588 */
01589 static void _ElevatorExec(void) {
01590   if (GUI_GetTime() < _Elevator.Time) {
01591     return;
01592   }
01593   if (_Elevator.Door.ActV == _Elevator.Door.NewV) {
01594     if (_Elevator.Door.ActV == 100) {
01595       _ElevatorCloseDoor();
01596     } else {
01597       if (!_Elevator.Pause) {
01598         if (_Elevator.Move) {
01599           if (_Elevator.Itself.ActV == _Elevator.Itself.NewV) {
01600             _ElevatorDelLevel(_Elevator.Level);
01601             _ElevatorStop();
01602             _ElevatorOpenDoor();
01603           } else {
01604             _ElevatorOptimize();
01605             _ElevatorGetLevel();
01606           }
01607         } else {
01608           if (_Elevator.NumToDo > 0) {
01609             _ElevatorMoveTo(_Elevator.ToDo[0]);
01610           } else {
01611             _Elevator.Time = GUI_GetTime() + 250;
01612           }
01613         }
01614       }
01615     }
01616   }
01617 }
01618 
01619 /*********************************************************************
01620 *
01621 *       Static code, callbacks
01622 *
01623 **********************************************************************
01624 */
01625 /*********************************************************************
01626 *
01627 *       _cbReceiveCommand
01628 */
01629 static void _cbReceiveCommand(const char * pStr, int v1, int v2) {
01630   if (_ExecuteCommands) {
01631     if (strcmp(pStr, "LIGHT") == 0) {
01632       if (v1 >= 0 && v1 <= 4) {
01633         _Level[v1].Light.ActV = _Clip(v2);
01634         _InvalidateObject(_hWinHouse, _Level[v1].Light.Rect);
01635         _InvalidateObject2(_hWinMap, _LightSmall[v1].Rect);
01636         _SetDialogLight();
01637       }
01638       return;
01639     }
01640     if (strcmp(pStr, "JALOUSIE") == 0) {
01641       if (v1) {
01642         _Jalousie1.NewV = _Clip(v2);
01643       } else {
01644         _Jalousie2.NewV = _Clip(v2);
01645       }
01646       return;
01647     }
01648     if (strcmp(pStr, "MARQUEE") == 0) {
01649       if (v1) {
01650         _Marquee1.NewV = _Clip(v2);
01651       } else {
01652         _Marquee2.NewV = _Clip(v2);
01653       }
01654       return;
01655     }
01656     if (strcmp(pStr, "GARAGE") == 0) {
01657       _Garage.NewV = _Clip(v1);
01658       return;
01659     }
01660     if (strcmp(pStr, "LOGO") == 0) {
01661       switch (v1) {
01662       case 0:
01663         _LogoRPM  = 0;
01664         _LogoMulX = LOGOMULX;
01665         _InvalidateObject(_hWinHouse, _LogoLarge.Rect);
01666         _InvalidateObject2(_hWinMap,  _LogoSmall.Rect);
01667         break;
01668       case 1:
01669         _LogoRPM = -RPM;
01670         break;
01671       case 2:
01672         _LogoRPM =  RPM;
01673       }
01674       _InvalidateObject(_hWinHouse, _LogoArrow.Rect);
01675       return;
01676     }
01677     if (strcmp(pStr, "LIFT") == 0) {
01678       _ElevatorMove(v1);
01679       return;
01680     }
01681     if (strcmp(pStr, "LIFT_OPEN") == 0) {
01682       _ElevatorOpenDoor();
01683       return;
01684     }
01685     if (strcmp(pStr, "LIFT_STOP") == 0) {
01686       _ElevatorPause();
01687       return;
01688     }
01689     if (strcmp(pStr, "SHOW") == 0) {
01690       if (v1 >= 0 && v1 <= 5) {
01691         _Scroll.NewV = 650 - v1 * 130;
01692         _ScrollPrevTime = GUI_GetTime();
01693       }
01694       return;
01695     }
01696     if (strcmp(pStr, "BURGLARY") == 0) {
01697       if (v1 & 0x1) {
01698         _AlertOn(0);
01699       }
01700       if (v1 & 0x2) {
01701         _AlertOn(1);
01702       }
01703       return;
01704     }
01705   }
01706 }
01707 
01708 /*********************************************************************
01709 *
01710 *       Static code, window callbacks
01711 *
01712 **********************************************************************
01713 */
01714 /*********************************************************************
01715 *
01716 *       _cbBkWindow
01717 */
01718 static void _cbBkWindow(WM_MESSAGE * pMsg) {
01719   switch (pMsg->MsgId) {
01720   case WM_PAINT:
01721     GUI_SetBkColor(GUI_BLACK);
01722     GUI_Clear();
01723     break;
01724   default:
01725     WM_DefaultProc(pMsg);
01726   }
01727 }
01728 
01729 /*********************************************************************
01730 *
01731 *       _cbWinControl
01732 */
01733 static void _cbWinControl(WM_MESSAGE * pMsg) {
01734   switch (pMsg->MsgId) {
01735   case WM_PAINT:
01736     GUI_SetBkColor(GUI_GRAY);
01737     GUI_Clear();
01738     break;
01739   default:
01740     if (_pfcbFrameWin) {
01741       (*_pfcbFrameWin)(pMsg);
01742     }
01743   }
01744 }
01745 
01746 /*********************************************************************
01747 *
01748 *       _cbWinHouse
01749 */
01750 static void _cbWinHouse(WM_MESSAGE * pMsg) {
01751   WM_SCROLL_STATE ScrollState;
01752 
01753   switch (pMsg->MsgId) {
01754   case WM_NOTIFY_PARENT:
01755     if (pMsg->Data.v == WM_NOTIFICATION_VALUE_CHANGED) {
01756       if (WM_GetId(pMsg->hWinSrc) == GUI_ID_VSCROLL) {
01757         WM_GetScrollState(pMsg->hWinSrc, &ScrollState);
01758         if (ScrollState.v != _Scroll.ActV) {
01759           _Scroll.NewV = ScrollState.v;
01760           _Scroll.ActV = _Scroll.NewV;
01761           _InvalidateObject(_hWinHouse, _Scroll.Rect);
01762           WM_BringToTop(WM_GetParent(pMsg->hWin));
01763         }
01764       }
01765     }
01766     break;
01767   case WM_PAINT:
01768     GUI_SetBkColor(GUI_BLACK);
01769     GUI_ClearRect(0, 0, 34, 129);
01770     GUI_ClearRect(165, 0, 199, 129);
01771     if (_Scroll.ActV < 130) {
01772       _DrawLevel(5,   0 - _Scroll.ActV);
01773     }
01774     if (_Scroll.ActV != 0 && _Scroll.ActV < 260) {
01775       _DrawLevel(4, 130 - _Scroll.ActV);
01776     }
01777     if (_Scroll.ActV > 130 && _Scroll.ActV < 390) {
01778       _DrawLevel(3, 260 - _Scroll.ActV);
01779     }
01780     if (_Scroll.ActV > 260 && _Scroll.ActV < 520) {
01781       _DrawLevel(2, 390 - _Scroll.ActV);
01782     }
01783     if (_Scroll.ActV > 390 && _Scroll.ActV < 650) {
01784       _DrawLevel(1, 520 - _Scroll.ActV);
01785     }
01786     if (_Scroll.ActV > 520) {
01787       _DrawLevel(0, 650 - _Scroll.ActV);
01788     }
01789     break;
01790   default:
01791     WM_DefaultProc(pMsg);
01792   }
01793 }
01794 
01795 /*********************************************************************
01796 *
01797 *       _cbWinMap
01798 */
01799 static void _cbWinMap(WM_MESSAGE * pMsg) {
01800   GUI_PID_STATE TouchState;
01801   int           x;
01802   int           y;
01803 
01804   switch (pMsg->MsgId) {
01805   case WM_TOUCH:
01806     GUI_TOUCH_GetState(&TouchState);
01807     if (TouchState.Pressed) {
01808       x = TouchState.x - WM_GetWindowOrgX(pMsg->hWin);
01809       y = TouchState.y - WM_GetWindowOrgY(pMsg->hWin);
01810       if (x >= 0 && x <= 50 && y >= 0 && y <= 233) {
01811         _Scroll.NewV = 650 - 130 * (5 - (y / 39));
01812         _ScrollPrevTime = GUI_GetTime();
01813       }
01814     }
01815     break;
01816   case WM_PAINT:
01817     GUI_SetBkColor(GUI_BLACK);
01818     GUI_Clear();
01819     _DrawHouseMap(0, 0);
01820     break;
01821   default:
01822     WM_DefaultProc(pMsg);
01823   }
01824 }
01825 
01826 /*********************************************************************
01827 *
01828 *       _cbWinAlert
01829 */
01830 static void _cbWinAlert(WM_MESSAGE * pMsg) {
01831   WM_HWIN hParent;
01832   int     Index;
01833 
01834   hParent = WM_GetParent(pMsg->hWin);
01835   for (Index = 0; Index < NUM_ALERTS; Index++) {
01836     if (hParent == _hAlert[Index]) {
01837       break;
01838     }
01839   }
01840   switch (pMsg->MsgId) {
01841   case WM_PAINT:
01842     GUI_SetBkColor(GUI_WHITE);
01843     GUI_Clear();
01844     break;
01845   case WM_NOTIFY_PARENT:
01846     if (pMsg->Data.v == WM_NOTIFICATION_RELEASED) {
01847       if (Index < NUM_ALERTS) {
01848         _AlertOff(Index);
01849       }
01850     }
01851     //lint -fallthrough
01852   case WM_TOUCH:
01853     if (Index < NUM_ALERTS) {
01854       WM_BringToTop(_hAlert[Index]);
01855     }
01856     break;
01857   default:
01858     WM_DefaultProc(pMsg);
01859   }
01860 }
01861 
01862 /*********************************************************************
01863 *
01864 *       Static code, dialog callbacks
01865 *
01866 **********************************************************************
01867 */
01868 /*********************************************************************
01869 *
01870 *       _cbDialogLight
01871 */
01872 static void _cbDialogLight(WM_MESSAGE * pMsg) {
01873   int Id;
01874   int i;
01875 
01876   switch (pMsg->MsgId) {
01877   case WM_INIT_DIALOG:
01878     _hDialogLight = pMsg->hWin;
01879     _SetDialogLight();
01880     break;
01881   case WM_NOTIFY_PARENT:
01882     if (_InitDialog) {
01883       break;
01884     }
01885     if (pMsg->Data.v == WM_NOTIFICATION_VALUE_CHANGED) {
01886       Id = WM_GetId(pMsg->hWinSrc);
01887       if (Id >= GUI_ID_SLIDER0 && Id <= GUI_ID_SLIDER4) {
01888         i = Id - GUI_ID_SLIDER0;
01889         _Level[i].Light.ActV = _GetSliderValue(pMsg->hWin, Id);
01890         _InvalidateObject(_hWinHouse, _Level[i].Light.Rect);
01891         _InvalidateObject2(_hWinMap, _LightSmall[i].Rect);
01892         _SerialSendCommand("LIGHT", i, _Level[i].Light.ActV);
01893       }
01894     }
01895     //lint -fallthrough
01896   case WM_TOUCH:
01897     WM_BringToTop(WM_GetParent(_hWinControl));
01898     break;
01899   default:
01900     WM_DefaultProc(pMsg);
01901   }
01902 }
01903 
01904 /*********************************************************************
01905 *
01906 *       _cbDialogMisc
01907 */
01908 static void _cbDialogMisc(WM_MESSAGE * pMsg) {
01909   int Id;
01910 
01911   switch (pMsg->MsgId) {
01912   case WM_NOTIFY_PARENT:
01913     if (_InitDialog) {
01914       break;
01915     }
01916     if (pMsg->Data.v == WM_NOTIFICATION_RELEASED) {
01917       Id = WM_GetId(pMsg->hWinSrc);
01918       if (Id >= GUI_ID_BUTTON0 && Id <= GUI_ID_BUTTON7) {
01919         switch (Id) {
01920         case GUI_ID_BUTTON0:
01921           _Jalousie2.NewV = 100 - _Jalousie2.NewV;
01922           _SerialSendCommand("JALOUSIE", 0, _Jalousie2.NewV);
01923           break;
01924         case GUI_ID_BUTTON1:
01925           _Jalousie1.NewV = 100 - _Jalousie1.NewV;
01926           _SerialSendCommand("JALOUSIE", 1, _Jalousie1.NewV);
01927           break;
01928         case GUI_ID_BUTTON2:
01929           _Marquee2.NewV = 100 - _Marquee2.NewV;
01930           _SerialSendCommand("MARQUEE", 0, _Marquee2.NewV);
01931           break;
01932         case GUI_ID_BUTTON3:
01933           _Marquee1.NewV = 100 - _Marquee1.NewV;
01934           _SerialSendCommand("MARQUEE", 1, _Marquee1.NewV);
01935           break;
01936         case GUI_ID_BUTTON4:
01937           _Garage.NewV = 100 - _Garage.NewV;
01938           _SerialSendCommand("GARAGE", _Garage.NewV, -1);
01939           break;
01940         case GUI_ID_BUTTON5:
01941           _LogoRPM = -RPM;
01942           _InvalidateObject(_hWinHouse, _LogoArrow.Rect);
01943           _SerialSendCommand("LOGO", 1, -1);
01944           break;
01945         case GUI_ID_BUTTON6:
01946           _LogoRPM  = 0;
01947           _LogoMulX = LOGOMULX;
01948           _InvalidateObject(_hWinHouse, _LogoArrow.Rect);
01949           _InvalidateObject(_hWinHouse, _LogoLarge.Rect);
01950           _InvalidateObject2(_hWinMap,  _LogoSmall.Rect);
01951           _SerialSendCommand("LOGO", 0, -1);
01952           break;
01953         case GUI_ID_BUTTON7:
01954           _LogoRPM = RPM;
01955           _InvalidateObject(_hWinHouse, _LogoArrow.Rect);
01956           _SerialSendCommand("LOGO", 2, -1);
01957           break;
01958         }
01959       }
01960     }
01961     //lint -fallthrough
01962   case WM_TOUCH:
01963     WM_BringToTop(WM_GetParent(_hWinControl));
01964     break;
01965   default:
01966     WM_DefaultProc(pMsg);
01967   }
01968 }
01969 
01970 /*********************************************************************
01971 *
01972 *       _cbDialogElev
01973 */
01974 static void _cbDialogElev(WM_MESSAGE * pMsg) {
01975   int Id;
01976   int i;
01977 
01978   switch (pMsg->MsgId) {
01979   case WM_INIT_DIALOG:
01980     _Elevator.Handle = pMsg->hWin; 
01981     break;
01982   case WM_NOTIFY_PARENT:
01983     if (_InitDialog) {
01984       break;
01985     }
01986     if (pMsg->Data.v == WM_NOTIFICATION_CLICKED) {
01987       Id = WM_GetId(pMsg->hWinSrc);
01988       if (Id >= GUI_ID_BUTTON0 && Id <= GUI_ID_BUTTON4) {
01989         _ElevatorMove(Id - GUI_ID_BUTTON0);          
01990       } else {
01991         if (Id == GUI_ID_BUTTON5) {
01992           if (!_Elevator.Move) {
01993             if (_Elevator.Itself.ActV == _Elevator.Itself.NewV) {
01994               _ElevatorOpenDoor();
01995             }
01996           }
01997         }
01998         if (Id == GUI_ID_BUTTON6) {
01999           if (_Elevator.Pause) {
02000             BUTTON_SetText(pMsg->hWinSrc, "Pause");
02001           } else {
02002             BUTTON_SetText(pMsg->hWinSrc, "Resume");
02003           }
02004           _ElevatorPause();
02005         }
02006       }
02007     }
02008     //lint -fallthrough
02009   case WM_TOUCH:
02010     WM_BringToTop(WM_GetParent(_hWinControl));
02011     break;
02012   case WM_PAINT:
02013     GUI_SetBkColor(GUI_BLACK);
02014     GUI_ClearRect(0, 0, 35, 15);      
02015     GUI_SetColor(GUI_GRAY);
02016     GUI_FillRect(0, 16, 35, 114);
02017     GUI_SetColor(GUI_WHITE);
02018     GUI_DrawRect(0, 0, 35, 114);
02019     GUI_DrawHLine(16, 0, 35);
02020     GUI_SetColor(GUI_RED);
02021     GUI_SetFont(&GUI_Font8x10_ASCII);
02022     GUI_DispCharAt(_Elevator.Level + '1', 9, 4);
02023     if (_Elevator.Move) {
02024       GUI_FillPolygon((_Elevator.Move < 0) ? _aArrowDown : _aArrowUp, 8, 22, 4);
02025     }
02026     GUI_SetBkColor(GUI_GRAY);
02027     GUI_SetFont(&GUI_Font6x8);
02028     for (i = 0; i < 5; i++) {
02029       GUI_SetColor((_Level[i].Elevator) ? GUI_RED : GUI_BLACK);
02030       GUI_DispCharAt(i + '1', 6, 97 - (i * 18));
02031     }
02032     break;
02033   default:
02034     WM_DefaultProc(pMsg);
02035   }
02036 }
02037 
02038 /*********************************************************************
02039 *
02040 *       Static code
02041 *
02042 **********************************************************************
02043 */
02044 /*********************************************************************
02045 *
02046 *       _NEC_Demo
02047 */
02048 static void _NEC_Demo(void) {
02049   MULTIPAGE_Handle hMultiPage;
02050   FRAMEWIN_Handle  hFrame;
02051 
02052   //
02053   // Use memory devices for all windows
02054   //
02055   WM_SetCreateFlags(WM_CF_MEMDEV);
02056   WM_EnableMemdev(WM_HBKWIN);
02057   //
02058   // Set the callback for the background window
02059   //
02060   WM_SetCallback(WM_HBKWIN, _cbBkWindow);
02061   //
02062   // Create a framewin for the house
02063   //
02064   FRAMEWIN_SetDefaultCaptionSize(14);
02065   FRAMEWIN_SetDefaultFont(&GUI_Font10_1);
02066   hFrame = FRAMEWIN_Create("House", 0, WM_CF_SHOW, 100, 28, 217, 151);
02067   FRAMEWIN_SetMoveable (hFrame, 1);
02068   FRAMEWIN_AddMinButton(hFrame, FRAMEWIN_BUTTON_RIGHT, 0);
02069   //
02070   // Get the client window and add a scrollbar
02071   //
02072   _hWinHouse = WM_GetClientWindow(hFrame);
02073   WM_SetCallback(_hWinHouse, _cbWinHouse);
02074   _hScroll = SCROLLBAR_CreateAttached(_hWinHouse, SCROLLBAR_CF_VERTICAL);
02075   SCROLLBAR_SetNumItems(_hScroll, 780);
02076   SCROLLBAR_SetPageSize(_hScroll, 130);
02077   SCROLLBAR_SetValue   (_hScroll, 650);
02078   //
02079   // Create a framewin for the controls
02080   //
02081   _hWinControl = FRAMEWIN_Create("Control", 0, WM_CF_SHOW, 100, 5, 130, 181);
02082   FRAMEWIN_SetMoveable (_hWinControl, 1);
02083   FRAMEWIN_AddMinButton(_hWinControl, FRAMEWIN_BUTTON_RIGHT, 0);
02084   FRAMEWIN_Minimize    (_hWinControl);
02085   //
02086   // Get the client window and add controls
02087   //
02088   _hWinControl  = WM_GetClientWindow(_hWinControl);
02089   _pfcbFrameWin = WM_SetCallback    (_hWinControl, _cbWinControl);
02090   hMultiPage    = MULTIPAGE_CreateEx(3, 4, 117, 153, _hWinControl, WM_CF_SHOW, 0, 0);
02091   _hDialogLight = _AddDialog("Light", ARRAY(_aDialogLight), _cbDialogLight, hMultiPage);
02092   _AddDialog("Misc",  ARRAY(_aDialogMisc), _cbDialogMisc, hMultiPage);
02093   _AddDialog("Elev.", ARRAY(_aDialogElev), _cbDialogElev, hMultiPage);
02094   MULTIPAGE_SelectPage(hMultiPage, 0);
02095   //
02096   // Create a window for the house map
02097   //
02098   _hWinMap = WM_CreateWindow(0, 3, 57, 235, WM_CF_SHOW, _cbWinMap, 0);
02099   //
02100   // Init some values
02101   //
02102   _Logo.xCenter         = ((_LogoBitmap.XSize / 2) - 1);
02103   _Logo.yCenter         = ((_LogoBitmap.YSize / 2) - 1);
02104   _Logo.xSize           = _LogoBitmap.XSize * LOGOMULX / 1000;
02105   _Logo.ySize           = _LogoBitmap.YSize * LOGOMULY / 1000;
02106   _LogoLarge.Rect.x0    =  98 - _Logo.xSize / 2;
02107   _LogoLarge.Rect.y0    =  67 - _Logo.ySize;
02108   _LogoLarge.Rect.x1    = 100 + _Logo.xSize / 2;
02109   _LogoLarge.Rect.y1    =  69;
02110   _LogoSmall.Rect.x0    =  26 - _Logo.xSize / 4;
02111   _LogoSmall.Rect.y0    =  18 - _Logo.ySize / 2;
02112   _LogoSmall.Rect.x1    =  28 + _Logo.xSize / 4;
02113   _LogoSmall.Rect.y1    =  19;
02114   _Elevator.Itself.ActV = 650;
02115   _Elevator.Itself.NewV = 650;
02116   //
02117   // Init the serial interface
02118   //
02119   _SerialInit(_cbReceiveCommand);
02120   //
02121   // Show the touch cursor
02122   //
02123   GUI_CURSOR_Select(&_TouchCursor);
02124   GUI_CURSOR_Show();
02125   GUI_CURSOR_SetPosition(70, 40);
02126   //
02127   // Handle the windows
02128   //
02129   WM_SetFocus(hFrame);
02130   _ExecuteCommands = 1;
02131   while (1) {
02132     _SlideStatus();
02133     _ElevatorExec();
02134     if (_DrawRotateLogo()) {
02135       _InvalidateObject (_hWinHouse, _LogoLarge.Rect);
02136       _InvalidateObject2(_hWinMap,   _LogoSmall.Rect);
02137     }
02138     _SerialExec();
02139     GUI_Delay(5);
02140   }
02141 }
02142 
02143 /*********************************************************************
02144 *
02145 *       Public code
02146 *
02147 **********************************************************************
02148 */
02149 /*********************************************************************
02150 *
02151 *       MainTask
02152 */
02153 void MainTask(void);
02154 void MainTask(void) {
02155   GUI_Init();
02156   //
02157   // Check if recommended memory for the sample is available
02158   //
02159   if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) {
02160     GUI_ErrorOut("Not enough memory available."); 
02161     return;
02162   }
02163   _NEC_Demo();
02164 }
02165 
02166 #endif
02167 
02168 /*************************** End of file ****************************/