adafruit / Adafruit_HX8357_Library

Arduino library for HX8357
43 stars 37 forks source link

issue https://github.com/adafruit/Adafruit_HX8357_Library/issues/25 is resolved #27

Closed dsyleixa closed 5 years ago

dsyleixa commented 5 years ago

issue https://github.com/adafruit/Adafruit_HX8357_Library/issues/25 is resolved, the example code has the wrong pin definitions.

instead of

define TFT_CS 10

define TFT_DC 9

define TFT_RST 8 // RST can be set to -1 if you tie it to Arduino's reset

would be needed:

ifdef ESP8266

define STMPE_CS 16

define TFT_CS 0

define TFT_DC 15

define SD_CS 2

elif defined ESP32

define STMPE_CS 32

define TFT_CS 15

define TFT_DC 33

define SD_CS 14

elif defined TEENSYDUINO

define TFT_DC 10

define TFT_CS 4

define STMPE_CS 3

define SD_CS 8

elif defined ARDUINO_STM32_FEATHER

define TFT_DC PB4

define TFT_CS PA15

define STMPE_CS PC7

define SD_CS PC5

elif defined ARDUINO_FEATHER52

define STMPE_CS 30

define TFT_CS 13

define TFT_DC 11

define SD_CS 27

elif defined(ARDUINO_MAX32620FTHR) || defined(ARDUINO_MAX32630FTHR)

define TFT_DC P5_4

define TFT_CS P5_3

define STMPE_CS P3_3

define SD_CS P3_2

// Something else!

elif defined (AVR_ATmega32U4__) || defined(ARDUINO_SAMD_FEATHER_M0) || defined (AVR_ATmega328P) || defined(ARDUINO_SAMD_ZERO) || defined(SAMD51__)

define STMPE_CS 6

define TFT_CS 9

define TFT_DC 10

define SD_CS 5

// default

else

define STMPE_CS 6

define TFT_CS 9

define TFT_DC 10

define SD_CS 5

endif

define TFT_RST -1

ladyada commented 5 years ago

thanks, please submit a PR for the fix!

dsyleixa commented 5 years ago

no idea how to do that - what is a PR?

ladyada commented 5 years ago

all good, we have 2 excelleng guides, and this is a great (and key) skill to pick up https://learn.adafruit.com/an-introduction-to-collaborating-with-version-control https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github

dsyleixa commented 5 years ago

hmm - too complicated, and my English skills are far too poor. But now you eventually have my bug fix so you might fix that easilly for your next release!

ladyada commented 5 years ago

try it! our guides are very detailed but the process isnt that complex

makermelissa commented 5 years ago

In which example file are the pins defined incorrectly?

dsyleixa commented 5 years ago

no, thanks! I reported the bug and the fix, I fixed that for myself, so all right now to me! Feel free to copy that for your own purposes!

dsyleixa commented 5 years ago

it was in the graphicstest example

dsyleixa commented 5 years ago

PS, but also graphicstest_featherwing is missing the SAMD51 #defines

makermelissa commented 5 years ago

The graphicstest example is for the breakout and is intended to have pin numbers changed if it suits you. graphicstest_featherwing is meant if you have the FeatherWing, which it sounds like you do. I will try a feather M0 on it a little later.

makermelissa commented 5 years ago

It works fine on both the Feather M4 using defined(__SAMD51__) and Feather M0 using defined(ARDUINO_SAMD_ZERO), but was missing a check for the nRF52840 Express, which I have added as defined(ARDUINO_NRF52_FEATHER) and will submit a PR.

dsyleixa commented 5 years ago

yes, indeed mixing all breakout and featherwing examples in 1 single examples folder is confusing for users, tbh, I would recommend to create to 2 different subfolders called "breakout_examples" and "featherwing_examples" containing just the proprietary subset of example sources.

BTW, #ifdef SAMD_SERIES covers all SAMD boards (M0==SAMD21, M4==SAMD51)

whilst #ifdef SAM covers all ARM Cortex SAM boards, e.g. SAMD21, SAMD51, ATSAM3X8E (==Arduino Due M3) and probably even more.

perhaps one or the other might make your examples more readable.... 8)

makermelissa commented 5 years ago

Good ideas. :)