v.06
Dependents: ATT_AWS_IoT_demo_v06
Fork of SPI_TFT_ILI9341 by
Diff: SPI_TFT_ILI9341.cpp
- Revision:
- 14:a5d57a0b9d67
- Parent:
- 13:b2b3e5430f81
--- a/SPI_TFT_ILI9341.cpp Wed Jun 25 16:51:27 2014 +0000 +++ b/SPI_TFT_ILI9341.cpp Fri Nov 03 20:24:05 2017 +0000 @@ -668,6 +668,46 @@ } +void SPI_TFT_ILI9341::drawBitmap(int16_t x, int16_t y, const uint16_t *bitmap, int16_t w, int16_t h) { +#if 0 + int16_t i, j; + const uint16_t *p = bitmap; + + for(j=0; j<h; j++) { + for(i=0; i<w; i++ ) { + pixel(x+i, y+j, *p); + p++; + } + } +} +#else + unsigned int j; + int padd; + const uint16_t *bitmap_ptr = bitmap; + unsigned int i; + + // the lines are padded to multiple of 4 bytes in a bitmap + padd = -1; + do { + padd ++; + } while (2*(w + padd)%4 != 0); + + window(x, y, w, h); + wr_cmd(0x2C); // send pixel + SPI::format(16,3); + for (j = 0; j < h; j++) { //Lines + for (i = 0; i < w; i++) { // one line + SPI::write(*bitmap_ptr); // one line + bitmap_ptr++; + } + bitmap_ptr += padd; + } + _cs = 1; + SPI::format(8,3); + WindowMax(); +} +#endif + void SPI_TFT_ILI9341::Bitmap(unsigned int x, unsigned int y, unsigned int w, unsigned int h,unsigned char *bitmap) {