Library for 1.8 inch 160*180 TFT Display. Nice fonts in different formats.
Revision 2:291ac9fb4d64, committed 2015-08-22
- Comitter:
- rolo644u
- Date:
- Sat Aug 22 11:25:19 2015 +0000
- Parent:
- 1:6a6d8d2b19f1
- Commit message:
- Updated
Changed in this revision
ST7735.cpp | Show annotated file Show diff for this revision Revisions of this file |
ST7735.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 6a6d8d2b19f1 -r 291ac9fb4d64 ST7735.cpp --- a/ST7735.cpp Sat Aug 15 11:59:03 2015 +0000 +++ b/ST7735.cpp Sat Aug 22 11:25:19 2015 +0000 @@ -41,9 +41,7 @@ void ST7735::initSPI() { spi->format(8,0); // 8 bits, Mode 0 - spi->frequency(12000000); // SPI clock frequency - //spi->frequency(4000000); // SPI clock frequency - //spi->frequency(22000000); // SPI clock frequency 20.83 Mhz + spi->frequency(20000000); // SPI clock frequency } // Write data word @@ -66,8 +64,8 @@ // Rather than a bazillion writecommand() and writedata() calls, screen -// initialization commands and arguments are organized in these tables -// stored in PROGMEM. The table may look bulky, but that's mostly the +// initialization commands and arguments are organized in tables +// The table may look bulky, but that's mostly the // formatting -- storage-wise this is hundreds of bytes more compact // than the equivalent code. Companion function follows. #define DELAY 0x80 @@ -216,7 +214,7 @@ ms = numArgs & DELAY; // If hibit set, delay follows args numArgs &= ~DELAY; // Mask out delay bit while(numArgs--) { // For each argument... - writedata(pgm_read_byte(addr++)); // Read, issue argument + writedata(pgm_read_byte(addr++)); // Read, issue argument } if(ms) { @@ -1051,3 +1049,5 @@ writecommand(ST7735_RAMWR); // write to RAM } + +
diff -r 6a6d8d2b19f1 -r 291ac9fb4d64 ST7735.h --- a/ST7735.h Sat Aug 15 11:59:03 2015 +0000 +++ b/ST7735.h Sat Aug 22 11:25:19 2015 +0000 @@ -109,16 +109,19 @@ * @param mosi Pin connected to data input * @param sclk Pin connected to serial clock * + * Reset pin from LCD module is connected to reset pin microcontroller */ + ST7735(PinName cePin, PinName dcPin, PinName mosiPin, PinName sclkPin); - + private: void writecommand(char c); void writedata(char c); void initSPI(); void commonInit(const uint8_t *cmdList); void commandList(const uint8_t *addr); - + void pushColor(uint16_t color); + public: uint8_t tabcolor; uint8_t colstart, rowstart; // some displays need this changed @@ -128,7 +131,6 @@ void fillScreen(uint16_t color); void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); void setAddrWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1); - void pushColor(uint16_t color); void invertDisplay(bool i); void drawPixel(int16_t x, int16_t y, uint16_t color); void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);