//============================================================================== void ICACHE_FLASH_ATTR tft_fillRect(unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned long color) { // rudimentary clipping (drawChar w/big text requires this) if((x >= _width) || (y >= _height)) return; if((x + w - 1) >= _width) w = _width - x; if((y + h - 1) >= _height) h = _height - y; // TODO: this can result in a very long transaction time // should break this into multiple transactions, even though // it'll cost more overhead, so we don't stall other SPI libs //SPI.beginTransaction(SPISettings(SPICLOCK, MSBFIRST, SPI_MODE0)); LCD_setAddr(x, y, x+w-1, y+h-1); lcdWrite(COMMAND, RAMWR); for(y=h; y>0; y--) { for(x=w; x>0; x--) { setPixel(color); } //setPixel(color); // if (y > 1 && (y & 1)) { // SPI.endTransaction(); // SPI.beginTransaction(SPISettings(SPICLOCK, MSBFIRST, SPI_MODE0)); // } } // SPI.endTransaction(); }
void LCD_clearScreen(unsigned short color) { int i; LCD_setAddr(0,0,_GRAMWIDTH,_GRAMHEIGH); //LATAbits.LATA4 = 0; for (i = 0;i < _GRAMSIZE; i++){ LCD_data16(color); } }
//============================================================================== void ICACHE_FLASH_ATTR drawPixel( int x, int y, long color) { if((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) return; //SPI.beginTransaction(SPISettings(SPICLOCK, MSBFIRST, SPI_MODE0)); LCD_setAddr(x, y, x, y); lcdWrite(COMMAND, RAMWR);//writecommand_cont(ILI9341_RAMWR); setPixel(color);//writedata16_last(color); //SPI.endTransaction(); }
//============================================================================== void ICACHE_FLASH_ATTR tft_drawFastHLine(unsigned int x, unsigned int y, unsigned int w, unsigned long color) { // Rudimentary clipping if((x >= _width) || (y >= _height)) return; if((x+w-1) >= _width) w = _width-x; //SPI.beginTransaction(SPISettings(SPICLOCK, MSBFIRST, SPI_MODE0)); LCD_setAddr(x, y, x+w-1, y); lcdWrite(COMMAND, RAMWR);//writecommand_cont(ILI9341_RAMWR); while (w-- > 0) { setPixel(color);//writedata16_cont(color); } // writedata16_last(color); // SPI.endTransaction(); }
void LCD_drawPixel(unsigned short x, unsigned short y, unsigned short color) { // check boundary LCD_setAddr(x,y,x+1,y+1); LCD_data16(color); }