• Main Page
  • Related Pages
  • Data Structures
  • Files
  • File List
  • Globals

lcd_spe_IL9325.c

Go to the documentation of this file.
00001 /****************** COPYRIGHT (C) 2007-2010 RAISONANCE S.A.S. *****************/
00010 /******************************************************************************/
00011 
00012 /* Includes ------------------------------------------------------------------*/
00013 #include "circle.h"
00014 
00015 
00017 
00018 /* Private define ------------------------------------------------------------*/
00019 
00020 /* Private variables ---------------------------------------------------------*/
00021 u16 LCDStatus = 0;
00022 
00023 /* Public variables ---------------------------------------------------------*/
00024 
00025 /* External variable ---------------------------------------------------------*/
00026 
00027 /* Private function prototypes -----------------------------------------------*/
00028 
00029 /* Private functions ---------------------------------------------------------*/
00030 
00031 /*******************************************************************************
00032 *
00033 *                                LCD_Init
00034 *
00035 *******************************************************************************/
00043 /******************************************************************************/
00044 void LCD_Init( void )
00045 {
00046     Screen_Width  = APP_SCREEN_WIDTH;
00047     Screen_Height = APP_SCREEN_HEIGHT;
00048 
00049 
00050     // Starting delay (for LCD startup)
00051     Delayms( 10 );
00052 
00053     /* Configure microcontroller interface for LCD management */
00054     LCD_Interface_Init();
00055 
00056     LCD_Reset();
00057 
00058     LCD_Controller_init();
00059 
00060     LCD_SetOffset( OFFSET_OFF );
00061     LCD_SetDefaultFont();
00062     LCD_SetTransparency( 0 );
00063 
00064     LCD_ClearAllScreen( RGB_WHITE );
00065 
00066     /* Init BackLight*/
00067 #if BACKLIGHT_INTERFACE
00068     LCD_SetBackLight( UTIL_ReadBackupRegister( BKP_BKLIGHT ) );
00069 #endif
00070     LCD_BackLightConfig();
00071 
00072     LCDStatus = LCD_CheckLCDStatus();    //for test
00073 }
00074 
00075 /*******************************************************************************
00076 *
00077 *                                LCD_Controller_init
00078 *
00079 *******************************************************************************/
00084 /******************************************************************************/
00085 void LCD_Controller_init( void )
00086 {
00087 
00088     LCD_Write_Reg( ILI9325_TIMING_CTRL_1, 0x3008 );     // Set internal timing
00089     LCD_Write_Reg( ILI9325_TIMING_CTRL_2, 0x0012 );     // Set internal timing
00090     LCD_Write_Reg( ILI9325_TIMING_CTRL_3, 0x1231 );     // Set internal timing
00091 
00092     LCD_Write_Reg( ILI9325_START_OSC, 0x0001 );         // Start oscillator
00093     Delayms( 50 );
00094 
00095     LCD_Write_Reg( ILI9325_DRV_OUTPUT_CTRL_1, 0x0100 ); // Set SS=1 (Shift direction = 720->1) and SM=0 bit
00096     LCD_Write_Reg( ILI9325_LCD_DRV_CTRL, 0x0700 );      // Set 1 line inversion
00097 
00098     LCD_Write_Reg( ILI9325_ENTRY_MOD, V12_MADCTRVAL );  // TRI=0/DFM=0 (2x8 bits), BGR=1 (RGB swap)
00099     // HWM=0 (no high speed), ORG=0, AM=1, I/D=10
00100 
00101     LCD_Write_Reg( ILI9325_RESIZE_CTRL, 0x0000 );       // Resize register = no resizing
00102     LCD_Write_Reg( ILI9325_DIS_CTRL_2, 0x0202 );        // Set the back porch and front porch = 2 lines
00103     LCD_Write_Reg( ILI9325_DIS_CTRL_3, 0x0000 );        // Set non-display area refresh cycle ISC[3:0]
00104     LCD_Write_Reg( ILI9325_DIS_CTRL_4, 0x0000 );        // FMARK function
00105     LCD_Write_Reg( ILI9325_RGB_CTRL_1, 0x0000 );        // RGB interface setting DM=00 (internal clock)
00106     // RM=0  (RAM acces by system interface)
00107     LCD_Write_Reg( ILI9325_FRAME_MARKER_POS, 0x0000 );  // Frame marker Position
00108     LCD_Write_Reg( ILI9325_RGB_CTRL_2, 0x0000 );        // RGB interface polarity (not concerned)
00109 
00110     // Power ON sequence
00111     LCD_Power_ON();
00112 
00113     // Gamma adjustement
00114     LCD_Gamma_Adjust();
00115 
00116     /* Set GRAM area */
00117     LCD_Write_Reg( ILI9325_HOR_ADDR_START, 0x0000 );    // Horizontal GRAM Start Address
00118     LCD_Write_Reg( ILI9325_HOR_ADDR_END, 0x00EF );      // Horizontal GRAM End Address (239)
00119     LCD_Write_Reg( ILI9325_VET_ADDR_START, 0x0000 );    // Vertical GRAM Start Address
00120     LCD_Write_Reg( ILI9325_VET_ADDR_END, 0x013F );      // Vertical GRAM End Address (319)
00121 
00122     LCD_Write_Reg( ILI9325_DRV_OUTPUT_CTRL_2, 0xA700 ); // Gate Scan Line : GS=1, NL=0X27 (320 lines),
00123     // SCN=00000 (start scan G320)
00124     LCD_Write_Reg( ILI9325_BASE_IMG_CTRL, 0x0001 );     // NDL=0 (non display level), VLE=0 (vertical scroll disable), REV=1 (non grayscale inversion)
00125     LCD_Write_Reg( ILI9325_VSCROLL_CTRL, 0x0000 );      // Set scrolling line
00126 
00127     // Partial image configuration
00128     LCD_Write_Reg( ILI9325_PAR_IMG1_POS, 0 );
00129     LCD_Write_Reg( ILI9325_PAR_IMG1_START, 0 );
00130     LCD_Write_Reg( ILI9325_PAR_IMG1_END, 0 );
00131     LCD_Write_Reg( ILI9325_PAR_IMG2_POS, 0 );
00132     LCD_Write_Reg( ILI9325_PAR_IMG2_START, 0 );
00133     LCD_Write_Reg( ILI9325_PAR_IMG2_END, 0 );
00134 
00135     // Panel interface control
00136     LCD_Write_Reg( ILI9325_PAN_CTRL_1, 0x0010 );        // RTNI=10000 DIVI=00 (16 clocks/horizontal line, internal sync mode)
00137     LCD_Write_Reg( ILI9325_PAN_CTRL_2, 0x0000 );        // NOWI=000(non overlap period = 0 clocks)
00138     LCD_Write_Reg( ILI9325_PAN_CTRL_3, 0x0003 );        // ???
00139     LCD_Write_Reg( ILI9325_PAN_CTRL_4, 0x0110 );        // RTNE=010000 DIVE=01 (DOTCLK ratio 4, 16 clocks/horizontal line, RGB mode)
00140     LCD_Write_Reg( ILI9325_PAN_CTRL_5, 0x0000 );        // ???
00141     LCD_Write_Reg( ILI9325_PAN_CTRL_6, 0x0000 );        // ???
00142 
00143     // Color mode display
00144     LCD_Write_Reg( ILI9325_DIS_CTRL_1, 0x0133 );        // D0/D1=11, BASEE=1, GON=1 (display ON), CL=0 (262K colors)
00145     // PTDE=00 (no partial image)
00146     LCD_Write_Reg( 0xE4, 0x1430 );     // Set full frame read enable
00147 
00148     // Prepare write into graphical RAM
00149     LCD_Write_Reg( ILI9325_GRAM_HADDR, 0x0000 );        // GRAM horizontal Address
00150     LCD_Write_Reg( ILI9325_GRAM_VADDR, 0x0000 );        // GRAM Vertical Address
00151 
00152 
00153 }
00154 
00155 /*******************************************************************************
00156 *
00157 *                                LCD_Power_ON
00158 *
00159 *******************************************************************************/
00164 /******************************************************************************/
00165 void LCD_Power_ON( void )
00166 {
00167     // Reset registers
00168     LCD_Write_Reg( ILI9325_POW_CTRL_1, 0x0000 );    // SAP=0, BT[3:0]=0000, AP=0, DSTB=0, SLP=0, STB=0
00169     LCD_Write_Reg( ILI9325_POW_CTRL_2, 0x0007 );    // DC1[2:0]=000, DC0[2:0]=000 (osc/1), VC[2:0]=111 (Vci/1)
00170     LCD_Write_Reg( ILI9325_POW_CTRL_3, 0x0000 );    // VREG1OUT voltage = halt
00171     LCD_Write_Reg( ILI9325_POW_CTRL_4, 0x0000 );    // VDV[4:0]=00000 for VCOM amplitude = VREG1OUT * 0.7
00172     Delayms( 200 );                                 // Dis-charge capacitor power voltage
00173 
00174     LCD_Write_Reg( ILI9325_POW_CTRL_1, 0x1690 );    // SAP=1  (soure driver enable), BT[3:0]=101, AP=001 (driver =1),
00175     // APE=1 (power supply enbale), DSTB=0, SLP=0, STB=0
00176     LCD_Write_Reg( ILI9325_POW_CTRL_2, 0x0221 );    // DC1[2:0]=010 (f/4), DC0[2:0]=010 (f/16), VC[2:0]=001 (Vci*0.9 = 2,8V)
00177     Delayms( 50 );
00178 
00179     LCD_Write_Reg( ILI9325_POW_CTRL_3, 0x0018 );    // PON=1 (Power ON), VCIRE=0 (external reference)
00180     Delayms( 50 );                                  // VRH=1000 (VREG1OUT voltage = Vci * 1,60  = 4,96V)
00181 
00182     LCD_Write_Reg( ILI9325_POW_CTRL_4, 0x1800 );    // VDV[4:0]=11000 (VCOM amplitude = VRegout * 1,10 = 5,45V)
00183     LCD_Write_Reg( ILI9325_POW_CTRL_7, 0x002A );    // VCM[5:0]=101010 (VCOMH =  VREG1 * 0,895 =  4,44V)
00184     LCD_Write_Reg( ILI9325_FRM_RATE_COLOR, 0x000B ); /* Frame Rate = 70Hz  */
00185     Delayms( 50 );
00186 
00187     return;
00188 }
00189 
00190 /*******************************************************************************
00191 *
00192 *                                LCD_Gamma_Adjust
00193 *
00194 *******************************************************************************/
00199 /*****************************************************************************/
00200 void LCD_Gamma_Adjust( void )
00201 {
00202     LCD_Write_Reg( ILI9325_GAMMA_CTRL_1, 0x0004 );
00203     LCD_Write_Reg( ILI9325_GAMMA_CTRL_2, 0x0007 );
00204     LCD_Write_Reg( ILI9325_GAMMA_CTRL_3, 0x0006 );
00205     LCD_Write_Reg( ILI9325_GAMMA_CTRL_4, 0x0206 );
00206     LCD_Write_Reg( ILI9325_GAMMA_CTRL_5, 0x0408 );
00207     LCD_Write_Reg( ILI9325_GAMMA_CTRL_6, 0x0507 );
00208     LCD_Write_Reg( ILI9325_GAMMA_CTRL_7, 0x0200 );
00209     LCD_Write_Reg( ILI9325_GAMMA_CTRL_8, 0x0707 );
00210     LCD_Write_Reg( ILI9325_GAMMA_CTRL_9, 0x0504 );
00211     LCD_Write_Reg( ILI9325_GAMMA_CTRL_10, 0x0F02 );
00212     return;
00213 }
00214 
00215 
00216 /*******************************************************************************
00217 *
00218 *                                LCD_CheckLCDStatus
00219 *
00220 *******************************************************************************/
00225 /******************************************************************************/
00226 u16 LCD_CheckLCDStatus( void )
00227 {
00228     /* Read LCD device IDs*/
00229     u16 IDcode = LCD_Read_Reg( ILI9325_DRV_CODE );  // Must return 0x9325
00230     return IDcode;
00231 }
00232 
00233 
00234 /*******************************************************************************
00235 *
00236 *                                LCD_Batt
00237 *
00238 *******************************************************************************/
00243 /******************************************************************************/
00244 void LCD_Batt( coord_t xBat, coord_t yBat, bool fDisplayTime, u16 BatState,
00245                u16* OldBatState, divider_t _div, coord_t* widthBat, coord_t* heightBat )
00246 {
00247     color_t bat_color;
00248     static counter_t last_time = 0;
00249     counter_t new_time = RTC_GetCounter();
00250     u8 fill;
00251     bool fBlink;
00252 
00253     UNREFERENCED_PARAMETER( BatState );
00254     UNREFERENCED_PARAMETER( OldBatState );
00255     UNREFERENCED_PARAMETER( _div );
00256 
00257     if ( ( fDisplayTime == 1 ) && ( last_time != new_time ) )
00258     {
00259         last_time = new_time;
00260         switch ( PWR_CurrentState )
00261         {
00262         case PWR_STATE_UNDEF:
00263             return;
00264 
00265         case PWR_STATE_NOBAT:
00266             bat_color = RGB_PINK;
00267             fill = 100;
00268             fBlink = TRUE;
00269             break;
00270 
00271         case PWR_STATE_CHARGING:
00272             bat_color = RGB_BLUE;
00273             fill = 50;
00274             fBlink = TRUE;
00275             break;
00276 
00277         case PWR_STATE_FULL:
00278             bat_color = RGB_GREEN;
00279             fill = 100;
00280             fBlink = FALSE;
00281             break;
00282 
00283         case PWR_STATE_NORMAL:
00284             bat_color = RGB_BLACK;
00285             fBlink = FALSE;
00286             fill = PWR_BatteryLevel;
00287             break;
00288 
00289         case PWR_STATE_LOW:
00290             bat_color = RGB_YELLOW;
00291             fBlink = TRUE;
00292             fill = PWR_BatteryLevel;
00293             break;
00294 
00295         case PWR_STATE_EMPTY:
00296             bat_color = RGB_RED;
00297             fill = 100;
00298             fBlink = TRUE;
00299             break;
00300         }
00301 
00302         *widthBat = ( 20 * fill ) / 100;
00303 
00304         if ( *widthBat > 20 )
00305         {
00306             *widthBat = 20;
00307         }
00308 
00309         if ( fBlink && ( new_time & 1 ) )
00310         {
00311             LCD_FillRect_Circle( ( xBat + 22 ) - *widthBat , yBat + 2 , *widthBat , *heightBat , ( PWR_CurrentState == PWR_STATE_LOW ) ? bat_color : RGB_WHITE );
00312             LCD_FillRect_Circle( xBat + 2 , yBat + 2 , 20 - *widthBat , *heightBat , ( PWR_CurrentState == PWR_STATE_LOW ) ? bat_color : RGB_WHITE );
00313         }
00314         else
00315         {
00316             LCD_FillRect_Circle( ( xBat + 22 ) - *widthBat , yBat + 2 , *widthBat , *heightBat , ( PWR_CurrentState == PWR_STATE_LOW ) ? RGB_WHITE : bat_color );
00317             LCD_FillRect_Circle( xBat + 2 , yBat + 2 , 20 - *widthBat , *heightBat , ( PWR_CurrentState == PWR_STATE_LOW ) ? RGB_RED : RGB_WHITE );
00318         }
00319     }
00320 }
00321 
00322 /*******************************************************************************
00323 *
00324 *                                LCD_Clear
00325 *
00326 *******************************************************************************/
00331 /******************************************************************************/
00332 void LCD_Clear( u16 xBat, u16  yBat )
00333 {
00334     UNREFERENCED_PARAMETER( xBat );
00335     UNREFERENCED_PARAMETER( yBat );
00336 
00337 #if TOUCHSCREEN_AVAIL
00338     if ( TOUCHSCR_GetMode() != TS_CALIBRATION )
00339     {
00340         TOUCHSCR_SetMode( TS_DRAWING );
00341     }
00342 #endif
00343 
00344     DRAW_Batt();
00345 
00346 #if TOUCHSCREEN_AVAIL
00347     TOOLBAR_SetDefaultToolbar();
00348 #endif
00349 }
00350 
00351 /*******************************************************************************
00352 *
00353 *                                LCD_DisplayRotate
00354 *
00355 *******************************************************************************/
00362 /******************************************************************************/
00363 void LCD_DisplayRotate( Rotate_H12_V_Match_TypeDef H12 )
00364 {
00365 
00366     /* Memory Access Control */
00367     LCD_SendLCDCmd_Rotation_Access();
00368 
00369     // Apply desired direction
00370     switch ( H12 )
00371     {
00372     case V3  :
00373         LCD_SendLCDData16( V3_MADCTRVAL >> 8, V3_MADCTRVAL & 0xFF );
00374 
00375         break;
00376 
00377     case V6  :
00378         LCD_SendLCDData16( V6_MADCTRVAL >> 8, V6_MADCTRVAL & 0xFF );
00379 
00380         break;
00381 
00382     case V9  :
00383         LCD_SendLCDData16( V9_MADCTRVAL >> 8, V9_MADCTRVAL & 0xFF );
00384 
00385         break;
00386 
00387     case V12 :
00388     default  :
00389         LCD_SendLCDData16( V12_MADCTRVAL >> 8, V12_MADCTRVAL & 0xFF );
00390         break;
00391 
00392     case V12BMP :
00393         LCD_SendLCDData16( V12BMP_MADCTRVAL >> 8, V12BMP_MADCTRVAL & 0xFF );
00394 
00395         break;
00396 
00397     case V3BMP :
00398         LCD_SendLCDData16( V3BMP_MADCTRVAL >> 8, V3BMP_MADCTRVAL & 0xFF );
00399 
00400         break;
00401 
00402     case V6BMP :
00403         LCD_SendLCDData16( V6BMP_MADCTRVAL >> 8, V6BMP_MADCTRVAL & 0xFF );
00404 
00405         break;
00406 
00407     case V9BMP :
00408         LCD_SendLCDData16( V9BMP_MADCTRVAL >> 8, V9BMP_MADCTRVAL & 0xFF );
00409         break;
00410     }
00411 }
00412 
00414 
00415 /* Public functions ----------------------------------------------------------*/
00416 
00417 /*******************************************************************************
00418 *
00419 *                                LCD_RectRead
00420 *
00421 *******************************************************************************/
00436 /******************************************************************************/
00437 void LCD_RectRead( coord_t x, coord_t y, coord_t width, coord_t height, u8* bmp )
00438 {
00439     u32 line, col;
00440     u16 col0, line0;
00441 
00442     // Reading pixel / pixel
00443     switch ( CurrentScreenOrientation )
00444     {
00445     case V12:
00446         // Read pixels from LCD screen
00447         col0 = Screen_Width - x - 1 + LCD_Offset;
00448         line0 = y + LCD_Offset;
00449         for ( col = 0; col < width; col++ )
00450         {
00451             // Current GRAM horizontal position
00452             LCD_Write_Reg( ILI9325_GRAM_HADDR, col0 - col );
00453 
00454             for ( line = 0; line < height; line++ )
00455             {
00456                 // Current GRAM Vertical position
00457                 LCD_Write_Reg( ILI9325_GRAM_VADDR, line0 + line );
00458 
00459                 // Read pixel 2 bytes
00460                 LCD_PixelRead( &bmp );
00461             }
00462         }
00463         break;
00464 
00465     case V3:
00466         // Read pixels from LCD screen
00467         col0 = y + LCD_Offset;
00468         line0 = x + LCD_Offset;
00469         for ( line = 0; line < width; line++ )
00470         {
00471             // Current GRAM Vertical position
00472             LCD_Write_Reg( ILI9325_GRAM_VADDR, line0 + line );
00473 
00474             for ( col = 0; col < height; col++ )
00475             {
00476                 // Current GRAM horizontal position
00477                 LCD_Write_Reg( ILI9325_GRAM_HADDR, col0 + col );
00478 
00479                 // Read pixel 2 bytes
00480                 LCD_PixelRead( &bmp );
00481             }
00482         }
00483         break;
00484 
00485     case V6:
00486         // Read pixels from LCD screen
00487         col0 = x + LCD_Offset;
00488         line0 = Screen_Height - y - 1 + LCD_Offset;
00489         for ( col = 0; col < width; col++ )
00490         {
00491             // Current GRAM horizontal position
00492             LCD_Write_Reg( ILI9325_GRAM_HADDR, col0 + col );
00493 
00494             for ( line = 0; line < height; line++ )
00495             {
00496                 // Current GRAM Vertical position
00497                 LCD_Write_Reg( ILI9325_GRAM_VADDR, line0 - line );
00498 
00499                 // Read pixel 2 bytes
00500                 LCD_PixelRead( &bmp );
00501             }
00502         }
00503         break;
00504 
00505     case V9:
00506         // Read pixels from LCD screen
00507         col0 = Screen_Width - y - 1 + LCD_Offset;
00508         line0 = Screen_Height - x - 1 + LCD_Offset;
00509         for ( line = 0; line < width; line++ )
00510         {
00511             // Current GRAM Vertical position
00512             LCD_Write_Reg( ILI9325_GRAM_VADDR, line0 - line );
00513 
00514             for ( col = 0; col < height; col++ )
00515             {
00516                 // Current GRAM horizontal position
00517                 LCD_Write_Reg( ILI9325_GRAM_HADDR, col0 - col );
00518 
00519                 // Read pixel 2 bytes
00520                 LCD_PixelRead( &bmp );
00521             }
00522         }
00523         break;
00524 
00525     }
00526 }
00527 
00528 /*******************************************************************************
00529 *
00530 *                                LCD_GetPixel
00531 *
00532 *******************************************************************************/
00545 /******************************************************************************/
00546 u16 LCD_GetPixel( coord_t x, coord_t y )
00547 {
00548     u16 val;
00549     u8 pixel[2];
00550 
00551     LCD_RectRead( x, y, 1, 1, &pixel[0] );
00552     val = ( pixel[1] << 8 ) | pixel[0];
00553     return val;
00554 }
00555 
00556 /*******************************************************************************
00557 *
00558 *                                LCD_SetRect_For_Cmd
00559 *
00560 *******************************************************************************/
00573 /******************************************************************************/
00574 void LCD_SetRect_For_Cmd( coord_t x, coord_t y, coord_t width, coord_t height )
00575 {
00576     // Set GRAM window
00577 
00578     switch ( CurrentScreenOrientation % 4 )
00579     {
00580     case V12:
00581         // Horizontal GRAM Start Address
00582         LCD_Write_Reg( ILI9325_HOR_ADDR_START, Screen_Width - x  - width + LCD_Offset );
00583 
00584         // Horizontal GRAM End Address
00585         LCD_Write_Reg( ILI9325_HOR_ADDR_END,  Screen_Width - x - 1 +  LCD_Offset );
00586 
00587         // Window Vertical GRAM Start Address
00588         LCD_Write_Reg( ILI9325_VET_ADDR_START, y + LCD_Offset ) ;
00589 
00590         // Window Vertical GRAM End Address
00591         LCD_Write_Reg( ILI9325_VET_ADDR_END, y + height - 1 + LCD_Offset );
00592 
00593         // Current GRAM horizontal position
00594         LCD_Write_Reg( ILI9325_GRAM_HADDR, Screen_Width - x - 1 + LCD_Offset );
00595 
00596         // Current GRAM Vertical position
00597         LCD_Write_Reg( ILI9325_GRAM_VADDR, y + LCD_Offset );
00598         break;
00599 
00600     case V3:
00601         // Horizontal GRAM Start Address
00602         LCD_Write_Reg( ILI9325_HOR_ADDR_START, y + LCD_Offset );
00603 
00604         // Horizontal GRAM End Address
00605         LCD_Write_Reg( ILI9325_HOR_ADDR_END, y + height - 1 + LCD_Offset );
00606 
00607         // Window Vertical GRAM Start Address
00608         LCD_Write_Reg( ILI9325_VET_ADDR_START, x + LCD_Offset ) ;
00609 
00610         // Window Vertical GRAM End Address
00611         LCD_Write_Reg( ILI9325_VET_ADDR_END, x + width - 1 + LCD_Offset );
00612 
00613         // Current GRAM horizontal position
00614         LCD_Write_Reg( ILI9325_GRAM_HADDR, y + LCD_Offset );
00615 
00616         // Current GRAM Vertical position
00617         LCD_Write_Reg( ILI9325_GRAM_VADDR, x + LCD_Offset );
00618         break;
00619 
00620     case V6:
00621         // Horizontal GRAM Start Address
00622         LCD_Write_Reg( ILI9325_HOR_ADDR_START, x + LCD_Offset );
00623 
00624         // Horizontal GRAM End Address
00625         LCD_Write_Reg( ILI9325_HOR_ADDR_END, x + width - 1  + LCD_Offset );
00626 
00627         // Window Vertical GRAM Start Address
00628         LCD_Write_Reg( ILI9325_VET_ADDR_START, Screen_Height - y - height + LCD_Offset ) ;
00629 
00630         // Window Vertical GRAM End Address
00631         LCD_Write_Reg( ILI9325_VET_ADDR_END, Screen_Height - y - 1 + LCD_Offset );
00632 
00633         // Current GRAM horizontal position
00634         LCD_Write_Reg( ILI9325_GRAM_HADDR, x + LCD_Offset );
00635 
00636         // Current GRAM Vertical position
00637         LCD_Write_Reg( ILI9325_GRAM_VADDR, Screen_Height - y - 1 + LCD_Offset );
00638         break;
00639 
00640     case V9:
00641         // Horizontal GRAM Start Address
00642         LCD_Write_Reg( ILI9325_HOR_ADDR_START,  Screen_Width - y - height + LCD_Offset );
00643 
00644         // Horizontal GRAM End Address
00645         LCD_Write_Reg( ILI9325_HOR_ADDR_END,  Screen_Width - y - 1 + LCD_Offset );
00646 
00647         // Window Vertical GRAM Start Address
00648         LCD_Write_Reg( ILI9325_VET_ADDR_START,  Screen_Height - x - width + LCD_Offset ) ;
00649 
00650         // Window Vertical GRAM End Address
00651         LCD_Write_Reg( ILI9325_VET_ADDR_END,  Screen_Height - x - 1 + LCD_Offset );
00652 
00653         // Current GRAM horizontal position
00654         LCD_Write_Reg( ILI9325_GRAM_HADDR, Screen_Width - y - 1 + LCD_Offset );
00655 
00656         // Current GRAM Vertical position
00657         LCD_Write_Reg( ILI9325_GRAM_VADDR, Screen_Height - x - 1 + LCD_Offset );
00658         break;
00659     }
00660 }
00661 
00662 /*******************************************************************************
00663 *
00664 *                                LCD_FullScreen
00665 *
00666 *******************************************************************************/
00678 /******************************************************************************/
00679 void LCD_FullScreen( bool FullScreenONOFF )
00680 {
00681     // Fullscreen requested ?
00682     if ( FullScreenONOFF != 0 )
00683     {
00684         // Yes, we stop the toolbar handler
00685 #if TOUCHSCREEN_AVAIL
00686         UTIL_SetSchHandler( TOOLBAR_SCHHDL_ID, 0 );
00687 #endif
00688 
00689         // We block rotation, offset and change limits for screen, char and pointer to whole screen
00690         LCD_SetRotateScreen( 0 );
00691         LCD_SetOffset( OFFSET_OFF );
00692         Screen_Width = PHYS_SCREEN_WIDTH;
00693         Screen_Height = PHYS_SCREEN_HEIGHT;
00694 
00695         // If V3 or V9 orientation, we swap width and height limits
00696         if ( ( LCD_GetScreenOrientation() % 2 ) == 1 )
00697         {
00698             PosCurY = PHYS_SCREEN_WIDTH - Char_Height;
00699             RightMarginX = PHYS_SCREEN_HEIGHT;
00700             HighMarginY = PHYS_SCREEN_WIDTH;
00701             LCD_DrawCharSetFilter( 0, PHYS_SCREEN_HEIGHT, 0, PHYS_SCREEN_WIDTH );
00702             POINTER_SetRect( 0, 0, PHYS_SCREEN_HEIGHT - CurrentPointerWidth, PHYS_SCREEN_WIDTH - CurrentPointerHeight );
00703         }
00704         else
00705         {
00706             PosCurY = PHYS_SCREEN_HEIGHT - Char_Height;
00707             RightMarginX = PHYS_SCREEN_WIDTH;
00708             HighMarginY = PHYS_SCREEN_HEIGHT;
00709             LCD_DrawCharSetFilter( 0, PHYS_SCREEN_WIDTH, 0, PHYS_SCREEN_HEIGHT );
00710             POINTER_SetRect( 0, 0, PHYS_SCREEN_WIDTH - CurrentPointerWidth, PHYS_SCREEN_HEIGHT - CurrentPointerHeight );
00711         }
00712     }
00713     else
00714     {
00715         // No, we come back normal mode
00716         // We restore toolbar handler
00717 #if TOUCHSCREEN_AVAIL
00718         UTIL_SetSchHandler( TOOLBAR_SCHHDL_ID, TOOLBAR_Handler );
00719 #endif
00720 
00721         // We allow rotation,
00722         LCD_SetRotateScreen( 1 );
00723 
00724         // We restore screen, char and pointer to application screen limits
00725         LCD_SetOffset( OFFSET_ON );
00726         LCD_DrawCharSetFilter( 0, APP_SCREEN_WIDTH, 0, APP_SCREEN_HEIGHT );
00727         POINTER_SetRectScreen();
00728     }
00729 
00730 }
00731 
00732 /*******************************************************************************
00733 *
00734 *                                LCD_SendPixelData
00735 *
00736 *******************************************************************************/
00746 /******************************************************************************/
00747 void LCD_SendPixelData( color_t color )
00748 {
00749     LCD_SendLCDData( color & 0xFF  );
00750     LCD_SendLCDData( color >> 8 );
00751 }