minor fix, added more stuff
This commit is contained in:
parent
11a4538af5
commit
8a11f31777
6 changed files with 72 additions and 12 deletions
|
|
@ -192,9 +192,17 @@ void TFT_ILI9163C::begin(void) {
|
|||
|
||||
|
||||
void TFT_ILI9163C::chipInit() {
|
||||
uint8_t i;
|
||||
#if defined(__GAMMASET1)
|
||||
const uint8_t pGammaSet[15]= {0x36,0x29,0x12,0x22,0x1C,0x15,0x42,0xB7,0x2F,0x13,0x12,0x0A,0x11,0x0B,0x06};
|
||||
const uint8_t nGammaSet[15]= {0x09,0x16,0x2D,0x0D,0x13,0x15,0x40,0x48,0x53,0x0C,0x1D,0x25,0x2E,0x34,0x39};
|
||||
#elif defined(__GAMMASET2)
|
||||
const uint8_t pGammaSet[15]= {0x3F,0x21,0x12,0x22,0x1C,0x15,0x42,0xB7,0x2F,0x13,0x02,0x0A,0x01,0x00,0x00};
|
||||
const uint8_t nGammaSet[15]= {0x09,0x18,0x2D,0x0D,0x13,0x15,0x40,0x48,0x53,0x0C,0x1D,0x25,0x2E,0x24,0x29};
|
||||
#elif defined(__GAMMASET3)
|
||||
const uint8_t pGammaSet[15]= {0x3F,0x26,0x23,0x30,0x28,0x10,0x55,0xB7,0x40,0x19,0x10,0x1E,0x02,0x01,0x00};
|
||||
//&const uint8_t nGammaSet[15]= {0x00,0x19,0x1C,0x0F,0x14,0x0F,0x2A,0x48,0x3F,0x06,0x1D,0x21,0x3D,0x3F,0x3F};
|
||||
const uint8_t nGammaSet[15]= {0x09,0x18,0x2D,0x0D,0x13,0x15,0x40,0x48,0x53,0x0C,0x1D,0x25,0x2E,0x24,0x29};
|
||||
#else
|
||||
const uint8_t pGammaSet[15]= {0x3F,0x25,0x1C,0x1E,0x20,0x12,0x2A,0x90,0x24,0x11,0x00,0x00,0x00,0x00,0x00};
|
||||
const uint8_t nGammaSet[15]= {0x20,0x20,0x20,0x20,0x05,0x15,0x00,0xA7,0x3D,0x18,0x25,0x2A,0x2B,0x2B,0x3A};
|
||||
|
|
@ -210,23 +218,24 @@ void TFT_ILI9163C::chipInit() {
|
|||
writedata8_cont(0x05);
|
||||
delay(5);
|
||||
writecommand_cont(CMD_GAMMASET);//default gamma curve 3
|
||||
writedata8_cont(0x04);//0x04
|
||||
writedata8_cont(0x08);//0x04
|
||||
delay(1);
|
||||
writecommand_cont(CMD_GAMRSEL);//Enable Gamma adj
|
||||
writedata8_cont(0x01);
|
||||
delay(1);
|
||||
writecommand_cont(CMD_NORML);
|
||||
|
||||
|
||||
writecommand_cont(CMD_DFUNCTR);
|
||||
writedata8_cont(0b11111111);//
|
||||
writedata8_cont(0b00000110);//
|
||||
|
||||
writecommand_cont(CMD_PGAMMAC);//Positive Gamma Correction Setting
|
||||
for (uint8_t i=0;i<15;i++){
|
||||
for (i=0;i<15;i++){
|
||||
writedata8_cont(pGammaSet[i]);
|
||||
}
|
||||
writecommand_cont(CMD_NGAMMAC);//Negative Gamma Correction Setting
|
||||
for (uint8_t i=0;i<15;i++){
|
||||
for (i=0;i<15;i++){
|
||||
writedata8_cont(nGammaSet[i]);
|
||||
}
|
||||
|
||||
|
|
@ -298,11 +307,11 @@ void TFT_ILI9163C::chipInit() {
|
|||
writedata(0b00000110);//
|
||||
|
||||
writecommand(CMD_PGAMMAC);//Positive Gamma Correction Setting
|
||||
for (uint8_t i=0;i<15;i++){
|
||||
for (i=0;i<15;i++){
|
||||
writedata(pGammaSet[i]);
|
||||
}
|
||||
writecommand(CMD_NGAMMAC);//Negative Gamma Correction Setting
|
||||
for (uint8_t i=0;i<15;i++){
|
||||
for (i=0;i<15;i++){
|
||||
writedata(nGammaSet[i]);
|
||||
}
|
||||
|
||||
|
|
@ -382,6 +391,27 @@ void TFT_ILI9163C::clearScreen(uint16_t color) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void TFT_ILI9163C::writeScreen(const uint32_t *bitmap) {
|
||||
uint16_t color;
|
||||
#if defined(__MK20DX128__) || defined(__MK20DX256__)
|
||||
SPI.beginTransaction(SPISettings(SPICLOCK, MSBFIRST, SPI_MODE0));
|
||||
_setAddrWindow(0x00,0x00,_GRAMWIDTH-1,_GRAMHEIGH-1);
|
||||
for (uint32_t px = 0;px < 16383; px++){
|
||||
color = Color24To565(bitmap[px]);
|
||||
writedata16_cont(color);
|
||||
}
|
||||
color = Color24To565(bitmap[16383]);
|
||||
writedata16_last(color);
|
||||
SPI.endTransaction();
|
||||
#else
|
||||
homeAddress();
|
||||
for (uint32_t px = 0;px < 16384; px++){
|
||||
color = Color24To565(bitmap[px]);
|
||||
writedata16(color);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void TFT_ILI9163C::homeAddress() {
|
||||
setAddrWindow(0x00,0x00,_GRAMWIDTH-1,_GRAMHEIGH-1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@
|
|||
0.2b5: Cleaning
|
||||
0.3b1: Complete rework on Teensy SPI based on Paul Stoffregen work
|
||||
SPI transaction,added BLACK TAG 2.2 display
|
||||
0.3b2: Minor fix, load 24bit image, Added conversion utility
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
BugList of the current version:
|
||||
|
||||
|
|
@ -139,10 +140,10 @@ you can copy those parameters and create setup for different displays.
|
|||
#define _TFTWIDTH 128//the REAL W resolution of the TFT
|
||||
#define _TFTHEIGHT 128//the REAL H resolution of the TFT
|
||||
#define _GRAMWIDTH 128
|
||||
#define _GRAMHEIGH 160
|
||||
#define _GRAMHEIGH 128//160
|
||||
#define _GRAMSIZE _GRAMWIDTH * _GRAMHEIGH//*see note 1
|
||||
#define __COLORSPC 1// 1:GBR - 0:RGB
|
||||
#define __GAMMASET1 //uncomment for another gamma
|
||||
#define __GAMMASET3 //uncomment for another gamma
|
||||
#define __OFFSET 32//*see note 2
|
||||
//Tested!
|
||||
#elif defined (__144_BLACK_PCB__)
|
||||
|
|
@ -212,8 +213,8 @@ Not tested!
|
|||
#define CMD_CLRSPACE 0x2D//Color Space : 4K/65K/262K
|
||||
#define CMD_PARTAREA 0x30//Partial Area
|
||||
#define CMD_VSCLLDEF 0x33//Vertical Scroll Definition
|
||||
#define CMD_TEFXLON 0x34//Tearing Effect Line ON
|
||||
#define CMD_TEFXLOF 0x35//Tearing Effect Line OFF
|
||||
#define CMD_TEFXLON 0x35//Tearing Effect Line ON
|
||||
#define CMD_TEFXLOF 0x34//Tearing Effect Line OFF
|
||||
#define CMD_MADCTL 0x36//Memory Access Control
|
||||
|
||||
#define CMD_PIXFMT 0x3A//Interface Pixel Format
|
||||
|
|
@ -259,11 +260,13 @@ class TFT_ILI9163C : public Adafruit_GFX {
|
|||
drawLine(int16_t x0, int16_t y0,int16_t x1, int16_t y1, uint16_t color),
|
||||
drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color),
|
||||
#endif
|
||||
//drawChar(int16_t x, int16_t y, unsigned char c, uint16_t fgcolor, uint16_t bgcolor, uint8_t size),
|
||||
fillRect(int16_t x, int16_t y, int16_t w, int16_t h,uint16_t color),
|
||||
setRotation(uint8_t r),
|
||||
invertDisplay(boolean i);
|
||||
void writeScreen(const uint32_t *bitmap);
|
||||
uint16_t Color565(uint8_t r, uint8_t g, uint8_t b);
|
||||
//convert 24bit color into packet 16 bit one (credits for this are all mine)
|
||||
inline uint16_t Color24To565(int32_t color_) { return ((((color_ >> 16) & 0xFF) / 8) << 11) | ((((color_ >> 8) & 0xFF) / 4) << 5) | (((color_) & 0xFF) / 8);}
|
||||
void setBitrate(uint32_t n);
|
||||
|
||||
private:
|
||||
|
|
|
|||
BIN
_utility/ILI9163C.pdf
Normal file
BIN
_utility/ILI9163C.pdf
Normal file
Binary file not shown.
BIN
_utility/lcd-image-converter.zip
Normal file
BIN
_utility/lcd-image-converter.zip
Normal file
Binary file not shown.
25
examples/bigPicture/bigPicture.ino
Normal file
25
examples/bigPicture/bigPicture.ino
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -7,5 +7,7 @@ setBitrate KEYWORD2
|
|||
Color565 KEYWORD2
|
||||
setBitrate KEYWORD2
|
||||
clearScreen KEYWORD2
|
||||
writeScreen KEYWORD2
|
||||
Color24To565 KEYWORD2
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue