コード例 #1
0
ファイル: LCDConf.c プロジェクト: TAKETODAY/STemWin
/*********************************************************************
*
*       _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
}
コード例 #2
0
ファイル: LCDConf.c プロジェクト: qiurenguo2014/youjiesun
/*********************************************************************
*
*       _WriteM0
*
* Purpose:
*   Write multiple bytes to controller, with A0 = 0
*/
static void _WriteM0(unsigned char * pData, int NumItems) {
  do {
    _Write0(*pData++);
  } while (--NumItems);
}
コード例 #3
0
ファイル: LCDConf.c プロジェクト: qiurenguo2014/youjiesun
/*********************************************************************
*
*       _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
}