Public feed
#379726
void lcd_ls020xx::Init()
{
DDRSPI |= (1<<PSPI_MOSI) | (1<<PSPI_SCK) | (1<<PSPI_SS);
DDRLCD |= (1<<PLCD_RESET) | (1<<PLCD_RS);
SPCR = (1<<SPE) | (1<<MSTR); // initialize spi
SPSR = (1<<SPI2X);
sbi(PORTSPI, PSPI_MISO);
sbi(PORTSPI, PSPI_SS); // deselect display
cbi(PORTLCD, PLCD_RESET); // reset it
_delay_ms(1);
sbi(PORTLCD, PLCD_RESET);
_select(); // initialize it
WORD init1[] = {0xFDFD, 0xFDFD};
_sendCmd(init1, arraysize(init1));
_delay_ms(50);
WORD init2[] = {0xEF00, 0xEE04, 0x1B04, 0xFEFE, 0xFEFE, 0xEF90, 0x4A04, 0x7F3F, 0xEE04, 0x4306};
_sendCmd(init2, arraysize(init2));
_delay_ms(7);
WORD init3[] = {0xEF90, 0x0983, 0x0800, 0x0BAF, 0x0A00, 0x0500, 0x0600, 0x0700, 0xEF00, 0xEE0C, 0xEF90, 0x0080, 0xEFB0, 0x4902, 0xEF00, 0x7F01, 0xE181, 0xE202, 0xE276, 0xE183};
_sendCmd(init3, arraysize(init3));
_delay_ms(50);
WORD init4[] = {0x8001, 0xEF90, 0x0000};
_sendCmd(init4, arraysize(init4));
_deselect();
FillScreen(0xFFFF); // clearscreen
}