Esempio n. 1
0
/*********************************************************************
*
*       _InitController
*
* Purpose:
*   Initializes the display controller
*/
static void _InitController(void) {
  #ifndef WIN32
    LCD_X_Init();
    _Write0(0x94); // Exit sleep mode
    _Write0(0xD1); // Internal oscillator on
    _Write0(0xF7); // Mono selection
    _Write1(0x00); //   ''
    _Write1(0x0E); //   ''
    _Write1(0x41); //   ''
    _Write0(0xBB); // COM output scan direction
    _Write1(0x01); //   COM0->COM64, COM129->COM65
    _Write0(0xBC); // Data output scan direction
    _Write1(0x00); //   Normal page/column
    _Write1(0x24); //   Gray scale setting
    _Write1(0x00); //   PWM
    _Write0(0xCA); // Display control set
    _Write1(0x00); //   Dummy
    _Write1(0x1F); //   Duty = 1/128
    _Write1(0x00); //   Dummy
    _Write0(0x81); // Contrast level
    _Write1(0x10); //   X0-5: 010000
    _Write1(0x07); //   Y0-2: 111
    _Write0(0x20); // Power control register set
    _Write1(0x07); //   5x booster
    _Write0(0xFB); // Set biasing ratio
    _Write1(0x02); //   1/11 bias
    _Write0(0xAF); // Display on
  #endif
}
Esempio n. 2
0
/*********************************************************************
*
*       _InitController
*
* Purpose:
*   Initializes the display controller
*/
static void _InitController(void) {
  #ifndef WIN32
    #define BYTES_PER_LINE ((XSIZE_PHYS + 7) >> 2)
    LCD_X_Init();
    _Write1(0x40);                                 // SYSTEM SET:
    _Delay(255);                                   // Wait a while
    _Write0((1 << 5)                               //   P1: Screen Origin Compensation: not done.
          | (1 << 4)                               //       Reserved
          | (0 << 3)                               //       Panel Drive Select: single panel drive
          | (0 << 2)                               //       Character Height: 8 pixels
          | (0 << 1)                               //       Reserved
          | (0 << 0));                             //       Character Generator Select: CGROM
    _Write0((1 << 7)                               //   P2: MOD: two-frame AC drive
          | (7 << 0));                             //       Horizontal Character Size: 8
    _Write0((7 << 0));                             //   P3: Vertical Character Size: 8
    _Write0(BYTES_PER_LINE - 1);                   //   P4: Character Bytes Per Row
    _Write0(BYTES_PER_LINE + 2);                   //   P5: Total Character Bytes Per Row
    _Write0(YSIZE_PHYS - 1);                       //   P6: Frame Height
    _Write0(BYTES_PER_LINE);                       //   P7: Horizontal Address Range Register 0
    _Write0(0x00);                                 //   P8: Horizontal Address Range Register 1
    _Write1(0x44);                                 // SCROLL:
    _Write0((BYTES_PER_LINE * YSIZE_PHYS) & 0xff); //   Screen Block 1 Start Address Register 0 (Text)
    _Write0((BYTES_PER_LINE * YSIZE_PHYS) >> 8);   //   Screen Block 1 Start Address Register 1 (Text)
    _Write0(YSIZE_PHYS);                           //   Screen Block 1 Size Register
    _Write0(0);                                    //   Screen Block 2 Start Address Register 0 (Graphic)
    _Write0(0);                                    //   Screen Block 2 Start Address Register 0 (Graphic)
    _Write0(YSIZE_PHYS);                           //   Screen Block 2 Size Register
    _Write1(0x4C);                                 // CSR DIR: Set cursor shift direction to right
    _Write1(0x5A);                                 // HDOT SCR:
    _Write0(0 << 0);                               //   Horizontal Pixel Scroll bits: 0
    _Write1(0x5B);                                 // OVLAY:
    _Write0((0 << 4)                               //   two layers are used
          | (0 << 3)                               //   screen block 2 and 4 can display graphics
          | (0 << 2)                               //   screen block 2 and 4 can display graphics
          | (1 << 0));                             //   Layer Composition Method: Exclusive-OR
    _Write1(0x60);                                 // GRAYSCALE
    _Write0(0x01);                                 //   Bit-Per-Pixel Select bits
  #endif
}
/*********************************************************************
*
*       _InitController
*
* Purpose:
*   Initializes the display controller
*/
static void _InitController(void) {
#ifndef WIN32

  LCD_X_Init();

  /* Driving ability settings --------------------------------------*/
  wr_reg(0xEA, 0x00);         /* Power control internal used (1)    */
  wr_reg(0xEB, 0x20);         /* Power control internal used (2)    */
  wr_reg(0xEC, 0x0C);         /* Source control internal used (1)   */
  wr_reg(0xED, 0xC7);         /* Source control internal used (2)   */
  wr_reg(0xE8, 0x38);         /* Source output period Normal mode   */
  wr_reg(0xE9, 0x10);         /* Source output period Idle mode     */
  wr_reg(0xF1, 0x01);         /* RGB 18-bit interface ;0x0110       */
  wr_reg(0xF2, 0x10);       

  /* Adjust the Gamma Curve ----------------------------------------*/
  wr_reg(0x40, 0x01);
  wr_reg(0x41, 0x00);
  wr_reg(0x42, 0x00);
  wr_reg(0x43, 0x10);
  wr_reg(0x44, 0x0E);
  wr_reg(0x45, 0x24);
  wr_reg(0x46, 0x04);
  wr_reg(0x47, 0x50);
  wr_reg(0x48, 0x02);
  wr_reg(0x49, 0x13);
  wr_reg(0x4A, 0x19);
  wr_reg(0x4B, 0x19);
  wr_reg(0x4C, 0x16);

  wr_reg(0x50, 0x1B);
  wr_reg(0x51, 0x31);
  wr_reg(0x52, 0x2F);
  wr_reg(0x53, 0x3F);
  wr_reg(0x54, 0x3F);
  wr_reg(0x55, 0x3E);
  wr_reg(0x56, 0x2F);
  wr_reg(0x57, 0x7B);
  wr_reg(0x58, 0x09);
  wr_reg(0x59, 0x06);
  wr_reg(0x5A, 0x06);
  wr_reg(0x5B, 0x0C);
  wr_reg(0x5C, 0x1D);
  wr_reg(0x5D, 0xCC);

  /* Power voltage setting -----------------------------------------*/
  wr_reg(0x1B, 0x1B);
  wr_reg(0x1A, 0x01);
  wr_reg(0x24, 0x2F);
  wr_reg(0x25, 0x57);
  wr_reg(0x23, 0x88);

  /* Power on setting ----------------------------------------------*/
  wr_reg(0x18, 0x36);         /* Internal oscillator frequency adj  */
  wr_reg(0x19, 0x01);         /* Enable internal oscillator         */
  wr_reg(0x01, 0x00);         /* Normal mode, no scrool             */
  wr_reg(0x1F, 0x88);         /* Power control 6 - DDVDH Off        */
  GUI_Delay(200);
  wr_reg(0x1F, 0x82);         /* Power control 6 - Step-up: 3 x VCI */
  GUI_Delay(50);                 
  wr_reg(0x1F, 0x92);         /* Power control 6 - Step-up: On      */
  GUI_Delay(50);
  wr_reg(0x1F, 0xD2);         /* Power control 6 - VCOML active     */
  GUI_Delay(50);

  /* Color selection -----------------------------------------------*/
  wr_reg(0x17, 0x55);         /* RGB, System interface: 16 Bit/Pixel*/
  wr_reg(0x00, 0x00);         /* Scrolling off, no standby          */

  /* Interface config ----------------------------------------------*/
  wr_reg(0x2F, 0x11);         /* LCD Drive: 1-line inversion        */
  wr_reg(0x31, 0x00);
  wr_reg(0x32, 0x00);         /* DPL=0, HSPL=0, VSPL=0, EPL=0       */

  /* Display on setting --------------------------------------------*/
  wr_reg(0x28, 0x38);         /* PT(0,0) active, VGL/VGL            */
  GUI_Delay(200);
  wr_reg(0x28, 0x3C);         /* Display active, VGL/VGL            */

//wr_reg(0x16, 0x00);         /* Mem Access Control (MX/Y/V/L,BGR)  */

  /* Display scrolling settings ------------------------------------*/
  wr_reg(0x0E, 0x00);         /* TFA MSB                            */
  wr_reg(0x0F, 0x00);         /* TFA LSB                            */
  wr_reg(0x10, 320 >> 8);     /* VSA MSB                            */
  wr_reg(0x11, 320 & 0xFF);   /* VSA LSB                            */
  wr_reg(0x12, 0x00);         /* BFA MSB                            */
  wr_reg(0x13, 0x00);         /* BFA LSB                            */

#endif  /* WIN32 */
}
/*********************************************************************
*
*       _InitController
*
* Purpose:
*   Initializes the display controller
*/
static void _InitController(void) {
#ifndef WIN32
  U16 driverCode;

  LCD_X_Init();

  driverCode = rd_reg(0x00);

  /* Start Initial Sequence ----------------------------------------*/
  wr_reg(0x01, 0x0100);       /* Set SS bit                         */
  wr_reg(0x02, 0x0700);       /* Set 1 line inversion               */
  wr_reg(0x04, 0x0000);       /* Resize register                    */
  wr_reg(0x08, 0x0207);       /* 2 lines front, 7 back porch        */
  wr_reg(0x09, 0x0000);       /* Set non-disp area refresh cyc ISC  */
  wr_reg(0x0A, 0x0000);       /* FMARK function                     */
  wr_reg(0x0C, 0x0000);       /* RGB interface setting              */
  wr_reg(0x0D, 0x0000);       /* Frame marker Position              */
  wr_reg(0x0F, 0x0000);       /* RGB interface polarity             */

  /* Power On sequence ---------------------------------------------*/
  wr_reg(0x10, 0x0000);       /* Reset Power Control 1              */
  wr_reg(0x11, 0x0000);       /* Reset Power Control 2              */
  wr_reg(0x12, 0x0000);       /* Reset Power Control 3              */
  wr_reg(0x13, 0x0000);       /* Reset Power Control 4              */
  GUI_Delay(200);             /* Discharge cap power voltage (200ms)*/
  wr_reg(0x10, 0x12B0);       /* SAP, BT[3:0], AP, DSTB, SLP, STB   */
  wr_reg(0x11, 0x0007);       /* DC1[2:0], DC0[2:0], VC[2:0]        */
  GUI_Delay(50);              /* Delay 50 ms                        */
  wr_reg(0x12, 0x01BD);       /* VREG1OUT voltage                   */
  GUI_Delay(50);              /* Delay 50 ms                        */
  wr_reg(0x13, 0x1400);       /* VDV[4:0] for VCOM amplitude        */
  wr_reg(0x29, 0x000E);       /* VCM[4:0] for VCOMH                 */
  GUI_Delay(50);              /* Delay 50 ms                        */
  wr_reg(0x20, 0x0000);       /* GRAM horizontal Address            */
  wr_reg(0x21, 0x0000);       /* GRAM Vertical Address              */

  /* Adjust the Gamma Curve ----------------------------------------*/
  switch (driverCode) {
    case 0x5408:              /* LCD with SPFD5408 LCD Controller   */
      wr_reg(0x30, 0x0B0D);
      wr_reg(0x31, 0x1923);
      wr_reg(0x32, 0x1C26);
      wr_reg(0x33, 0x261C);
      wr_reg(0x34, 0x2419);
      wr_reg(0x35, 0x0D0B);
      wr_reg(0x36, 0x1006);
      wr_reg(0x37, 0x0610);
      wr_reg(0x38, 0x0706);
      wr_reg(0x39, 0x0304);
      wr_reg(0x3A, 0x0E05);
      wr_reg(0x3B, 0x0E01);
      wr_reg(0x3C, 0x010E);
      wr_reg(0x3D, 0x050E);
      wr_reg(0x3E, 0x0403);
      wr_reg(0x3F, 0x0607);
      break;
    case 0x9325:              /* LCD with RM68050 LCD Controller    */
      wr_reg(0x30, 0x0000);
      wr_reg(0x31, 0x0607);
      wr_reg(0x32, 0x0305);
      wr_reg(0x35, 0x0000);
      wr_reg(0x36, 0x1604);
      wr_reg(0x37, 0x0204);
      wr_reg(0x38, 0x0001);
      wr_reg(0x39, 0x0707);
      wr_reg(0x3C, 0x0000);
      wr_reg(0x3D, 0x000F);
      break;
    case 0x9320:              /* LCD with ILI9320 LCD Controller    */
    default:                  /* LCD with other LCD Controller      */
      wr_reg(0x30, 0x0006);
      wr_reg(0x31, 0x0101);
      wr_reg(0x32, 0x0003);
      wr_reg(0x35, 0x0106);
      wr_reg(0x36, 0x0B02);
      wr_reg(0x37, 0x0302);
      wr_reg(0x38, 0x0707);
      wr_reg(0x39, 0x0007);
      wr_reg(0x3C, 0x0600);
      wr_reg(0x3D, 0x020B);
      break;
  }

  /* Set GRAM area -------------------------------------------------*/
  wr_reg(0x50, 0x0000);       /* Horizontal GRAM Start Address      */
  wr_reg(0x51, (HEIGHT-1));   /* Horizontal GRAM End   Address      */
  wr_reg(0x52, 0x0000);       /* Vertical   GRAM Start Address      */
  wr_reg(0x53, (WIDTH-1));    /* Vertical   GRAM End   Address      */

  /* Set Gate Scan Line --------------------------------------------*/
  switch (driverCode) {
    case 0x5408:              /* LCD with SPFD5408 LCD Controller   */
    case 0x9325:              /* LCD with RM68050 LCD Controller    */
      wr_reg(0x60, 0xA700);
      break;
    case 0x9320:              /* LCD with ILI9320 LCD Controller    */
    default:                  /* LCD with other LCD Controller      */
      wr_reg(0x60, 0x2700);
      break;
  }
  wr_reg(0x61, 0x0001);       /* NDL,VLE, REV                       */
  wr_reg(0x6A, 0x0000);       /* Set scrolling line                 */

  /* Partial Display Control ---------------------------------------*/
  wr_reg(0x80, 0x0000);
  wr_reg(0x81, 0x0000);
  wr_reg(0x82, 0x0000);
  wr_reg(0x83, 0x0000);
  wr_reg(0x84, 0x0000);
  wr_reg(0x85, 0x0000);

  /* Panel Control -------------------------------------------------*/
  wr_reg(0x90, 0x0010);
  wr_reg(0x92, 0x0000);
  wr_reg(0x93, 0x0003);
  wr_reg(0x95, 0x0110);
  wr_reg(0x97, 0x0000);
  wr_reg(0x98, 0x0000);

//wr_reg(0x03, 0x0000);       /* Entry Mode (AM,ID0/1,ORG,BGR)      */

  wr_reg(0x07, 0x0137);       /* 262K color and display ON          */

#endif  /* WIN32 */
}