Added a routine to track init errors
This commit is contained in:
parent
2ca4e26eb6
commit
55b1f58e63
5 changed files with 79 additions and 111 deletions
|
|
@ -274,7 +274,7 @@
|
|||
void TFT_ILI9163C::begin(void)
|
||||
{
|
||||
sleep = 0;
|
||||
|
||||
_initError = 0b00000000;
|
||||
#if defined(__AVR__)
|
||||
pinMode(_rs, OUTPUT);
|
||||
pinMode(_cs, OUTPUT);
|
||||
|
|
@ -325,6 +325,7 @@ void TFT_ILI9163C::begin(void)
|
|||
SPI.setMOSI(_mosi);
|
||||
SPI.setSCK(_sclk);
|
||||
} else {
|
||||
bitSet(_initError,1);
|
||||
return;
|
||||
}
|
||||
SPI.begin();
|
||||
|
|
@ -334,6 +335,7 @@ void TFT_ILI9163C::begin(void)
|
|||
} else {
|
||||
pcs_data = 0;
|
||||
pcs_command = 0;
|
||||
bitSet(_initError,0);
|
||||
return;
|
||||
}
|
||||
#else//all the rest of possible boards
|
||||
|
|
@ -384,7 +386,10 @@ void TFT_ILI9163C::begin(void)
|
|||
chipInit();
|
||||
}
|
||||
|
||||
|
||||
uint8_t TFT_ILI9163C::errorCode(void)
|
||||
{
|
||||
return _initError;
|
||||
}
|
||||
|
||||
void TFT_ILI9163C::chipInit() {
|
||||
uint8_t i;
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@ class TFT_ILI9163C : public Adafruit_GFX {
|
|||
fillRect(int16_t x, int16_t y, int16_t w, int16_t h,uint16_t color),
|
||||
setRotation(uint8_t r),
|
||||
invertDisplay(boolean i);
|
||||
uint8_t errorCode(void);
|
||||
void idleMode(boolean onOff);
|
||||
void display(boolean onOff);
|
||||
void sleepMode(boolean mode);
|
||||
|
|
@ -447,5 +448,6 @@ class TFT_ILI9163C : public Adafruit_GFX {
|
|||
void chipInit();
|
||||
bool boundaryCheck(int16_t x,int16_t y);
|
||||
void homeAddress();
|
||||
uint8_t _initError;
|
||||
};
|
||||
#endif
|
||||
|
|
@ -87,73 +87,21 @@ Not tested!
|
|||
#endif
|
||||
|
||||
/*
|
||||
|
||||
Benchmark Time (microseconds)
|
||||
Screen fill 74697
|
||||
Text 4841
|
||||
Lines 16025
|
||||
Screen fill 74698
|
||||
Text 4253
|
||||
Text2 15366
|
||||
Lines 16034
|
||||
Horiz/Vert Lines 5028
|
||||
Rectangles (outline) 4181
|
||||
Rectangles (filled) 91225
|
||||
Circles (filled) 14452
|
||||
Circles (outline) 16397
|
||||
Rectangles (outline) 4183
|
||||
Rectangles (filled) 91226
|
||||
Circles (filled) 14436
|
||||
Circles (outline) 14910
|
||||
Triangles (outline) 5069
|
||||
Triangles (filled) 30715
|
||||
Rounded rects (outline) 10382
|
||||
Rounded rects (filled) 99552
|
||||
Triangles (filled) 30717
|
||||
Rounded rects (outline) 9910
|
||||
Rounded rects (filled) 99550
|
||||
Done!
|
||||
|
||||
Benchmark Time (microseconds)
|
||||
Screen fill 74697
|
||||
Text 4453
|
||||
Text2 16541
|
||||
Lines 16027
|
||||
Horiz/Vert Lines 5029
|
||||
Rectangles (outline) 4185
|
||||
Rectangles (filled) 91223
|
||||
Circles (filled) 14408
|
||||
Circles (outline) 15082
|
||||
Triangles (outline) 5067
|
||||
Triangles (filled) 17439
|
||||
Rounded rects (outline) 10023
|
||||
Rounded rects (filled) 99513
|
||||
Done!
|
||||
|
||||
|
||||
|
||||
Benchmark Time (microseconds)
|
||||
Screen fill 277415
|
||||
Text 11618
|
||||
Text2 36043
|
||||
Lines 58163
|
||||
Horiz/Vert Lines 18655
|
||||
Rectangles (outline) 15391
|
||||
Rectangles (filled) 338450
|
||||
Circles (filled) 53050
|
||||
Circles (outline) 39227
|
||||
Triangles (outline) 18302
|
||||
Triangles (filled) 64198
|
||||
Rounded rects (outline) 29676
|
||||
Rounded rects (filled) 368960
|
||||
Done!
|
||||
|
||||
|
||||
|
||||
Benchmark Time (microseconds)
|
||||
Screen fill 277422
|
||||
Text 13066
|
||||
Lines 58240
|
||||
Horiz/Vert Lines 18655
|
||||
Rectangles (outline) 15422
|
||||
Rectangles (filled) 339230
|
||||
Circles (filled) 53049
|
||||
Circles (outline) 43195
|
||||
Triangles (outline) 18350
|
||||
Triangles (filled) 113536
|
||||
Rounded rects (outline) 31470
|
||||
Rounded rects (filled) 369703
|
||||
Done!
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
|
@ -19,6 +19,8 @@
|
|||
#define YELLOW 0xFFE0
|
||||
#define WHITE 0xFFFF
|
||||
|
||||
uint8_t errorCode = 0;
|
||||
|
||||
/*
|
||||
Teensy3.x and Arduino's
|
||||
You are using 4 wire SPI here, so:
|
||||
|
|
@ -28,77 +30,87 @@ You are using 4 wire SPI here, so:
|
|||
the rest of pin below:
|
||||
*/
|
||||
#define __CS 10
|
||||
#define __DC 9
|
||||
#define __DC 6
|
||||
/*
|
||||
Teensy 3.x can use: 2,6,9,10,15,20,21,22,23
|
||||
Arduino's 8 bit: any
|
||||
DUE: check arduino site
|
||||
IMPORTANT!!!
|
||||
If you do not use reset pin, tie it to +3V3!! Do not leave floating!
|
||||
If you do not use reset, tie it to +3V3
|
||||
*/
|
||||
|
||||
|
||||
TFT_ILI9163C tft = TFT_ILI9163C(__CS, __DC);
|
||||
TFT_ILI9163C tft = TFT_ILI9163C(__CS, __DC, 23);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(38400);
|
||||
long unsigned debug_start = millis ();
|
||||
while (!Serial && ((millis () - debug_start) <= 5000)) ;
|
||||
tft.begin();
|
||||
//the following it's mainly for Teensy
|
||||
//it will help you to understand if you have choosed the
|
||||
//wrong combination of pins!
|
||||
errorCode = tft.errorCode();
|
||||
if (errorCode != 0) {
|
||||
Serial.print("Init error! ");
|
||||
if (bitRead(errorCode, 0)) Serial.print("MOSI or SCLK pin mismach!\n");
|
||||
if (bitRead(errorCode, 1)) Serial.print("CS or DC pin mismach!\n");
|
||||
} else {
|
||||
Serial.println(F("Benchmark Time (microseconds)"));
|
||||
}
|
||||
if (errorCode == 0) {
|
||||
Serial.print(F("Screen fill "));
|
||||
Serial.println(testFillScreen());
|
||||
delay(500);
|
||||
|
||||
Serial.println(F("Benchmark Time (microseconds)"));
|
||||
Serial.print(F("Screen fill "));
|
||||
Serial.println(testFillScreen());
|
||||
delay(500);
|
||||
Serial.print(F("Text "));
|
||||
Serial.println(testText());
|
||||
delay(3000);
|
||||
|
||||
Serial.print(F("Text "));
|
||||
Serial.println(testText());
|
||||
delay(3000);
|
||||
Serial.print(F("Text2 "));
|
||||
Serial.println(testText2());
|
||||
delay(3000);
|
||||
|
||||
Serial.print(F("Text2 "));
|
||||
Serial.println(testText2());
|
||||
delay(3000);
|
||||
Serial.print(F("Lines "));
|
||||
Serial.println(testLines(CYAN));
|
||||
delay(500);
|
||||
|
||||
Serial.print(F("Lines "));
|
||||
Serial.println(testLines(CYAN));
|
||||
delay(500);
|
||||
Serial.print(F("Horiz/Vert Lines "));
|
||||
Serial.println(testFastLines(RED, BLUE));
|
||||
delay(500);
|
||||
|
||||
Serial.print(F("Horiz/Vert Lines "));
|
||||
Serial.println(testFastLines(RED, BLUE));
|
||||
delay(500);
|
||||
Serial.print(F("Rectangles (outline) "));
|
||||
Serial.println(testRects(GREEN));
|
||||
delay(500);
|
||||
|
||||
Serial.print(F("Rectangles (outline) "));
|
||||
Serial.println(testRects(GREEN));
|
||||
delay(500);
|
||||
Serial.print(F("Rectangles (filled) "));
|
||||
Serial.println(testFilledRects(YELLOW, MAGENTA));
|
||||
delay(500);
|
||||
|
||||
Serial.print(F("Rectangles (filled) "));
|
||||
Serial.println(testFilledRects(YELLOW, MAGENTA));
|
||||
delay(500);
|
||||
Serial.print(F("Circles (filled) "));
|
||||
Serial.println(testFilledCircles(10, MAGENTA));
|
||||
|
||||
Serial.print(F("Circles (filled) "));
|
||||
Serial.println(testFilledCircles(10, MAGENTA));
|
||||
Serial.print(F("Circles (outline) "));
|
||||
Serial.println(testCircles(10, WHITE));
|
||||
delay(500);
|
||||
|
||||
Serial.print(F("Circles (outline) "));
|
||||
Serial.println(testCircles(10, WHITE));
|
||||
delay(500);
|
||||
Serial.print(F("Triangles (outline) "));
|
||||
Serial.println(testTriangles());
|
||||
delay(500);
|
||||
|
||||
Serial.print(F("Triangles (outline) "));
|
||||
Serial.println(testTriangles());
|
||||
delay(500);
|
||||
Serial.print(F("Triangles (filled) "));
|
||||
Serial.println(testFilledTriangles());
|
||||
delay(500);
|
||||
|
||||
Serial.print(F("Triangles (filled) "));
|
||||
Serial.println(testFilledTriangles());
|
||||
delay(500);
|
||||
Serial.print(F("Rounded rects (outline) "));
|
||||
Serial.println(testRoundRects());
|
||||
delay(500);
|
||||
|
||||
Serial.print(F("Rounded rects (outline) "));
|
||||
Serial.println(testRoundRects());
|
||||
delay(500);
|
||||
Serial.print(F("Rounded rects (filled) "));
|
||||
Serial.println(testFilledRoundRects());
|
||||
delay(500);
|
||||
|
||||
Serial.print(F("Rounded rects (filled) "));
|
||||
Serial.println(testFilledRoundRects());
|
||||
delay(500);
|
||||
|
||||
Serial.println(F("Done!"));
|
||||
Serial.println(F("Done!"));
|
||||
}
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
|
|
@ -17,4 +17,5 @@ endPushData KEYWORD2
|
|||
defineScrollArea KEYWORD2
|
||||
writeScreen24 KEYWORD2
|
||||
idleMode KEYWORD2
|
||||
errorCode KEYWORD2
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue