adafruit / TFTLCD-Library

Arduino library for 8-bit TFT LCDs such as ILI9325, ILI9328, etc
http://www.ladyada.net/products/tfttouchbreakout/ and http://www.ladyada.net/products/tfttouchshield
319 stars 260 forks source link

Constructor is setting a digital pin before setting OUTPUT mode. #49

Open midi-mma opened 4 years ago

midi-mma commented 4 years ago

In the constructor Adafruit_TFTLCD::Adafruit_TFTLCD(uint8_t cs, uint8_t cd, uint8_t wr, uint8_t rd, uint8_t reset)

we see the following lines of code:

  if (reset) {
    digitalWrite(reset, HIGH);
    pinMode(reset, OUTPUT);
  }

Is it valid to be setting the line to HIGH before the pinMode is set? On SAMD51 the default pin mode is INPUT_PULLUP.

ladyada commented 4 years ago

oh yeah thats an old Arduinoism - if you can submit a tested PR that would be great

midi-mma commented 4 years ago

Unfortunately, I am unable to submit a tested PR at this time, because I am trying to get the HX8357 display working on the Grand Central M4, and I'm working with the code in the SAMD51 branch. Unfortunately my wiring does not match the breakout board exactly. But I noticed this issue while looking through the code. Sorry!

makermelissa commented 4 years ago

I believe the reasoning for this is to avoid dropping the reset line low between the 2 calls and resetting the processor.