zxfr / Pixels

Graphics library for TFT displays
20 stars 12 forks source link

Operation with alternate SPI0 port on ESP-8266 #7

Open JamesNewton opened 6 years ago

JamesNewton commented 6 years ago

The ESP-12 (for example) has pins that access the SPI0 port (normal SPI is SPI1, SPI0 is used in the ESP to access the onboard FLASH) and it /can/ be used in sketches, if, and only if, you allow the ESP to arbitrate via the HWCS pin: https://arduino-esp8266.readthedocs.io/en/latest/libraries.html#spi

For this mode the CS will be controlled by hardware as you can’t handle the CS line with a GPIO, you never actually know when the arbiter is going to grant you access to the bus so you must let it handle CS automatically.

As it happens, in my application, I need the SPI1 MOSI pin, D7 / GPIO13, for it's other function, as RX2 via Serial.swap() https://arduino-esp8266.readthedocs.io/en/latest/reference.html#serial I don't believe the software serial will work, because I'm also running multiple other services and it has issues: https://github.com/plerup/espsoftwareserial/issues

This is supported in /Bodmer/TFT_eSPI https://github.com/Bodmer/TFT_eSPI/issues/74#issuecomment-356948265

However that library does not support hardware scrolling.