Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hardware SPI on ESP32 #61

Open
dl9rdz opened this issue Oct 7, 2019 · 1 comment
Open

Hardware SPI on ESP32 #61

dl9rdz opened this issue Oct 7, 2019 · 1 comment

Comments

@dl9rdz
Copy link

dl9rdz commented Oct 7, 2019

ESP32 supports hardware SPI on arbitrary GPIO pins.

Could you add a feature that allows using hardware SPI instead of software SPI in the code?(instead of activating software SPI for non-standard pins, the pin numbers need to be passed to _spi.begin(...) as arguments)

A quick&dirty hack solution (for ESP32 only, tested and functional) is to replace

// Hardware SPI
SPI_BEGIN();

with

// Hardware SPI
if(_clk < 0) { SPI_BEGIN();  } 
else {
    SPI_OBJECT.begin(_clk, -1, _sdi, _cs);
    _clk = -1;  // force use of hardware SPI in remaining code parts
}

But this is not elegant, and of course should be made conditional only for ESP32

@MrEliptik
Copy link

Hi @dl9rdz , I'm also using an ESP32 and I'd like to use the hardware SPI. While there's no real implementation, I'd like to use your method, but I can't figure out how. I've replace SPI_BEGIN(); with your code, and I'm still initializing the TFT_22_ILI8225 object with the SDI and CLK pin, as I understand we specify those pins in the else statement. But using that, the display stays white, like there's no communication.
I'm using TFT_RST=4, TFT_RS=19, TFT_CS= 5, TFT_SDI=23,#define TFT_CLK=18 (VSPI pins).
Object declaration TFT_22_ILI9225 tft = TFT_22_ILI9225(TFT_RST, TFT_RS, TFT_CS, TFT_SDI, TFT_CLK, TFT_LED);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants