SAMV71 Xplained Ultra Software Package 1.5

main.c

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------- */
00002 /*                  Atmel Microcontroller Software Support                      */
00003 /*                       SAM Software Package License                           */
00004 /* ---------------------------------------------------------------------------- */
00005 /* Copyright (c) 2015, Atmel Corporation                                        */
00006 /*                                                                              */
00007 /* All rights reserved.                                                         */
00008 /*                                                                              */
00009 /* Redistribution and use in source and binary forms, with or without           */
00010 /* modification, are permitted provided that the following condition is met:    */
00011 /*                                                                              */
00012 /* - Redistributions of source code must retain the above copyright notice,     */
00013 /* this list of conditions and the disclaimer below.                            */
00014 /*                                                                              */
00015 /* Atmel's name may not be used to endorse or promote products derived from     */
00016 /* this software without specific prior written permission.                     */
00017 /*                                                                              */
00018 /* DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR   */
00019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
00020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE   */
00021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,      */
00022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
00023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,  */
00024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    */
00025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING         */
00026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
00027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           */
00028 /* ---------------------------------------------------------------------------- */
00029 
00030 /**
00031  *  \page lcd_ebi LCD example in SMC(EBI) mode
00032  *
00033  *  \section Purpose
00034  *
00035  *  This example demonstrates how to configure the LCD with EBI interface
00036  *
00037  *  \section Requirements
00038  *
00039  *  This package can be used with SAM V71 Xplained Ultra board with maXtouch
00040  *  xplained LCD board. LCD board must be set to 16-bit MCU configuration with
00041  *  the help of switch behind LCD. It should be in IM0 and IM2 should be in Off
00042  *  position and IM1 should be in On.
00043  *
00044  *  \section Description
00045  *
00046  *  \section Usage
00047  *
00048  *  -# Build the program and download it inside the SAM V71 Xplained Ultra board.
00049  * Please refer to the Getting Started with SAM V71 Microcontrollers.pdf
00050  *  -# On the computer, open and configure a terminal application
00051  *     (e.g. HyperTerminal on Microsoft Windows) with these settings:
00052  *    - 115200 baud rate
00053  *    - 8 bits of data
00054  *    - No parity
00055  *    - 1 stop bit
00056  *    - No flow control
00057  *  -# Start the application.
00058  *  -# In the terminal window, the
00059  *     following text should appear (values depend on the board and chip used):
00060  *     \code
00061  *      -- LCD Example xxx --
00062  *      -- xxxxxx-xx
00063  *      -- Compiled: xxx xx xxxx xx:xx:xx --
00064  *     \endcode
00065  *
00066  *  \section References
00067  *  - lcd/main.c
00068  *  - trace.h
00069  */
00070 
00071 /** \file
00072  *
00073  *  This file contains all the specific code for the xplained LCD example.
00074  *
00075  */
00076 
00077 
00078 /*----------------------------------------------------------------------------
00079  *        Headers
00080  *----------------------------------------------------------------------------*/
00081 
00082 #include "board.h"
00083 #include "image.h"
00084 #include <stdbool.h>
00085 #include <stdio.h>
00086 #include <stdlib.h>
00087 #include <string.h>
00088 
00089 
00090 /*----------------------------------------------------------------------------
00091  *        Definition
00092  *----------------------------------------------------------------------------*/
00093 //#define USE_SDRAM
00094 #define COLOR_CONVERT       RGB_24_TO_RGB565
00095 #define LCD_MODE            ILI9488_EBIMODE
00096 
00097 /*----------------------------------------------------------------------------
00098  *        Local variables
00099  *----------------------------------------------------------------------------*/
00100 /** Global DMA driver for all transfer */
00101 static sXdmad lcdEbiDma;
00102 
00103 /** Image buffer (16-bits color). */
00104 const uint32_t gImageBuffer[DEMO_IMAGE_HEIGHT * DEMO_IMAGE_WIDTH] = DEMO_IMAGE;
00105 rect canvas_region[4];
00106 static rect lcd_rc;
00107 
00108 #if defined USE_SDRAM
00109 #pragma location = "sdram_region"
00110 #endif
00111 COMPILER_ALIGNED(32) static uint16_t
00112             cavas_region_buf[BOARD_LCD_WIDTH * BOARD_LCD_HEIGHT / 4];
00113 static TimeEvent RegionTimeEvent[4];
00114 
00115 static uint8_t sin_xy[236] =
00116 {
00117     78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 107,
00118     109, 111, 113, 115, 116, 118, 120, 121, 123, 125, 126, 128, 129, 130, 132, 133,
00119     135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 147, 148, 149,
00120     149, 150, 150, 151, 151, 151, 152, 152, 152, 152, 152, 152, 152, 152, 152, 151,
00121     151, 151, 150, 150, 149, 149, 148, 147, 147, 146, 145, 144, 143, 142, 141, 140,
00122     139, 138, 137, 136, 135, 133, 132, 130, 129, 128, 126, 125, 123, 121, 120, 118,
00123     116, 115, 113, 111, 109, 107, 106, 104, 102, 100, 98 , 96 , 94 , 92 , 90 , 88 ,
00124     86 , 84 , 82 , 80 , 78 , 76 , 74 , 72 , 70 , 68 , 66 , 64 , 62 , 60 , 58 , 56 ,
00125     54 , 52 , 50 , 48 , 46 , 45 , 43 , 41 , 39 , 37 , 36 , 34 , 32 , 31 , 29 , 27 ,
00126     26 , 24 , 23 , 22 , 20 , 19 , 17 , 16 , 15 , 14 , 13 , 12 , 11 , 10 , 9  , 8  ,
00127     7  , 6  , 5  , 5  , 4  , 3  , 3  , 2  , 2  , 1  , 1  , 1  , 0  , 0  , 0  , 0  ,
00128     0  , 0  , 0  , 0  , 0  , 1  , 1  , 1  , 2  , 2  , 3  , 3  , 4  , 5  , 5  , 6  ,
00129     7  , 8  , 9  , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 19 , 20 , 22 , 23 , 24 ,
00130     26 , 27 , 29 , 31 , 32 , 34 , 36 , 37 , 39 , 41 , 43 , 45 , 46 , 48 , 50 , 52 ,
00131     54 , 56 , 58 , 60 , 62 , 64 , 66 , 68 , 70 , 72 , 74 , 76
00132 };
00133 
00134 uint32_t gColorArray[] =
00135 {
00136     0x000000, 0xFFFFFF, 0x0000FF, 0xFF0000,
00137     0x000080, 0x00008B, 0x006400, 0x008B8B,
00138     0x00FFFF, 0x40E0D0, 0x4B0082, 0x800000,
00139     0x808000, 0x808080, 0x87CEEB, 0x8A2BE2,
00140     0x90EE90, 0x9400D3, 0x9ACD32, 0xA52A2A,
00141     0xA9A9A9, 0xA0522D, 0xADD8E6, 0xADFF2F,
00142     0xC0C0C0, 0xD3D3D3, 0xE0FFFF, 0xEE82EE,
00143     0xF0FFFF, 0xF5F5DC, 0xFF00FF, 0xFF6347,
00144 };
00145 
00146 
00147 /**
00148  * ISR for XDMA interrupt
00149  */
00150 void XDMAC_Handler(void)
00151 {
00152     XDMAD_Handler(&lcdEbiDma);
00153 }
00154 
00155 /**
00156  * canvas region initialization.
00157  */
00158 static void init_canvas_region(void)
00159 {
00160     uint32_t w, h;
00161 
00162     w = 480;
00163     h = 320;
00164 
00165     canvas_region[0].x = 0;
00166     canvas_region[0].y = 0;
00167     canvas_region[0].width = w / 2 - 1;
00168     canvas_region[0].height = h / 2 - 1;
00169 
00170     canvas_region[1].x = w / 2;
00171     canvas_region[1].y = 0;
00172     canvas_region[1].width = w / 2 - 1;
00173     canvas_region[1].height = h / 2 - 1;
00174 
00175     canvas_region[2].x = 0;
00176     canvas_region[2].y = h / 2;
00177     canvas_region[2].width = w / 2 - 1;
00178     canvas_region[2].height = h / 2 - 1;
00179 
00180     canvas_region[3].x = w / 2;
00181     canvas_region[3].y = h / 2;
00182     canvas_region[3].width = w / 2 - 1;
00183     canvas_region[3].height = h / 2 - 1;
00184 
00185     lcd_rc.x = 0;
00186     lcd_rc.y = 0;
00187     lcd_rc.width = w - 1;
00188     lcd_rc.height = h - 1;
00189 
00190 }
00191 
00192 /**
00193  * Draw coordinate axis with with giving buffer.
00194  */
00195 static void draw_coordinate_axis(uint16_t* pCanvasBuffer,
00196                                 uint32_t x,
00197                                 uint32_t y,
00198                                 uint32_t ex,
00199                                 uint32_t ey,
00200                                 uint32_t pixel_width,
00201                                 uint32_t color)
00202 {
00203     LCDD_DrawLine(pCanvasBuffer, x, y, ex, y + pixel_width - 1, color);
00204     LCDD_DrawLine(pCanvasBuffer, x, y, x + pixel_width - 1 , ey, color);
00205     LCDD_DrawLine(pCanvasBuffer, ex - 12, y - 4 ,ex, y ,  color);
00206     LCDD_DrawLine(pCanvasBuffer, ex - 12, y + 4 ,ex, y ,  color);
00207     LCDD_DrawLine(pCanvasBuffer, x - 4,  ey + 12 ,x, ey , color);
00208     LCDD_DrawLine(pCanvasBuffer, x + 4,  ey + 12 ,x, ey , color);
00209 }
00210 
00211 /**
00212  * Draw sin wave with with giving buffer.
00213  */
00214 static void draw_sin_wave(uint16_t* pCanvasBuffer,
00215                         uint32_t offset_x,
00216                         uint32_t offset_y,
00217                         uint32_t color)
00218 {
00219     uint32_t i = 0;
00220 
00221     for (i = 0; i < sizeof(sin_xy); i++) {
00222         LCDD_DrawPixel(pCanvasBuffer,i + offset_x, offset_y - sin_xy[i], color);
00223     }
00224 }
00225 
00226 /**
00227  * Draw histogram.
00228  */
00229 static void draw_random_histogram(uint32_t height, uint32_t color)
00230 {
00231     uint8_t rand_val[32];
00232     uint32_t i;
00233     uint32_t offset_x = 24;
00234     uint32_t offset_y = height - 4;
00235     uint32_t w = 6;
00236     uint32_t * p_val = (uint32_t *)rand_val;
00237 
00238     for (i = 0; i < 8; i++) {
00239         TRNG->TRNG_CR = TRNG_CR_KEY_PASSWD | TRNG_CR_ENABLE;
00240         while (!(TRNG->TRNG_ISR & TRNG_ISR_DATRDY));
00241         p_val[i] = TRNG->TRNG_ODATA;
00242     }
00243     for (i = 0; i < 32; i++) {
00244         rand_val[i] = offset_y - rand_val[i] * offset_y / 255;
00245     }
00246     for (i = 0; i < 32; i++) {
00247         LCDD_DrawRectangleWithFill(cavas_region_buf,
00248                                 offset_x+i*w,
00249                                 rand_val[i],
00250                                 6,
00251                                 offset_y-rand_val[i],
00252                                 color);
00253     }
00254 }
00255 
00256 /**
00257  * Update canvas region 1.
00258  */
00259 static void update_region1(uint32_t pos)
00260 {
00261     LCDD_SetUpdateWindowSize(canvas_region[0]);
00262     LCDD_DrawRectangleWithFill(cavas_region_buf,canvas_region[0].x,
00263                             canvas_region[0].y,
00264                             canvas_region[0].width,canvas_region[0].height,
00265                             COLOR_CONVERT(COLOR_BLUE));
00266     draw_coordinate_axis(cavas_region_buf,
00267                         4,
00268                         canvas_region[0].height - 3,
00269                         canvas_region[0].width,
00270                         0,
00271                         1,
00272                         COLOR_CONVERT(COLOR_WHITE));
00273 
00274     draw_sin_wave(cavas_region_buf,
00275                 4,
00276                 155,
00277                 COLOR_CONVERT(COLOR_WHITE));
00278 
00279     LCDD_DrawRectangleWithFill(cavas_region_buf,
00280                             4 + pos - 2,
00281                             155 - sin_xy[pos] - 2,
00282                             3,
00283                             3,
00284                             COLOR_CONVERT(COLOR_YELLOW));
00285     LCDD_UpdatePartialWindow((uint8_t*)cavas_region_buf,sizeof(cavas_region_buf));
00286 }
00287 
00288 /**
00289  * Update canvas region 2.
00290  */
00291 static void update_region2(uint32_t x,uint32_t y,uint32_t color)
00292 {
00293     LCDD_SetUpdateWindowSize(canvas_region[1]);
00294     LCDD_DrawRectangleWithFill(cavas_region_buf,
00295                             0,
00296                             0,
00297                             canvas_region[1].width,
00298                             canvas_region[1].height,
00299                             COLOR_CONVERT(COLOR_GREEN));
00300     LCD_DrawString(cavas_region_buf,x, y, (const uint8_t *)"SAMV71",  COLOR_CONVERT(color));
00301     LCDD_UpdatePartialWindow((uint8_t*)cavas_region_buf,sizeof(cavas_region_buf));
00302 }
00303 
00304 /**
00305  * Update canvas region 3.
00306  */
00307 static void update_region3(uint32_t alpha)
00308 {
00309     uint32_t i,j;
00310 
00311     LCDD_SetUpdateWindowSize(canvas_region[2]);
00312     LCDD_DrawRectangleWithFill(cavas_region_buf,
00313                             0,
00314                             0,
00315                             canvas_region[2].width,
00316                             canvas_region[2].height,
00317                             COLOR_CONVERT(COLOR_MAGENTA));
00318 
00319     i = ((canvas_region[2].width + 1) - DEMO_IMAGE_WIDTH) / 2;
00320     j = ((canvas_region[2].height + 1) - DEMO_IMAGE_HEIGHT) / 2;
00321     LCDD_BitBltAlphaBlend(cavas_region_buf,
00322                         i,
00323                         j,
00324                         canvas_region[2].width + 1,
00325                         canvas_region[2].height + 1,
00326                         (LcdColor_t *)gImageBuffer,
00327                         0,
00328                         0,
00329                         DEMO_IMAGE_WIDTH,DEMO_IMAGE_HEIGHT,alpha);
00330     LCDD_UpdatePartialWindow((uint8_t*)cavas_region_buf,sizeof(cavas_region_buf));
00331 }
00332 
00333 /**
00334  * Update canvas region 4.
00335  */
00336 static void update_region4(void)
00337 {
00338     LCDD_SetUpdateWindowSize(canvas_region[3]);
00339     LCDD_DrawRectangleWithFill(cavas_region_buf,
00340                             0,
00341                             0,
00342                             canvas_region[3].width,canvas_region[3].height,
00343                             COLOR_CONVERT(COLOR_WHITE));
00344 
00345     draw_random_histogram( canvas_region[3].height + 1, COLOR_CONVERT(COLOR_RED));
00346 
00347     LCDD_UpdatePartialWindow((uint8_t*)cavas_region_buf,sizeof(cavas_region_buf));
00348 }
00349 
00350 /**
00351  *  \brief LCD Application entry point.
00352  *
00353  *  \return Unused (ANSI-C compatibility).
00354  */
00355 extern int main( void )
00356 {
00357     uint32_t i, j;
00358 
00359     int32_t dX, dY;
00360     uint32_t region1_pos = 0;
00361     uint32_t region2_x,region2_y;
00362     TimeEvent *pEvent;
00363     uint32_t alpha = 0;
00364     int8_t alpha_direction = 4;
00365 
00366     /* Disable watchdog */
00367     WDT_Disable(WDT);
00368 
00369     SCB_EnableICache();
00370     SCB_EnableDCache();
00371 
00372     /* Output example information */
00373     printf("-- LCD EBI Example %s --\n\r", SOFTPACK_VERSION);
00374     printf("-- %s\n\r", BOARD_NAME);
00375     printf("-- Compiled: %s %s With %s--\n\r", __DATE__, __TIME__, COMPILER_NAME);
00376 
00377 #if defined USE_SDRAM
00378     BOARD_ConfigureSdram();
00379 #endif
00380 
00381     PMC_EnablePeripheral(ID_TRNG);
00382 
00383     /* Configure systick for 1 ms. */
00384     TimeTick_Configure();
00385 
00386     RegionTimeEvent[0].event = 1;
00387     RegionTimeEvent[0].time_tick = 1;
00388     RegionTimeEvent[0].time_start = 0;
00389     RegionTimeEvent[0].pPreEvent = 0;
00390     RegionTimeEvent[0].pNextEvent = &RegionTimeEvent[1];
00391 
00392     RegionTimeEvent[1].event = 2;
00393     RegionTimeEvent[1].time_tick = 500;
00394     RegionTimeEvent[1].time_start = 0;
00395     RegionTimeEvent[1].pPreEvent = &RegionTimeEvent[0];
00396     RegionTimeEvent[1].pNextEvent = &RegionTimeEvent[2];
00397 
00398     RegionTimeEvent[2].event = 3;
00399     RegionTimeEvent[2].time_tick = 20;
00400     RegionTimeEvent[2].time_start = 0;
00401     RegionTimeEvent[2].pPreEvent = &RegionTimeEvent[2];
00402     RegionTimeEvent[2].pNextEvent = &RegionTimeEvent[3];
00403 
00404     RegionTimeEvent[3].event = 4;
00405     RegionTimeEvent[3].time_tick = 300;
00406     RegionTimeEvent[3].time_start = 0;
00407     RegionTimeEvent[3].pPreEvent = &RegionTimeEvent[2];
00408     RegionTimeEvent[3].pNextEvent = 0;
00409 
00410     SetTimeEvent(RegionTimeEvent);
00411 
00412     pEvent = RegionTimeEvent;
00413 
00414     /* Initialize LCD and its interface */
00415     LCDD_Initialize(LCD_MODE, &lcdEbiDma, 1);
00416 
00417     init_canvas_region();
00418     LCDD_SetUpdateWindowSize(lcd_rc);
00419 
00420     LCDD_SetUpdateWindowSize(canvas_region[0]);
00421     LCDD_DrawRectangleWithFill(cavas_region_buf,
00422                             canvas_region[0].x,
00423                             canvas_region[0].y,
00424                             canvas_region[0].width,canvas_region[0].height,
00425                             COLOR_CONVERT(COLOR_BLUE));
00426 
00427     draw_coordinate_axis(cavas_region_buf,
00428                         4,
00429                         canvas_region[0].height - 3,
00430                         canvas_region[0].width,
00431                         0,
00432                         1,
00433                         COLOR_CONVERT(COLOR_WHITE));
00434 
00435     draw_sin_wave(cavas_region_buf,
00436                 4,
00437                 155,
00438                 COLOR_CONVERT(COLOR_WHITE));
00439 
00440     LCDD_UpdatePartialWindow((uint8_t *)cavas_region_buf, sizeof(cavas_region_buf));
00441 
00442     LCDD_SetUpdateWindowSize(canvas_region[1]);
00443     LCDD_DrawRectangleWithFill(cavas_region_buf,
00444                             0,
00445                             0,
00446                             canvas_region[1].width,
00447                             canvas_region[1].height,
00448                             COLOR_CONVERT(COLOR_GREEN));
00449     LCD_DrawString(cavas_region_buf,10, 5, (const uint8_t *)"SAMV71",  COLOR_CONVERT(COLOR_BLACK));
00450     LCDD_UpdatePartialWindow((uint8_t *)cavas_region_buf, sizeof(cavas_region_buf));
00451 
00452     LCDD_SetUpdateWindowSize(canvas_region[2]);
00453     LCDD_DrawRectangleWithFill(cavas_region_buf,
00454                             0,
00455                             0,
00456                             canvas_region[2].width,
00457                             canvas_region[2].height,
00458                             COLOR_CONVERT(COLOR_MAGENTA));
00459     i = ((canvas_region[2].width + 1) - DEMO_IMAGE_WIDTH) / 2;
00460     j = ((canvas_region[2].height + 1) - DEMO_IMAGE_HEIGHT) / 2;
00461     LCDD_BitBlt(cavas_region_buf, i, j,
00462                 DEMO_IMAGE_WIDTH, DEMO_IMAGE_HEIGHT,
00463                 (LcdColor_t *)gImageBuffer, 0, 0,
00464                 DEMO_IMAGE_WIDTH, DEMO_IMAGE_HEIGHT);
00465     LCDD_UpdatePartialWindow((uint8_t*)cavas_region_buf, sizeof(cavas_region_buf));
00466 
00467     LCDD_SetUpdateWindowSize(canvas_region[3]);
00468     LCDD_DrawRectangleWithFill(cavas_region_buf,
00469                             0,
00470                             0,
00471                             canvas_region[3].width,
00472                             canvas_region[3].height,
00473                             COLOR_CONVERT(COLOR_WHITE));
00474 
00475     draw_random_histogram(canvas_region[3].height + 1,
00476                         COLOR_CONVERT(COLOR_RED));
00477 
00478     LCDD_UpdatePartialWindow((uint8_t*)cavas_region_buf, sizeof(cavas_region_buf));
00479     region2_x = 0;
00480     region2_y = 0;
00481     dX = 2;
00482     dY = 2;
00483     RegionTimeEvent[0].time_start = 1;
00484     RegionTimeEvent[1].time_start = 1;
00485     RegionTimeEvent[2].time_start = 1;
00486     RegionTimeEvent[3].time_start = 1;
00487     while (1) {
00488         while (pEvent) {
00489             if (pEvent->occur) {
00490                 pEvent->occur = 0;
00491                 switch (pEvent->event) {
00492                 case 1:
00493                     update_region1(region1_pos);
00494                     pEvent->time_tick = 1;
00495                     pEvent->time_start = 1;
00496                     if (region1_pos == 236)
00497                         region1_pos = 0;
00498                     else
00499                         region1_pos++;
00500                     pEvent = pEvent->pNextEvent;
00501                     break;
00502 
00503                 case 2:
00504                     TRNG->TRNG_CR = TRNG_CR_KEY_PASSWD | TRNG_CR_ENABLE;
00505                     while (!(TRNG->TRNG_ISR & TRNG_ISR_DATRDY));
00506                     i = TRNG->TRNG_ODATA;
00507                     j = (i >> 16) & 0x1F;
00508                     region2_x =i & 0xFF;
00509                     region2_y =(i >> 8)&0xFF;
00510                     region2_x = region2_x * (canvas_region[1].width - 80) / 0xFF;
00511                     region2_y = region2_y * (canvas_region[1].height - 20) / 0xFF;
00512                     update_region2(region2_x,region2_y,COLOR_CONVERT(gColorArray[j]));
00513                     if ((region2_x >= (canvas_region[1].width - 80))
00514                             && (region2_y < (canvas_region[1].height - 20))) {
00515                         region2_x -=dX;
00516                         dX=-dX;
00517                     } else if ((region2_x < (canvas_region[1].width - 80))
00518                             && (region2_y >= (canvas_region[1].height - 20))) {
00519                         region2_y -=dY;
00520                         dY=-dY;
00521                     }
00522                     pEvent->time_tick = 500;
00523                     pEvent->time_start = 1;
00524                     pEvent = pEvent->pNextEvent;
00525                     break;
00526 
00527                 case 3:
00528                     update_region3(alpha);
00529                     alpha += alpha_direction;
00530                     if (alpha >= 255)
00531                         alpha_direction = -4;
00532                     else if (alpha <= 0)
00533                         alpha_direction = 4;
00534                     pEvent->time_tick = 20;
00535                     pEvent->time_start = 1;
00536                     pEvent = pEvent->pNextEvent;
00537                     break;
00538 
00539                 case 4:
00540                     update_region4();
00541                     pEvent->time_tick = 300;
00542                     pEvent->time_start = 1;
00543                     break;
00544                 }
00545             } else {
00546                 pEvent = RegionTimeEvent;
00547             }
00548         }
00549     }
00550 }
00551 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines