change init to retry ILI9341 checks a few times
This commit is contained in:
parent
d73bbf1866
commit
8ad1ede59f
1 changed files with 9 additions and 5 deletions
|
|
@ -872,6 +872,15 @@ uint16_t Adafruit_TFTLCD::readPixel(int16_t x, int16_t y) {
|
|||
|
||||
// Ditto with the read/write port directions, as above.
|
||||
uint16_t Adafruit_TFTLCD::readID(void) {
|
||||
uint16_t id;
|
||||
|
||||
// retry a bunch!
|
||||
for (int i = 0; i<5; i++) {
|
||||
id = readReg(0xD3);
|
||||
if (id == 0x9341) {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t hi, lo;
|
||||
|
||||
|
|
@ -899,11 +908,6 @@ uint16_t Adafruit_TFTLCD::readID(void) {
|
|||
}
|
||||
}
|
||||
|
||||
uint16_t id = readReg(0xD3);
|
||||
if (id == 0x9341) {
|
||||
return id;
|
||||
}
|
||||
|
||||
CS_ACTIVE;
|
||||
CD_COMMAND;
|
||||
write8(0x00);
|
||||
|
|
|
|||
Loading…
Reference in a new issue