Library to control a QVGA TFT connected to SPI. You can use printf to print text The lib can handle different fonts, draw lines, circles, rect and bmp
Fork of SPI_TFT by
Diff: SPI_TFT.cpp
- Revision:
- 19:33b5a7d74e66
- Parent:
- 18:52cbeede86f0
--- a/SPI_TFT.cpp Tue Oct 22 20:17:29 2013 +0000 +++ b/SPI_TFT.cpp Tue Feb 21 13:49:57 2017 +0000 @@ -175,8 +175,14 @@ // write to a TFT register void SPI_TFT::wr_reg (unsigned char reg, unsigned char val) { - wr_cmd(reg); - wr_dat(val); + //wr_cmd(reg); + //wr_dat(val); + _cs = 0; + _spi.write(0x7000 | reg); + _cs = 1; + _cs = 0; + _spi.write(0x7200 | val); + _cs = 1; } // read from a TFT register @@ -194,7 +200,8 @@ #else // 16 Bit SPI _spi.format(16,3); // 16 bit spi mode 3 #endif - _spi.frequency(48000000); // 48 Mhz SPI clock + //_spi.frequency(48000000); // 48 Mhz SPI clock + _spi.frequency(25000000); _cs = 1; // cs high _reset = 0; // display reset @@ -360,7 +367,7 @@ // clear screen void SPI_TFT::cls (void) { - fprintf(stderr, "CLS \n\r"); +// fprintf(stderr, "CLS \n\r"); int pixel = ( width() * height()); #if defined USE_DMA int dma_count;