Esempio n. 1
0
static void writeReg(lcd_data_t reg, lcd_data_t data)
{
    setRS(0);
    writeLcd(reg);
    setRS(1);
    writeLcd(data);
}
Esempio n. 2
0
void lcdTest(void)
{
    for(int y=0; y<240; y++) {
        lcdPixel(0, y, COLOR_WHITE);
        lcdPixel(319, y, COLOR_WHITE);
    }
    for(int x=0; x<320; x++) {
        lcdPixel(x, 0, COLOR_WHITE);
        lcdPixel(x, 239, COLOR_WHITE);
    }

    lcdStr(2, 2, "Hello world!", COLOR_GREEN, COLOR_BLUE);
    return;
    writeReg(0x004f, 0); // Set GDDRAM X address counter 
    writeReg(0x004e, 0); // Set GDDRAM Y address counter 
    setRS(0);
    writeLcd(0x22); // RAM data write register
    setRS(1);
    for(int y=0; y<240; y++) {
        for(int x=0; x<320; x++) {
            writeLcd(lcdColor(y, x, 0));
            /*
            if((y & 0x10) ^ (x & 0x10)) {
                writeLcd(lcdColor(0xff, 0, 0));
            } else {
                writeLcd(lcdColor(0, 0xff, 0));
            }
            */
        }
    }
}
Esempio n. 3
0
void lcdFill(lcd_color_t color)
{
    writeReg(0x004f, 0); // Set GDDRAM X address counter 
    writeReg(0x004e, 0); // Set GDDRAM Y address counter 
    setRS(0); writeLcd(0x22); // RAM data write register
    setRS(1);
    for(int i=0; i<320*240; i++) {
        writeLcd(color);
    }
}
Esempio n. 4
0
//Prints a single character specified by its ASCII code to the display.
void printChar(u08 data)
{
	//set RS (Register Select) line high to select data register
	sbi(PORTD, 7);
	writeLcd(data);
	delayUs(50);
}
Esempio n. 5
0
//Writes a command byte to the LCD.
void writeControl(u08 data)
{
	//set RS (Register Select) line low to select command register
	cbi(PORTD, 7);
	writeLcd(data);
	//wait for the instruction to be executed
	delayUs(100);
}
Esempio n. 6
0
void lcdChar(int x, int y, char c, lcd_color_t fg, lcd_color_t bg)
{
    uint8_t* ptr = fnt8x8 + (unsigned int)c*8;
    for(int py=y; py<y+FONT_H; py++) 
    {
        writeReg(0x004f, x); // Set GDDRAM X address counter 
        writeReg(0x004e, py); // Set GDDRAM Y address counter 
        setRS(0); writeLcd(0x22); // RAM data write register
        setRS(1);
        uint8_t l = *ptr++;
        for(int px=x; px<x+FONT_W; px++)
        {
            if (l & 0x80) {
                writeLcd(fg);
            } else {
                writeLcd(bg);
            }
            l <<= 1;
        }
    }
}