Use of different pins for SPI with GxEPD2

Just FYI @ZinggJM: I made the necessary changes for the BW display driver in the fork michaelschnyder/GxEPD2 at Add-Support-For-Custom-SPI-Pins (github.com).

Quick summary (from the ReadMe)

const int SCRN_BUSY = 26;     // ePaper Busy indicator (SPI MISO aquivalent)
const int SCRN_RSET = 13;     // ePaper Reset switch
const int SCRN_DC   = 12;     // ePaper Data/Command selection
const int SCRN_CS   = 15;     // SPI Channel Chip Selection for ePaper
const int SCRN_SCK  = 14;     // SPI Channel Click
const int SCRN_SDI  = 27;     // SPI Channel MOSI Pin  
const int SCRN_SPI_CHAN = 2;  // HSPI

GxEPD2_DISPLAY_CLASS<GxEPD2_DRIVER_CLASS, MAX_HEIGHT(GxEPD2_DRIVER_CLASS)> display(GxEPD2_DRIVER_CLASS(SCRN_CS, SCRN_DC, SCRN_RSET, SCRN_BUSY));

SPIClass otherSPI(SCRN_SPI_CHAN ); // Default is VSPI, which is probably in use for the SD Card
display.init(SCRN_SCK, SCRN_BUSY, SCRN_SDI, SCRN_CS, SCRN_SPI_CHAN);

Files changed can be seen here: include overloads to specify pins and SPI bus ยท michaelschnyder/GxEPD2@9f662da (github.com). Summary

  • Use SPI instance to communicate instead of SPI so that a SPIClass with different bus Id can be passed in
  • Pass in additional PINs to both the Class and Driver and make sure the existing signatures remain intact.
  • Tested with and without additional parameters

No expectations here, just wanted to summarize and close this thread. If you have suggestions and remarks it would be appreciated for sure. Also I did not add a PR as I cannot provide the code for all display types because of lack of hardware to test.

-Michael