Lib for the new LCD Display with ILI9341 controller

Dependents:   TFT_Test_ILI9341 touch_piirto TFT_banggood TFT_Test_ILI9341-a-fish ... more

Issue: Few suggestions

Hi, firts thanks for the lib. googling around it seems the ILI9341 has broken cmd 0x04 (read id1,id2,id3, 000000 by default) and 0XD3 (read id4, the 009341 mfg thing). If you send these cmds it seems to hang and further cmds fails too. The workaround i saw in chinese keil examples is to use a read register undocumented cmd 0xD9 to get the ID4

char SPI_TFT_ILI9341::Read_Register(char Addr, char xParameter) { char data=0; wr_cmd(0xd9); /* ext command */ _spi.write(0x10+xParameter); /* 0x11 is the first Parameter */ _cs = 1; data = rd_byte(Addr); return data; } int SPI_TFT_ILI9341::Read_ID4alt(void){ char i; char r; int d=0; for(i=0;i<3;i++) { r=Read_Register(0xd3,i+1); D3 for ID4 d = (d << 8) | r; } return(d); }

btw the rd_byte is bugged

char SPI_TFT_ILI9341::rd_byte(unsigned char cmd) { char r; _dc = 0; _cs = 0; _spi.write(cmd); mbed lib _dc = 1; <-- not _cs = 1 r = _spi.write(0xff); _cs = 1; return(r); }

i personally commented out all the CS HI/LO overhead, i set it low at reset and stays low forever, from datasheet it's (also) the DC=0 that tells the ILI to stop the actual data transfer of parameter/data

another overhead is about the 8/16bit switch for LPC1768, it takes long time to switch, maybe it speeds up the cls() but it slows down the pixel()