I'm a little confused about not using the RESET on an ST7735-based display.
If I set up the display with
Code:
ST7735_t3 tft = ST7735_t3(10, 15);
It should ignore the RESET pin and use the default value. The ST7735_t3.h file says:
Code:
class ST7735_t3 : public Adafruit_GFX {
public:
ST7735_t3(uint8_t CS, uint8_t RS, uint8_t SID, uint8_t SCLK, uint8_t RST = -1);
ST7735_t3(uint8_t CS, uint8_t RS, uint8_t RST = -1);
So the reset pin should be optional. The ST7735_t3 library has this in the constructor code:
Code:
// Constructor when using hardware SPI. Faster, but must use SPI pins
// specific to each board type (e.g. 11,13 for Uno, 51,52 for Mega, etc.)
ST7735_t3::ST7735_t3(uint8_t cs, uint8_t rs, uint8_t rst) :
Adafruit_GFX(ST7735_TFTWIDTH, ST7735_TFTHEIGHT_18) {
_cs = cs;
_rs = rs;
_rst = rst;
hwSPI = true;
_sid = _sclk = (uint8_t)-1;
}
All seems good, the RESET pin is saved into _rst, which is declared as uint8_t. The problem comes in where it is used in commonInit():
Code:
if (_rst) {
pinMode(_rst, OUTPUT);
digitalWrite(_rst, HIGH);
delay(5);
digitalWrite(_rst, LOW);
delay(100);
digitalWrite(_rst, HIGH);
delay(5);
}
When the RESET pin is left off of the constructor, _rst is initialized to -1. _rst is declared as uint8_t, so its value is really 0xff. The commonInit() code is using _rst as a boolean.
I expect 0xff to be evaluated as True, so the reset code is executed using an invalid pin number (0xff). It probably doesn't hurt anything, but it does add an unnecessary delay.
It looks to me like the only way to not use the RESET is to specify pin number 0, a perfectly valid pin.
Am I just not reading the code right?