コード例 #1
0
void LCDContrast(unsigned char contrast)
{

    //  LCD Extended Commands.
    LCDSend(0x21, SEND_CMD);

    // Set LCD Vop (Contrast).
    LCDSend(0x80 | contrast, SEND_CMD);

    //  LCD Standard Commands, horizontal addressing mode.
    LCDSend(0x20, SEND_CMD);
}
コード例 #2
0
ファイル: LCD.c プロジェクト: B-Rich/Tamagotchi-Hack
void LCDFill (unsigned char xs,unsigned char ys,unsigned char width,unsigned char height, unsigned char color)
{
    unsigned char i,j;

    for (i=0;i < height;i++)	// Number of horizontal lines
    {
		LCDSetXY(xs,ys+i);		// Goto start of fill area (Top Left)
		LCDSend(PRAMWR);		// Write to display

		for (j=0;j < width;j++)	// pixels per line
			LCDSend(color);
    }
}
コード例 #3
0
void LCDUpdate(void)
{
    int x, y;

    for (y = 0; y < 48 / 8; y++)
    {
        LCDSend(0x80, SEND_CMD);
        LCDSend(0x40 | y, SEND_CMD);
        for (x = 0; x < 84; x++)
        {
            LCDSend(LcdMemory[y * 84 + x], SEND_CHR);
        }
    }
}
コード例 #4
0
void LCDInit(void)
{
    // Initialize SPI Interface
    Initialize_SPI();

    // set pin directions
    LCD_CS_MAKE_OUT();
    LCD_CS_HIGH();
    LCD_DC_MAKE_OUT();
    LCD_RES_MAKE_OUT();

    // Toggle reset pin
    LCD_RES_LOW();
    Delay(1000);
    LCD_RES_HIGH();
    Delay(1000);

    // Send sequence of command
    LCDSend(0x21, SEND_CMD); // LCD Extended Commands.
    LCDSend(0xC8, SEND_CMD); // Set LCD Vop (Contrast). 0xC8
    LCDSend(0x04 | !!(LCD_START_LINE_ADDR & (1u << 6)), SEND_CMD); // Set Temp S6 for start line
    LCDSend(0x40 | (LCD_START_LINE_ADDR & ((1u << 6) - 1)), SEND_CMD); // Set Temp S[5:0] for start line
    //LCDSend( 0x13, SEND_CMD );  // LCD bias mode 1:48.
    LCDSend(0x12, SEND_CMD); // LCD bias mode 1:68.
    LCDSend(0x20, SEND_CMD); // LCD Standard Commands, Horizontal addressing mode.
    //LCDSend( 0x22, SEND_CMD );  // LCD Standard Commands, Vertical addressing mode.
    LCDSend(0x08, SEND_CMD); // LCD blank
    LCDSend(0x0C, SEND_CMD); // LCD in normal mode.

    // Clear and Update
    LCDClear();
    LCDUpdate();
}
コード例 #5
0
ファイル: LCD.c プロジェクト: B-Rich/Tamagotchi-Hack
void LCDSetXY(unsigned char x, unsigned char y)
{
	LCDSend(PPASET);			// page start/end ram
	LCDSend(y);					// Start Page to display to
	LCDSend(131);				// End Page to display to

	LCDSend(PCASET);			// column start/end ram
	LCDSend(x);					// Start Column to display to
	LCDSend(131);				// End Column to display to
}
コード例 #6
0
ファイル: LCD.c プロジェクト: B-Rich/Tamagotchi-Hack
void LCDSetPixel(unsigned char x, unsigned char y, unsigned char color)
{
	LCDSetXY(x,y);				// Set position
	LCDSend(PRAMWR);			// Now write the pixel to the display
	LCDSend(color);				// Write the data in the specified Color
}
コード例 #7
0
ファイル: LCD.c プロジェクト: B-Rich/Tamagotchi-Hack
void LCDInit(void)
{
	int i;

	LCDReset();

	LCDSend(PSWRESET);			// software reset
	SpinDelay(100);
	LCDSend(PSLEEPOUT);			// exit sleep mode
	LCDSend(PBSTRON);			// booster on
	LCDSend(PDISPON);			// display on
	LCDSend(PNORON);			// normal on
	LCDSend(PMADCTL);			// rotate display 180 deg
	LCDSend(0xC0);

	LCDSend(PCOLMOD);			// color mode
	LCDSend(0x02);				// 8bpp color mode

    LCDSend(PSETCON);			// set contrast
    LCDSend(0xDC);

	// clear display
    LCDSetXY(0,0);
	LCDSend(PRAMWR);			// Write to display
	i=LCD_XRES*LCD_YRES;
	while(i--) LCDSend(WHITE);
  
  // test text on different colored backgrounds
	LCDString(" The quick brown fox  ",	(char *)&FONT6x8,1,1+8*0,WHITE  ,BLACK );
	LCDString("  jumped over the     ",	(char *)&FONT6x8,1,1+8*1,BLACK  ,WHITE );
	LCDString("     lazy dog.        ",	(char *)&FONT6x8,1,1+8*2,YELLOW ,RED   );
	LCDString(" AaBbCcDdEeFfGgHhIiJj ",	(char *)&FONT6x8,1,1+8*3,RED    ,GREEN );
	LCDString(" KkLlMmNnOoPpQqRrSsTt ",	(char *)&FONT6x8,1,1+8*4,MAGENTA,BLUE  );
	LCDString("UuVvWwXxYyZz0123456789",	(char *)&FONT6x8,1,1+8*5,BLUE   ,YELLOW);
	LCDString("`-=[]_;',./~!@#$%^&*()",	(char *)&FONT6x8,1,1+8*6,BLACK  ,CYAN  );
	LCDString("     _+{}|:\\\"<>?     ",(char *)&FONT6x8,1,1+8*7,BLUE  ,MAGENTA);
  
	// color bands
	LCDFill(0, 1+8* 8, 132, 8, BLACK);
	LCDFill(0, 1+8* 9, 132, 8, WHITE);
	LCDFill(0, 1+8*10, 132, 8, RED);
	LCDFill(0, 1+8*11, 132, 8, GREEN);
	LCDFill(0, 1+8*12, 132, 8, BLUE);
	LCDFill(0, 1+8*13, 132, 8, YELLOW);
	LCDFill(0, 1+8*14, 132, 8, CYAN);
	LCDFill(0, 1+8*15, 132, 8, MAGENTA);

}